diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2000-07-09 13:14:19 +0000 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2000-07-09 13:14:19 +0000 |
commit | 74618e2b82b5158adf42caf64af70cbd7c699c6c (patch) | |
tree | f4782dc597569b1e2feb6ac50cad217dc39f35ee /src | |
parent | b59c03f84206ed3f3f864dcbe337ec04b2a8558d (diff) | |
download | postgresql-74618e2b82b5158adf42caf64af70cbd7c699c6c.tar.gz postgresql-74618e2b82b5158adf42caf64af70cbd7c699c6c.zip |
Another round of those unportable config/build changes :-/
* Add option to build with OpenSSL out of the box. Fix thusly exposed
bit rot. Although it compiles now, getting this to do something
useful is left as an exercise.
* Fix Kerberos options to defer checking for required libraries until
all the other libraries are checked for.
* Change default odbcinst.ini and krb5.srvtab path to PREFIX/etc.
* Install work around for Autoconf's install-sh relative path anomaly.
Get rid of old INSTL_*_OPTS variables, now that we don't need them
anymore.
* Use `gunzip -c' instead of g?zcat. Reportedly broke on AIX.
* Look for only one of readline.h or readline/readline.h, not both.
* Make check for PS_STRINGS cacheable. Don't test for the header files
separately.
* Disable fcntl(F_SETLK) test on Linux.
* Substitute the standard GCC warnings set into CFLAGS in configure,
don't add it on in Makefile.global.
* Sweep through contrib tree to teach makefiles standard semantics.
... and in completely unrelated news:
* Make postmaster.opts arbitrary options-aware. I still think we need to
save the environment as well.
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.global.in | 35 | ||||
-rw-r--r-- | src/backend/libpq/Makefile | 11 | ||||
-rw-r--r-- | src/backend/postmaster/postmaster.c | 161 | ||||
-rw-r--r-- | src/backend/utils/init/findbe.c | 4 | ||||
-rw-r--r-- | src/backend/utils/misc/ps_status.c | 8 | ||||
-rw-r--r-- | src/include/config.h.in | 6 | ||||
-rw-r--r-- | src/include/miscadmin.h | 4 | ||||
-rw-r--r-- | src/interfaces/libpq/fe-connect.c | 12 | ||||
-rwxr-xr-x | src/test/regress/run_check.sh | 4 |
9 files changed, 79 insertions, 166 deletions
diff --git a/src/Makefile.global.in b/src/Makefile.global.in index cf766b08b61..2c3e85f2d5c 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -7,7 +7,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.85 2000/07/02 15:20:41 petere Exp $ +# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.86 2000/07/09 13:13:59 petere Exp $ # # NOTES # Essentially all Postgres make files include this file and use the @@ -38,17 +38,23 @@ # PostgreSQL version number VERSION = @VERSION@ +ifndef top_builddir +top_builddir = $(SRCDIR)/.. +endif + ifndef SRCDIR +SRCDIR = $(top_builddir)/src +endif + # This should be changed once we have separate build dirs. top_srcdir = $(top_builddir) + ifeq ($(top_builddir), $(top_srcdir)) srcdir = . else srcdir = $(top_srcdir)/$(subdir) endif VPATH = $(srcdir) -SRCDIR = $(top_builddir)/src -endif ############################################################################## # @@ -88,7 +94,9 @@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ includedir = @includedir@ +mandir = @mandir@ +docdir = ${prefix}/doc odbcinst_ini_dir = @odbcinst_ini_dir@ # old variable names for installation directories @@ -97,8 +105,8 @@ POSTGRESDIR= $(prefix) BINDIR= $(bindir) LIBDIR= $(libdir) TEMPLATEDIR= $(libdir) -POSTMANDIR= $(POSTGRESDIR)/man -POSTDOCDIR= $(POSTGRESDIR)/doc +POSTMANDIR= $(mandir) +POSTDOCDIR= $(docdir) HEADERDIR= $(includedir) @@ -126,6 +134,8 @@ PYTHON = @PYTHON@ python_extmakefile = @python_extmakefile@ python_moduledir = @python_moduledir@ +krb_srvtab = @krb_srvtab@ + # # Please do not edit USE_TCL and USE_TK by hand. # @@ -156,12 +166,6 @@ INSTALL_SHLIB = @INSTALL_SHLIB@ mkinstalldirs = @mkinstalldirs@ -# don't use these any more -INSTLOPTS= @INSTLOPTS@ -INSTL_EXE_OPTS= @INSTL_EXE_OPTS@ -INSTL_LIB_OPTS= @INSTL_LIB_OPTS@ -INSTL_SHLIB_OPTS= @INSTL_SHLIB_OPTS@ - RANLIB= @RANLIB@ #------------------------------------------------------------- @@ -184,11 +188,11 @@ LDOUT= -o DLSUFFIX= @DLSUFFIX@ LN_S= @LN_S@ TAR= @tar@ -GZCAT= @GZCAT@ PERL = @PERL@ AWK = @AWK@ CXX=@CXX@ CXXFLAGS=@CXXFLAGS@ @INCLUDES@ +GCC = @GCC@ ############################################################################## @@ -259,12 +263,6 @@ ifneq ($(CUSTOM_COPT),) COPT= $(CUSTOM_COPT) endif -GCC = @GCC@ - -ifeq ($(GCC), yes) -CFLAGS+= -Wall -Wmissing-prototypes -Wmissing-declarations -endif - ifdef COPT CFLAGS+= $(COPT) LDFLAGS+= $(COPT) @@ -284,3 +282,4 @@ SNPRINTF = @SNPRINTF@ STRDUP = @STRDUP@ .PHONY: all install installdirs uninstall dep depend clean distclean maintainer-clean +.SILENT: installdirs diff --git a/src/backend/libpq/Makefile b/src/backend/libpq/Makefile index 8712a61bb91..f4ce69d9c92 100644 --- a/src/backend/libpq/Makefile +++ b/src/backend/libpq/Makefile @@ -4,11 +4,12 @@ # Makefile for libpq subsystem (backend half of libpq interface) # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/backend/libpq/Makefile,v 1.21 2000/07/08 03:04:39 tgl Exp $ +# $Header: /cvsroot/pgsql/src/backend/libpq/Makefile,v 1.22 2000/07/09 13:14:05 petere Exp $ # #------------------------------------------------------------------------- -SRCDIR = ../.. +subdir = src/backend/libpq +top_builddir = ../.. include ../../Makefile.global # be-fsstubs is here for historical reasons, probably belongs elsewhere @@ -17,6 +18,12 @@ OBJS = be-fsstubs.o \ auth.o crypt.o hba.o password.o \ pqcomm.o pqformat.o pqpacket.o pqsignal.o util.o +# This location might depend on the installation directories. Therefore +# we can't subsitute it into config.h. +ifdef krb_srvtab +CPPFLAGS += -DPG_KRB_SRVTAB='"$(krb_srvtab)"' +endif + all: SUBSYS.o diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index c20ddbd1ec4..580786c2e69 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -11,7 +11,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.153 2000/07/08 03:04:13 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.154 2000/07/09 13:14:05 petere Exp $ * * NOTES * @@ -86,11 +86,6 @@ #include "utils/exc.h" #include "utils/guc.h" -/* - * "postmaster.opts" is a file containing options for postmaser. - * pg_ctl will use it to restart postmaster. - */ -#define OPTSFNAME "postmaster.opts" #if !defined(MAXINT) #define MAXINT INT_MAX @@ -246,7 +241,7 @@ extern int optind, /* * postmaster.c - function prototypes */ -static void pmdaemonize(char *extraoptions); +static void pmdaemonize(int argc, char *argv[]); static Port *ConnCreate(int serverFd); static void ConnFree(Port *port); static void reset_shared(int port); @@ -267,15 +262,7 @@ static long PostmasterRandom(void); static void RandomSalt(char *salt); static void SignalChildren(SIGNAL_ARGS); static int CountChildren(void); -static int -SetOptsFile(char *progname, int port, char *datadir, - int assert, int nbuf, - int debuglvl, int netserver, -#ifdef USE_SSL - int securenetserver, -#endif - int maxbackends, int reinit, - int silent, int sendstop, char *extraoptions); +static bool CreateOptsFile(int argc, char *argv[]); extern int BootstrapMain(int argc, char *argv[]); static pid_t SSDataBase(bool startup); @@ -564,8 +551,8 @@ PostmasterMain(int argc, char *argv[]) #ifdef USE_SSL if (!NetServer && SecureNetServer) { - fprintf(stderr, "For SSL, you must enable TCP/IP connections.\n", - argv[0]); + fprintf(stderr, "%s: For SSL, you must enable TCP/IP connections.\n", + progname); exit(1); } InitSSL(); @@ -602,7 +589,7 @@ PostmasterMain(int argc, char *argv[]) PortList = DLNewList(); if (silentflag) - pmdaemonize(original_extraoptions); + pmdaemonize(argc, argv); else { @@ -612,26 +599,7 @@ PostmasterMain(int argc, char *argv[]) SetPidFname(DataDir); if (SetPidFile(getpid()) == 0) { - if (SetOptsFile( - progname, /* postmaster executable file */ - PostPortName, /* port number */ - DataDir, /* PGDATA */ - assert_enabled, /* whether -A is specified - * or not */ - NBuffers, /* -B: number of shared buffers */ - DebugLvl, /* -d: debug level */ - NetServer, /* -i: accept connection from INET */ -#ifdef USE_SSL - SecureNetServer, /* -l: use SSL */ -#endif - MaxBackends, /* -N: max number of - * backends */ - Reinit, /* -n: reinit shared mem after - * failure */ - silentflag, /* -S: detach tty */ - SendStop, /* -s: send SIGSTOP */ - original_extraoptions /* options for backend */ - ) != 0) + if (!CreateOptsFile(argc, argv)) { UnlinkPidFile(); ExitPostmaster(1); @@ -678,7 +646,7 @@ PostmasterMain(int argc, char *argv[]) } static void -pmdaemonize(char *extraoptions) +pmdaemonize(int argc, char *argv[]) { int i; pid_t pid; @@ -700,26 +668,7 @@ pmdaemonize(char *extraoptions) */ if (SetPidFile(pid) == 0) { - if (SetOptsFile( - progname, /* postmaster executable file */ - PostPortName, /* port number */ - DataDir, /* PGDATA */ - assert_enabled, /* whether -A is specified - * or not */ - NBuffers, /* -B: number of shared buffers */ - DebugLvl, /* -d: debug level */ - NetServer, /* -i: accept connection from INET */ -#ifdef USE_SSL - SecureNetServer, /* -l: use SSL */ -#endif - MaxBackends, /* -N: max number of - * backends */ - Reinit, /* -n: reinit shared mem after - * failure */ - 1, /* -S: detach tty */ - SendStop, /* -s: send SIGSTOP */ - extraoptions /* options for backend */ - ) != 0) + if (!CreateOptsFile(argc, argv)) { /* @@ -2202,84 +2151,44 @@ SSDataBase(bool startup) return (pid); } + /* * Create the opts file */ -static int -SetOptsFile(char *progname, int port, char *datadir, - int assert, int nbuf, - int debuglvl, int netserver, -#ifdef USE_SSL - int securenetserver, -#endif - int maxbackends, int reinit, - int silent, int sendstop, char *extraoptions) +static bool +CreateOptsFile(int argc, char *argv[]) { - int fd; - char optsfile[MAXPGPATH]; - char opts[1024]; - char buf[1024]; + char fullprogname[MAXPGPATH]; + char *filename; + FILE *fp; + unsigned i; - /* - * Creating opts file - */ - snprintf(optsfile, sizeof(optsfile), "%s/%s", datadir, OPTSFNAME); - fd = open(optsfile, O_RDWR | O_TRUNC | O_CREAT, 0600); - if (fd < 0) - { - fprintf(stderr, "Can't create optsfile:%s", optsfile); - return (-1); - } - snprintf(opts, sizeof(opts), "%s\n-p %d\n-D %s\n", progname, port, datadir); - if (assert) - { - sprintf(buf, "-A %d\n", assert); - strcat(opts, buf); - } + if (FindExec(fullprogname, argv[0], "postmaster") == -1) + return false; - snprintf(buf, sizeof(buf), "-B %d\n", nbuf); - strcat(opts, buf); + filename = palloc(strlen(DataDir) + 20); + sprintf(filename, "%s/postmaster.opts", DataDir); - if (debuglvl) + fp = fopen(filename, "w"); + if (fp == NULL) { - sprintf(buf, "-d %d\n", debuglvl); - strcat(opts, buf); + fprintf(stderr, "%s: cannot create file %s: %s\n", progname, + filename, strerror(errno)); + return false; } - if (netserver) - strcat(opts, "-i\n"); - -#ifdef USE_SSL - if (securenetserver) - strcat(opts, "-l\n"); -#endif - - snprintf(buf, sizeof(buf), "-N %d\n", maxbackends); - strcat(opts, buf); - - if (!reinit) - strcat(opts, "-n\n"); - - if (silent) - strcat(opts, "-S\n"); - - if (sendstop) - strcat(opts, "-s\n"); - - if (strlen(extraoptions) > 0) - { - strcat(opts, "-o '"); - strcat(opts, extraoptions); - strcat(opts, "'"); - } + fprintf(fp, "%s", fullprogname); + for (i = 1; i < argc; i++) + fprintf(fp, " '%s'", argv[i]); + fputs("\n", fp); - if (write(fd, opts, strlen(opts)) != strlen(opts)) + if (ferror(fp)) { - perror("Writing to opts file failed"); - close(fd); - return (-1); + fprintf(stderr, "%s: writing file %s failed\n", progname, filename); + fclose(fp); + return false; } - close(fd); - return (0); + fclose(fp); + return true; } diff --git a/src/backend/utils/init/findbe.c b/src/backend/utils/init/findbe.c index be9f2647d25..4568e76de54 100644 --- a/src/backend/utils/init/findbe.c +++ b/src/backend/utils/init/findbe.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/init/Attic/findbe.c,v 1.18 2000/06/08 22:37:33 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/init/Attic/findbe.c,v 1.19 2000/07/09 13:14:08 petere Exp $ * *------------------------------------------------------------------------- */ @@ -151,7 +151,7 @@ ValidateBinary(char *path) * we change directories to the /data directory. */ int -FindExec(char *full_path, char *argv0, char *binary_name) +FindExec(char *full_path, const char *argv0, const char *binary_name) { char buf[MAXPGPATH + 2]; char *p; diff --git a/src/backend/utils/misc/ps_status.c b/src/backend/utils/misc/ps_status.c index edc82f35218..75d9f8802c7 100644 --- a/src/backend/utils/misc/ps_status.c +++ b/src/backend/utils/misc/ps_status.c @@ -5,7 +5,7 @@ * to contain some useful information. Differs wildly across * platforms. * - * $Header: /cvsroot/pgsql/src/backend/utils/misc/ps_status.c,v 1.1 2000/06/04 01:44:34 petere Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/misc/ps_status.c,v 1.2 2000/07/09 13:14:11 petere Exp $ * * Copyright 2000 by PostgreSQL Global Development Group * various details abducted from various places @@ -20,11 +20,9 @@ #ifdef HAVE_SYS_PSTAT_H # include <sys/pstat.h> /* for HP-UX */ #endif -#ifdef HAVE_MACHINE_VMPARAM_H +#ifdef HAVE_PS_STRINGS # include <machine/vmparam.h> /* for old BSD */ -#endif -#ifdef HAVE_SYS_EXEC_H -# include <sys/exec.h> /* for old BSD */ +# include <sys/exec.h> #endif #include "miscadmin.h" diff --git a/src/include/config.h.in b/src/include/config.h.in index 2c2f5e4482c..25e8be291ff 100644 --- a/src/include/config.h.in +++ b/src/include/config.h.in @@ -8,7 +8,7 @@ * or in config.h afterwards. Of course, if you edit config.h, then your * changes will be overwritten the next time you run configure. * - * $Id: config.h.in,v 1.123 2000/07/05 17:44:29 scrappy Exp $ + * $Id: config.h.in,v 1.124 2000/07/09 13:14:13 petere Exp $ */ #ifndef CONFIG_H @@ -58,8 +58,8 @@ /* Kerberos name of the Postgres service principal (--with-krb-srvnam=NAME) */ #undef PG_KRB_SRVNAM -/* Location of the Kerberos server's keytab file (--with-krb-srvtab=FILE) */ -#undef PG_KRB_SRVTAB +/* Define to build with (Open)SSL support (--with-openssl[=DIR]) */ +#undef USE_SSL /* * DEF_PGPORT is the TCP port number on which the Postmaster listens and diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h index 59269216ea7..7bc96c9f76f 100644 --- a/src/include/miscadmin.h +++ b/src/include/miscadmin.h @@ -12,7 +12,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: miscadmin.h,v 1.62 2000/07/02 15:21:18 petere Exp $ + * $Id: miscadmin.h,v 1.63 2000/07/09 13:14:13 petere Exp $ * * NOTES * some of the information in this file will be moved to @@ -133,7 +133,7 @@ extern char *getpgusername(void); extern void SetPgUserName(void); extern int GetUserId(void); extern void SetUserId(void); -extern int FindExec(char *backend, char *argv0, char *binary_name); +extern int FindExec(char *full_path, const char *argv0, const char *binary_name); extern int CheckPathAccess(char *path, char *name, int open_mode); /* lower case version for case-insensitive SQL referenced in pg_proc.h */ diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index e1af29a1b28..c232256f608 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.130 2000/06/14 18:17:58 petere Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.131 2000/07/09 13:14:17 petere Exp $ * *------------------------------------------------------------------------- */ @@ -795,7 +795,7 @@ connectDBStart(PGconn *conn) np.protoVersion = htonl(NEGOTIATE_SSL_CODE); if (pqPacketSend(conn, (char *) &np, sizeof(StartupPacket)) != STATUS_OK) { - sprintf(conn->errorMessage, + printfPQExpBuffer(&conn->errorMessage, "connectDB() -- couldn't send SSL negotiation packet: errno=%d\n%s\n", errno, strerror(errno)); goto connect_errReturn; @@ -803,7 +803,7 @@ connectDBStart(PGconn *conn) /* Now receive the postmasters response */ if (recv(conn->sock, &SSLok, 1, 0) != 1) { - sprintf(conn->errorMessage, "PQconnectDB() -- couldn't read postmaster response: errno=%d\n%s\n", + printfPQExpBuffer(&conn->errorMessage, "PQconnectDB() -- couldn't read postmaster response: errno=%d\n%s\n", errno, strerror(errno)); goto connect_errReturn; } @@ -816,7 +816,7 @@ connectDBStart(PGconn *conn) SSL_context = SSL_CTX_new(SSLv23_method()); if (!SSL_context) { - sprintf(conn->errorMessage, + printfPQExpBuffer(&conn->errorMessage, "connectDB() -- couldn't create SSL context: %s\n", ERR_reason_error_string(ERR_get_error())); goto connect_errReturn; @@ -826,7 +826,7 @@ connectDBStart(PGconn *conn) !SSL_set_fd(conn->ssl, conn->sock) || SSL_connect(conn->ssl) <= 0) { - sprintf(conn->errorMessage, + printfPQExpBuffer(&conn->errorMessage, "connectDB() -- couldn't establish SSL connection: %s\n", ERR_reason_error_string(ERR_get_error())); goto connect_errReturn; @@ -844,7 +844,7 @@ connectDBStart(PGconn *conn) } else if (SSLok != 'N') { - strcpy(conn->errorMessage, + printfPQExpBuffer(&conn->errorMessage, "Received invalid negotiation response.\n"); goto connect_errReturn; } diff --git a/src/test/regress/run_check.sh b/src/test/regress/run_check.sh index d057d35264f..0a3b2347080 100755 --- a/src/test/regress/run_check.sh +++ b/src/test/regress/run_check.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# $Header: /cvsroot/pgsql/src/test/regress/Attic/run_check.sh,v 1.21 2000/07/06 21:33:45 petere Exp $ +# $Header: /cvsroot/pgsql/src/test/regress/Attic/run_check.sh,v 1.22 2000/07/09 13:14:19 petere Exp $ # ---------- # Check call syntax @@ -187,7 +187,7 @@ export PATH # Run initdb to initialize a database system in ./tmp_check # ---------- echo "=============== Initializing check database instance ================" -initdb -D $PGDATA --noclean >$LOGDIR/initdb.log 2>&1 +initdb -D $PGDATA -L $CHKDIR/share --noclean >$LOGDIR/initdb.log 2>&1 if [ $? -ne 0 ] then |