Add -V option to backend, to show version, since --version doesn't seem

to work everywhere.  Also, on FreeBSD you need to set the optreset variable
to 1 before parsing the command line a second time with getopt().
This commit is contained in:
Peter Eisentraut 2000-11-06 22:18:10 +00:00
parent 6f2f169015
commit 306c44eead
6 changed files with 107 additions and 50 deletions

110
configure vendored
View File

@ -6839,9 +6839,43 @@ else
fi
echo $ac_n "checking for optreset""... $ac_c" 1>&6
echo "configure:6844: checking for optreset" >&5
if eval "test \"`echo '$''{'pgac_cv_var_int_optreset'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 6849 "configure"
#include "confdefs.h"
#include <unistd.h>
int main() {
extern int optreset; optreset = 1;
; return 0; }
EOF
if { (eval echo configure:6856: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
pgac_cv_var_int_optreset=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
pgac_cv_var_int_optreset=no
fi
rm -f conftest*
fi
echo "$ac_t""$pgac_cv_var_int_optreset" 1>&6
if test x"$pgac_cv_var_int_optreset" = x"yes"; then
cat >> confdefs.h <<\EOF
#define HAVE_INT_OPTRESET 1
EOF
fi
echo $ac_n "checking whether long int is 64 bits""... $ac_c" 1>&6
echo "configure:6845: checking whether long int is 64 bits" >&5
echo "configure:6879: checking whether long int is 64 bits" >&5
if eval "test \"`echo '$''{'pgac_cv_type_long_int_64'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -6850,7 +6884,7 @@ else
echo "configure: warning: 64 bit arithmetic disabled when cross-compiling" 1>&2
else
cat > conftest.$ac_ext <<EOF
#line 6854 "configure"
#line 6888 "configure"
#include "confdefs.h"
typedef long int int64;
@ -6879,7 +6913,7 @@ main() {
exit(! does_int64_work());
}
EOF
if { (eval echo configure:6883: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:6917: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
pgac_cv_type_long_int_64=yes
else
@ -6906,7 +6940,7 @@ fi
if test x"$HAVE_LONG_INT_64" = x"no" ; then
echo $ac_n "checking whether long long int is 64 bits""... $ac_c" 1>&6
echo "configure:6910: checking whether long long int is 64 bits" >&5
echo "configure:6944: checking whether long long int is 64 bits" >&5
if eval "test \"`echo '$''{'pgac_cv_type_long_long_int_64'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -6915,7 +6949,7 @@ else
echo "configure: warning: 64 bit arithmetic disabled when cross-compiling" 1>&2
else
cat > conftest.$ac_ext <<EOF
#line 6919 "configure"
#line 6953 "configure"
#include "confdefs.h"
typedef long long int int64;
@ -6944,7 +6978,7 @@ main() {
exit(! does_int64_work());
}
EOF
if { (eval echo configure:6948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:6982: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
pgac_cv_type_long_long_int_64=yes
else
@ -6975,7 +7009,7 @@ fi
if [ x"$HAVE_LONG_LONG_INT_64" = xyes ] ; then
if [ x$SNPRINTF = x ] ; then
echo $ac_n "checking whether snprintf handles 'long long int' as %lld""... $ac_c" 1>&6
echo "configure:6979: checking whether snprintf handles 'long long int' as %lld" >&5
echo "configure:7013: checking whether snprintf handles 'long long int' as %lld" >&5
if test "$cross_compiling" = yes; then
echo "$ac_t""assuming not on target machine" 1>&6
# Force usage of our own snprintf, since we cannot test foreign snprintf
@ -6984,7 +7018,7 @@ echo "configure:6979: checking whether snprintf handles 'long long int' as %lld"
else
cat > conftest.$ac_ext <<EOF
#line 6988 "configure"
#line 7022 "configure"
#include "confdefs.h"
#include <stdio.h>
typedef long long int int64;
@ -7011,7 +7045,7 @@ main() {
exit(! does_int64_snprintf_work());
}
EOF
if { (eval echo configure:7015: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:7049: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
echo "$ac_t""yes" 1>&6
INT64_FORMAT='"%lld"'
@ -7022,7 +7056,7 @@ else
rm -fr conftest*
echo "$ac_t""no" 1>&6
echo $ac_n "checking whether snprintf handles 'long long int' as %qd""... $ac_c" 1>&6
echo "configure:7026: checking whether snprintf handles 'long long int' as %qd" >&5
echo "configure:7060: checking whether snprintf handles 'long long int' as %qd" >&5
if test "$cross_compiling" = yes; then
echo "$ac_t""assuming not on target machine" 1>&6
# Force usage of our own snprintf, since we cannot test foreign snprintf
@ -7031,7 +7065,7 @@ echo "configure:7026: checking whether snprintf handles 'long long int' as %qd"
else
cat > conftest.$ac_ext <<EOF
#line 7035 "configure"
#line 7069 "configure"
#include "confdefs.h"
#include <stdio.h>
typedef long long int int64;
@ -7058,7 +7092,7 @@ main() {
exit(! does_int64_snprintf_work());
}
EOF
if { (eval echo configure:7062: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:7096: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
echo "$ac_t""yes" 1>&6
INT64_FORMAT='"%qd"'
@ -7097,7 +7131,7 @@ EOF
echo $ac_n "checking alignment of short""... $ac_c" 1>&6
echo "configure:7101: checking alignment of short" >&5
echo "configure:7135: checking alignment of short" >&5
if eval "test \"`echo '$''{'pgac_cv_alignof_short'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -7105,7 +7139,7 @@ else
pgac_cv_alignof_short='sizeof(short)'
else
cat > conftest.$ac_ext <<EOF
#line 7109 "configure"
#line 7143 "configure"
#include "confdefs.h"
#include <stdio.h>
struct { char filler; short field; } mystruct;
@ -7117,7 +7151,7 @@ main()
exit(0);
}
EOF
if { (eval echo configure:7121: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:7155: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
pgac_cv_alignof_short=`cat conftestval`
else
@ -7137,7 +7171,7 @@ EOF
echo $ac_n "checking alignment of int""... $ac_c" 1>&6
echo "configure:7141: checking alignment of int" >&5
echo "configure:7175: checking alignment of int" >&5
if eval "test \"`echo '$''{'pgac_cv_alignof_int'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -7145,7 +7179,7 @@ else
pgac_cv_alignof_int='sizeof(int)'
else
cat > conftest.$ac_ext <<EOF
#line 7149 "configure"
#line 7183 "configure"
#include "confdefs.h"
#include <stdio.h>
struct { char filler; int field; } mystruct;
@ -7157,7 +7191,7 @@ main()
exit(0);
}
EOF
if { (eval echo configure:7161: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:7195: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
pgac_cv_alignof_int=`cat conftestval`
else
@ -7177,7 +7211,7 @@ EOF
echo $ac_n "checking alignment of long""... $ac_c" 1>&6
echo "configure:7181: checking alignment of long" >&5
echo "configure:7215: checking alignment of long" >&5
if eval "test \"`echo '$''{'pgac_cv_alignof_long'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -7185,7 +7219,7 @@ else
pgac_cv_alignof_long='sizeof(long)'
else
cat > conftest.$ac_ext <<EOF
#line 7189 "configure"
#line 7223 "configure"
#include "confdefs.h"
#include <stdio.h>
struct { char filler; long field; } mystruct;
@ -7197,7 +7231,7 @@ main()
exit(0);
}
EOF
if { (eval echo configure:7201: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:7235: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
pgac_cv_alignof_long=`cat conftestval`
else
@ -7218,7 +7252,7 @@ EOF
if [ x"$HAVE_LONG_LONG_INT_64" = xyes ] ; then
echo $ac_n "checking alignment of long long int""... $ac_c" 1>&6
echo "configure:7222: checking alignment of long long int" >&5
echo "configure:7256: checking alignment of long long int" >&5
if eval "test \"`echo '$''{'pgac_cv_alignof_long_long_int'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -7226,7 +7260,7 @@ else
pgac_cv_alignof_long_long_int='sizeof(long long int)'
else
cat > conftest.$ac_ext <<EOF
#line 7230 "configure"
#line 7264 "configure"
#include "confdefs.h"
#include <stdio.h>
struct { char filler; long long int field; } mystruct;
@ -7238,7 +7272,7 @@ main()
exit(0);
}
EOF
if { (eval echo configure:7242: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:7276: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
pgac_cv_alignof_long_long_int=`cat conftestval`
else
@ -7259,7 +7293,7 @@ EOF
fi
echo $ac_n "checking alignment of double""... $ac_c" 1>&6
echo "configure:7263: checking alignment of double" >&5
echo "configure:7297: checking alignment of double" >&5
if eval "test \"`echo '$''{'pgac_cv_alignof_double'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -7267,7 +7301,7 @@ else
pgac_cv_alignof_double='sizeof(double)'
else
cat > conftest.$ac_ext <<EOF
#line 7271 "configure"
#line 7305 "configure"
#include "confdefs.h"
#include <stdio.h>
struct { char filler; double field; } mystruct;
@ -7279,7 +7313,7 @@ main()
exit(0);
}
EOF
if { (eval echo configure:7283: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:7317: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
pgac_cv_alignof_double=`cat conftestval`
else
@ -7317,12 +7351,12 @@ EOF
echo $ac_n "checking for POSIX signal interface""... $ac_c" 1>&6
echo "configure:7321: checking for POSIX signal interface" >&5
echo "configure:7355: checking for POSIX signal interface" >&5
if eval "test \"`echo '$''{'pgac_cv_func_posix_signals'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 7326 "configure"
#line 7360 "configure"
#include "confdefs.h"
#include <signal.h>
@ -7333,7 +7367,7 @@ act.sa_flags = SA_RESTART;
sigaction(0, &act, &oact);
; return 0; }
EOF
if { (eval echo configure:7337: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:7371: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
pgac_cv_func_posix_signals=yes
else
@ -7363,7 +7397,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:7367: checking for $ac_word" >&5
echo "configure:7401: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_TCLSH'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -7399,7 +7433,7 @@ test -n "$TCLSH" && break
done
echo $ac_n "checking for tclConfig.sh""... $ac_c" 1>&6
echo "configure:7403: checking for tclConfig.sh" >&5
echo "configure:7437: checking for tclConfig.sh" >&5
# Let user override test
if test -z "$TCL_CONFIG_SH"; then
pgac_test_dirs="$with_tclconfig"
@ -7432,7 +7466,7 @@ fi
# Check for Tk configuration script tkConfig.sh
if test "$with_tk" = yes; then
echo $ac_n "checking for tkConfig.sh""... $ac_c" 1>&6
echo "configure:7436: checking for tkConfig.sh" >&5
echo "configure:7470: checking for tkConfig.sh" >&5
# Let user override test
if test -z "$TK_CONFIG_SH"; then
pgac_test_dirs="$with_tkconfig $with_tclconfig"
@ -7471,7 +7505,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:7475: checking for $ac_word" >&5
echo "configure:7509: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_NSGMLS'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -7507,7 +7541,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:7511: checking for $ac_word" >&5
echo "configure:7545: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_JADE'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -7538,7 +7572,7 @@ done
echo $ac_n "checking for DocBook V3.1""... $ac_c" 1>&6
echo "configure:7542: checking for DocBook V3.1" >&5
echo "configure:7576: checking for DocBook V3.1" >&5
if eval "test \"`echo '$''{'pgac_cv_check_docbook'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -7571,7 +7605,7 @@ have_docbook=$pgac_cv_check_docbook
echo $ac_n "checking for DocBook stylesheets""... $ac_c" 1>&6
echo "configure:7575: checking for DocBook stylesheets" >&5
echo "configure:7609: checking for DocBook stylesheets" >&5
if eval "test \"`echo '$''{'pgac_cv_path_stylesheets'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -7610,7 +7644,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:7614: checking for $ac_word" >&5
echo "configure:7648: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_SGMLSPL'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else

View File

@ -936,6 +936,16 @@ PGAC_ARG_BOOL(enable, syslog, no, [ --enable-syslog enable logging to s
[AC_MSG_ERROR([no syslog interface found])])])
AC_CACHE_CHECK([for optreset], pgac_cv_var_int_optreset,
[AC_TRY_LINK([#include <unistd.h>],
[extern int optreset; optreset = 1;],
[pgac_cv_var_int_optreset=yes],
[pgac_cv_var_int_optreset=no])])
if test x"$pgac_cv_var_int_optreset" = x"yes"; then
AC_DEFINE(HAVE_INT_OPTRESET, 1)
fi
dnl Check to see if we have a working 64-bit integer type.
dnl This breaks down into two steps:
dnl (1) figure out if the compiler has a 64-bit int type with working

View File

@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.178 2000/11/04 12:43:23 petere Exp $
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.179 2000/11/06 22:18:06 petere Exp $
*
* NOTES
*
@ -57,7 +57,7 @@
#endif
#ifdef HAVE_GETOPT_H
#include "getopt.h"
#include <getopt.h>
#endif
#include "catalog/pg_database.h"
@ -372,7 +372,7 @@ PostmasterMain(int argc, char *argv[])
* will occur.
*/
opterr = 1;
while ((opt = getopt(argc, argv, "A:a:B:b:D:d:Film:MN:no:p:Ss-:?")) != EOF)
while ((opt = getopt(argc, argv, "A:a:B:b:D:d:Film:MN:no:p:SsV-:?")) != EOF)
{
switch(opt)
{
@ -380,6 +380,10 @@ PostmasterMain(int argc, char *argv[])
potential_DataDir = optarg;
break;
case 'V':
puts("postmaster (PostgreSQL) " PG_VERSION);
exit(0);
case '-':
{
char *name, *value;
@ -421,7 +425,10 @@ PostmasterMain(int argc, char *argv[])
IgnoreSystemIndexes(false);
optind = 1; /* start over */
while ((opt = getopt(argc, argv, "A:a:B:b:D:d:Film:MN:no:p:Ss-:?")) != EOF)
#ifdef HAVE_INT_OPTRESET
optreset = 1;
#endif
while ((opt = getopt(argc, argv, "A:a:B:b:D:d:Film:MN:no:p:SsV-:?")) != EOF)
{
switch (opt)
{

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.185 2000/11/04 12:43:24 petere Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.186 2000/11/06 22:18:08 petere Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
@ -1112,7 +1112,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
optind = 1; /* reset after postmaster's usage */
while ((flag = getopt(argc, argv, "A:B:CD:d:Eef:FiLNOPo:p:S:st:v:W:x:-:?")) != EOF)
while ((flag = getopt(argc, argv, "A:B:CD:d:Eef:FiLNOPo:p:S:st:v:VW:x:-:?")) != EOF)
switch (flag)
{
case 'A':
@ -1338,6 +1338,10 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
FrontendProtocol = (ProtocolVersion) atoi(optarg);
break;
case 'V':
puts("postgres (PostgreSQL) " PG_VERSION);
exit(0);
case 'W':
/* ----------------
* wait N seconds to allow attach from a debugger
@ -1635,7 +1639,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
if (!IsUnderPostmaster)
{
puts("\nPOSTGRES backend interactive interface ");
puts("$Revision: 1.185 $ $Date: 2000/11/04 12:43:24 $\n");
puts("$Revision: 1.186 $ $Date: 2000/11/06 22:18:08 $\n");
}
/*

View File

@ -23,7 +23,7 @@
#
# Copyright (c) 1994, Regents of the University of California
#
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.110 2000/11/04 12:47:48 petere Exp $
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.111 2000/11/06 22:18:09 petere Exp $
#
#-------------------------------------------------------------------------
@ -109,11 +109,11 @@ fi
if [ x"$self_path" != x"" ] \
&& [ -x "$self_path/postgres" ] \
&& [ x"`$self_path/postgres --version 2>/dev/null`" = x"postgres (PostgreSQL) $VERSION" ]
&& [ x"`$self_path/postgres -V 2>/dev/null`" = x"postgres (PostgreSQL) $VERSION" ]
then
PGPATH=$self_path
elif [ -x "$bindir/postgres" ]; then
if [ x"`$bindir/postgres --version 2>/dev/null`" = x"postgres (PostgreSQL) $VERSION" ]
if [ x"`$bindir/postgres -V 2>/dev/null`" = x"postgres (PostgreSQL) $VERSION" ]
then
PGPATH=$bindir
else
@ -186,7 +186,7 @@ do
usage=t
break
;;
--version)
--version|-V)
echo "initdb (PostgreSQL) $VERSION"
exit 0
;;

View File

@ -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.146 2000/11/03 18:43:52 petere Exp $
* $Id: config.h.in,v 1.147 2000/11/06 22:18:10 petere Exp $
*/
#ifndef CONFIG_H
@ -604,6 +604,8 @@ extern void srandom(unsigned int seed);
/* Define if a system lib (-ldl) has dlopen() (needed for AIX) */
#undef HAVE_DLOPEN
/* Define if you have the optreset variable */
#undef HAVE_INT_OPTRESET
/*
*------------------------------------------------------------------------