Annotation of pgsql/configure.in, revision 1.111

1.1       petere      1: dnl Process this file with autoconf to produce a configure script.
1.28      petere      2: 
                      3: dnl Developers, please strive to achieve this order:
                      4: dnl
                      5: dnl 0. Initialization and options processing
                      6: dnl 1. Programs
                      7: dnl 2. Libraries
                      8: dnl 3. Header files
                      9: dnl 4. Types
                     10: dnl 5. Structures
                     11: dnl 6. Compiler characteristics
                     12: dnl 7. Functions, global variables
                     13: dnl 8. System services
                     14: dnl
                     15: dnl Read the Autoconf manual for details.
                     16: 
1.32      petere     17: dnl The GNU folks apparently haven't heard that some people don't use
                     18: dnl Texinfo. Use this sorcery to use "docdir" instead of "infodir".
                     19: define([info], [doc])
                     20: define([infodir], [docdir])
1.1       petere     21: AC_INIT(src/backend/access/common/heaptuple.c)
1.32      petere     22: undefine([infodir])
                     23: undefine([info])
                     24: 
1.1       petere     25: AC_PREFIX_DEFAULT(/usr/local/pgsql)
                     26: AC_CONFIG_HEADER(src/include/config.h)
                     27: 
                     28: AC_PREREQ(2.13)
1.28      petere     29: AC_CONFIG_AUX_DIR(config)
1.5       petere     30: 
1.111   ! scrappy    31: VERSION='7.1RC1'
1.24      petere     32: AC_SUBST(VERSION)
                     33: AC_DEFINE_UNQUOTED(PG_VERSION, "$VERSION")
                     34: 
1.80      petere     35: unset CDPATH
1.61      petere     36: 
1.1       petere     37: AC_CANONICAL_HOST
1.45      petere     38: AC_SUBST(host)
                     39: AC_SUBST(host_cpu)
                     40: AC_SUBST(host_os)
1.1       petere     41: 
1.30      petere     42: template=
                     43: AC_MSG_CHECKING([which template to use])
                     44: 
1.42      petere     45: PGAC_ARG_REQ(with, template, [],
                     46: [
                     47:   case $withval in
1.30      petere     48:     list)   echo; ls "$srcdir/src/template"; exit;;
                     49:     *)      if test -f "$srcdir/src/template/$with_template" ; then
1.42      petere     50:               template=$withval
1.30      petere     51:             else
1.80      petere     52:               AC_MSG_ERROR(['$withval' is not a valid template name. Use 'list' for a list.])
1.30      petere     53:             fi;;
                     54:   esac
1.42      petere     55: ],
                     56: [
                     57:   # --with-template not given
1.30      petere     58: 
                     59: case $host_os in
                     60:      aix*) template=aix ;;
1.54      momjian    61:     beos*) template=beos ;;
1.30      petere     62:     bsdi*) template=bsdi ;;
                     63:   cygwin*) template=win ;;
1.72      petere     64:   darwin*) template=darwin ;;
1.30      petere     65:     dgux*) template=dgux ;;
                     66:  freebsd*) template=freebsd ;;
                     67:     hpux*) template=hpux ;;
                     68:     irix*) template=irix5 ;;
                     69:    linux*) template=linux ;;
                     70:   netbsd*) template=netbsd ;;
                     71: nextstep*) template=nextstep ;;
                     72:  openbsd*) template=openbsd ;;
                     73:      osf*) template=osf ;;
                     74:      qnx*) template=qnx4 ;;
                     75:      sco*) template=sco ;;
1.58      petere     76:  solaris*) template=solaris ;;
1.30      petere     77:    sunos*) template=sunos4 ;;
1.1       petere     78:  sysv4.2*)
1.30      petere     79:         case $host_vendor in
                     80:           univel) template=univel ;;
                     81:         esac ;;
                     82:    sysv4*) template=svr4 ;;
                     83:  sysv5uw*) template=unixware ;;
                     84:   ultrix*) template=ultrix4 ;;
1.1       petere     85: esac
                     86: 
1.30      petere     87:   if test x"$template" = x"" ; then
1.80      petere     88:     AC_MSG_ERROR([[
1.30      petere     89: *******************************************************************
                     90: PostgreSQL has apparently not been ported to your platform yet.
1.32      petere     91: To try a manual configuration, look into the src/template directory
1.80      petere     92: for a similar platform and use the '--with-template=' option.
1.30      petere     93: 
                     94: Please also contact <[email protected]> to see about
1.80      petere     95: rectifying this.  Include the above 'checking host system type...'
1.30      petere     96: line.
                     97: *******************************************************************
1.80      petere     98: ]])
1.30      petere     99:   fi
                    100: 
1.42      petere    101: ])
1.1       petere    102: 
1.30      petere    103: AC_MSG_RESULT([$template])
1.1       petere    104: 
1.30      petere    105: PORTNAME=$template
                    106: AC_SUBST(PORTNAME)
1.1       petere    107: 
1.30      petere    108: AC_LINK_FILES([src/backend/port/dynloader/${template}.c], [src/backend/port/dynloader.c])
                    109: AC_LINK_FILES([src/backend/port/dynloader/${template}.h], [src/include/dynloader.h])
                    110: AC_LINK_FILES([src/include/port/${template}.h], [src/include/os.h])
                    111: AC_LINK_FILES([src/makefiles/Makefile.${template}], [src/Makefile.port])
                    112: 
1.58      petere    113: # Pick right test-and-set (TAS) code.  Most platforms have inline
                    114: # assembler code in src/include/storage/s_lock.h, so we just use
                    115: # a dummy file here.
                    116: case $host in
                    117:   *-*-hpux*)        need_tas=yes; tas_file=hpux.s ;;
                    118:   sparc-*-solaris*) need_tas=yes; tas_file=solaris_sparc.s ;;
                    119:   i?86-*-solaris)   need_tas=yes; tas_file=solaris_i386.s ;;
1.63      petere    120:   *)                need_tas=no;  tas_file=dummy.s ;;
1.30      petere    121: esac
1.63      petere    122: AC_LINK_FILES([src/backend/port/tas/${tas_file}], [src/backend/port/tas.s])
1.1       petere    123: 
1.30      petere    124: if test "$need_tas" = yes ; then
                    125:   TAS=tas.o
1.1       petere    126: fi
1.30      petere    127: AC_SUBST(TAS)
1.1       petere    128: 
                    129: 
                    130: 
1.30      petere    131: ##
                    132: ## Command line options
                    133: ##
1.13      petere    134: 
1.1       petere    135: 
1.30      petere    136: #
                    137: # Add non-standard directories to the include path
                    138: #
1.42      petere    139: PGAC_ARG_REQ(with, includes, [  --with-includes=DIRS    look for additional header files in DIRS])
1.1       petere    140: 
                    141: 
1.30      petere    142: #
                    143: # Add non-standard directories to the library search path
                    144: #
1.42      petere    145: PGAC_ARG_REQ(with, libraries, [  --with-libraries=DIRS   look for additional libraries in DIRS],
                    146:              [LIBRARY_DIRS=$withval])
1.1       petere    147: 
1.42      petere    148: PGAC_ARG_REQ(with, libs,      [  --with-libs=DIRS        alternative spelling of --with-libraries],
                    149:              [LIBRARY_DIRS=$withval])
1.29      petere    150: 
                    151: 
                    152: #
                    153: # Locale (--enable-locale)
                    154: #
                    155: AC_MSG_CHECKING([whether to build with locale support])
1.42      petere    156: PGAC_ARG_BOOL(enable, locale, no, [  --enable-locale         enable locale support],
                    157:               [AC_DEFINE([USE_LOCALE], 1,
                    158:                          [Set to 1 if you want LOCALE support (--enable-locale)])])
1.29      petere    159: AC_MSG_RESULT([$enable_locale])
1.2       petere    160: 
1.1       petere    161: 
1.29      petere    162: #
1.42      petere    163: # Character set recode (--enable-recode)
1.29      petere    164: #
1.42      petere    165: AC_MSG_CHECKING([whether to build with recode support])
                    166: PGAC_ARG_BOOL(enable, recode, no, [  --enable-recode         enable character set recode support],
                    167:               [AC_DEFINE([CYR_RECODE], 1,
                    168:                          [Set to 1 if you want cyrillic recode support (--enable-recode)])])
1.29      petere    169: AC_MSG_RESULT([$enable_recode])
1.1       petere    170: 
                    171: 
1.29      petere    172: #
                    173: # Multibyte support
                    174: #
                    175: MULTIBYTE=
                    176: AC_MSG_CHECKING([whether to build with multibyte character support])
1.42      petere    177: 
                    178: PGAC_ARG_OPTARG(enable, multibyte, [  --enable-multibyte      enable multibyte character support],
                    179: [MULTIBYTE=SQL_ASCII],
1.29      petere    180: [
                    181:   case $enableval in
                    182:     SQL_ASCII|EUC_JP|EUC_CN|EUC_KR|EUC_TW|UNICODE|MULE_INTERNAL|LATIN1|LATIN2|LATIN3|LATIN4|LATIN5|KOI8|WIN|ALT)
1.42      petere    183:       MULTIBYTE=$enableval;;
                    184:     *)
                    185:       AC_MSG_ERROR(
1.29      petere    186: [argument to --enable-multibyte must be one of:
1.1       petere    187:   SQL_ASCII, EUC_JP, EUC_CN, EUC_KR, EUC_TW,
                    188:   UNICODE, MULE_INTERNAL,
                    189:   LATIN1, LATIN2, LATIN3, LATIN4, LATIN5,
                    190:   KOI8, WIN, ALT
1.42      petere    191: Or do not specify an argument to the option to use the default.]);;
1.29      petere    192:   esac
                    193: ],
1.42      petere    194: [
                    195:   AC_DEFINE(MULTIBYTE, 1, [Set to 1 if you want to use multibyte characters (--enable-multibyte)])
                    196:   AC_MSG_RESULT([yes, default $MULTIBYTE])
                    197: ],
                    198: [AC_MSG_RESULT(no)])
1.29      petere    199: 
                    200: AC_SUBST(MULTIBYTE)
1.1       petere    201: 
1.70      ishii     202: #
1.77      petere    203: # Unicode conversion (--enable-unicode-conversion)
1.70      ishii     204: #
                    205: AC_MSG_CHECKING([whether to build with Unicode conversion support])
1.77      petere    206: PGAC_ARG_BOOL(enable, unicode-conversion, no,
                    207:               [  --enable-unicode-conversion  enable unicode conversion support],
                    208: [if test -z "$MULTIBYTE"; then
                    209:   AC_MSG_ERROR([--enable-unicode-conversion only works with --enable-multibyte])
                    210: fi
                    211: AC_DEFINE([UNICODE_CONVERSION], 1,
                    212:           [Set to 1 if you want Unicode conversion support (--enable-unicode-conversion)])])
                    213: AC_MSG_RESULT([$enable_unicode_conversion])
1.1       petere    214: 
1.29      petere    215: #
                    216: # Default port number (--with-pgport), default 5432
                    217: #
                    218: AC_MSG_CHECKING([for default port number])
1.42      petere    219: PGAC_ARG_REQ(with, pgport, [  --with-pgport=PORTNUM   change default port number [5432]],
                    220:              [default_port=$withval],
                    221:              [default_port=5432])
1.97      tgl       222: AC_MSG_RESULT([$default_port])
                    223: # Need both of these because some places want an integer and some a string
1.1       petere    224: AC_DEFINE_UNQUOTED(DEF_PGPORT, ${default_port})
                    225: AC_DEFINE_UNQUOTED(DEF_PGPORT_STR, "${default_port}")
1.97      tgl       226: AC_SUBST(default_port)
1.1       petere    227: 
1.29      petere    228: #
                    229: # Maximum number of allowed connections (--with-maxbackends), default 32
                    230: #
                    231: AC_MSG_CHECKING([for default soft limit on number of connections])
1.42      petere    232: PGAC_ARG_REQ(with, maxbackends, [  --with-maxbackends=N    set default maximum number of connections [32]],
                    233:              [],
                    234:              [with_maxbackends=32])
1.29      petere    235: AC_MSG_RESULT([$with_maxbackends])
1.42      petere    236: AC_DEFINE_UNQUOTED([DEF_MAXBACKENDS], [$with_maxbackends],
                    237:                    [The default soft limit on the number of concurrent connections, i.e., the default for the postmaster -N switch (--with-maxbackends)])
1.29      petere    238: 
1.1       petere    239: 
1.29      petere    240: #
1.65      petere    241: # Option to disable shared libraries
                    242: #
                    243: PGAC_ARG_BOOL(enable, shared, yes,
1.68      petere    244:               [  --disable-shared        do not build shared libraries])
1.65      petere    245: AC_SUBST(enable_shared)
                    246: 
1.69      petere    247: #
                    248: # '-rpath'-like feature can be disabled
                    249: #
                    250: PGAC_ARG_BOOL(enable, rpath, yes,
                    251:               [  --disable-rpath         do not embed shared library search path in executables])
                    252: AC_SUBST(enable_rpath)
                    253: 
1.65      petere    254: 
                    255: #
1.74      petere    256: # --enable-debug adds -g to compiler flags
                    257: #
                    258: PGAC_ARG_BOOL(enable, debug, no,
                    259:               [  --enable-debug          build with debugging symbols (-g)])
                    260: 
                    261: 
                    262: #
1.30      petere    263: # C compiler
                    264: #
                    265: 
1.29      petere    266: # For historical reasons you can also use --with-CC to specify the C compiler
                    267: # to use, although the standard way to do this is to set the CC environment
                    268: # variable.
1.42      petere    269: PGAC_ARG_REQ(with, CC, [], [CC=$with_CC])
1.4       tgl       270: 
1.30      petere    271: # On AIX, default compiler to xlc.
                    272: if test "$template" = aix && test -z "$CC" ; then CC=xlc; fi
1.4       tgl       273: 
1.74      petere    274: # Save CFLAGS from the environment
                    275: has_environ_CFLAGS="${CFLAGS+yes}"
                    276: save_CFLAGS=$CFLAGS
                    277: 
1.4       tgl       278: AC_PROG_CC
1.30      petere    279: # Read the template
                    280: . "$srcdir/src/template/$template" || exit
1.74      petere    281: 
                    282: if test "$has_environ_CFLAGS" = yes; then
                    283:   CFLAGS=$save_CFLAGS
                    284: fi
                    285: if test "$enable_debug" = yes && test "$ac_cv_prog_cc_g" = yes; then
                    286:   CFLAGS="$CFLAGS -g"
                    287: fi
1.30      petere    288: echo "using CFLAGS=$CFLAGS"
                    289: # Check if the compiler still works with the template settings
                    290: AC_PROG_CC_WORKS
1.44      petere    291: AC_EXEEXT
1.4       tgl       292: AC_PROG_CPP
                    293: AC_PROG_GCC_TRADITIONAL
1.6       petere    294: AC_SUBST(GCC)
1.4       tgl       295: 
1.29      petere    296: # Create compiler version string
1.24      petere    297: if test x"$GCC" = x"yes" ; then
                    298:   cc_string="GCC `${CC} --version`"
1.4       tgl       299: else
1.24      petere    300:   cc_string=$CC
1.4       tgl       301: fi
1.24      petere    302: AC_DEFINE_UNQUOTED(PG_VERSION_STR, ["PostgreSQL $VERSION on $host, compiled by $cc_string"], [A canonical string containing the version number, platform, and C compiler])
                    303: 
1.4       tgl       304: 
1.31      petere    305: #
                    306: # Automatic dependency tracking
                    307: #
1.42      petere    308: PGAC_ARG_BOOL(enable, depend, no, [  --enable-depend         turn on automatic dependency tracking],
                    309:               [autodepend=yes])
1.31      petere    310: AC_SUBST(autodepend)
                    311: 
                    312: 
1.42      petere    313: #
                    314: # Enable assert checks
                    315: #
                    316: PGAC_ARG_BOOL(enable, cassert, no, [  --enable-cassert        enable assertion checks (for debugging)],
                    317:               [AC_DEFINE([USE_ASSERT_CHECKING], 1,
                    318:                          [Define to 1 to build with assertion checks])])
1.30      petere    319: 
                    320: 
                    321: #
                    322: # Include directories
                    323: #
                    324: ac_save_IFS=$IFS
1.80      petere    325: IFS="${IFS}:"
1.30      petere    326: # SRCH_INC comes from the template file
                    327: for dir in $with_includes $SRCH_INC; do
                    328:   if test -d "$dir"; then
                    329:     INCLUDES="$INCLUDES -I$dir"
                    330:   else
                    331:     AC_MSG_WARN([*** Include directory $dir does not exist.])
                    332:   fi
                    333: done
                    334: IFS=$ac_save_IFS
                    335: AC_SUBST(INCLUDES)
                    336: 
                    337: 
                    338: #
                    339: # Library directories
                    340: #
                    341: ac_save_IFS=$IFS
1.80      petere    342: IFS="${IFS}:"
1.30      petere    343: # LIBRARY_DIRS comes from command line, SRCH_LIB from template file.
                    344: for dir in $LIBRARY_DIRS $SRCH_LIB; do
                    345:   if test -d "$dir"; then
1.68      petere    346:     LIBDIRS="$LIBDIRS -L$dir"
1.30      petere    347:   else
                    348:     AC_MSG_WARN([*** Library directory $dir does not exist.])
                    349:   fi
                    350: done
                    351: IFS=$ac_save_IFS
                    352: 
                    353: 
1.43      petere    354: #
                    355: # Tcl/Tk
                    356: #
                    357: AC_MSG_CHECKING([whether to build with Tcl])
                    358: PGAC_ARG_BOOL(with, tcl, no, [  --with-tcl              build Tcl and Tk interfaces])
                    359: AC_MSG_RESULT([$with_tcl])
                    360: AC_SUBST([with_tcl])
                    361: 
                    362: # If Tcl is enabled (above) then Tk is also, unless the user disables it using --without-tk
                    363: AC_MSG_CHECKING([whether to build with Tk])
                    364: if test "$with_tcl" = yes; then
                    365:   PGAC_ARG_BOOL(with, tk, yes, [  --without-tk            do not build Tk interfaces if Tcl is enabled])
                    366: else
                    367:   with_tk=no
                    368: fi
                    369: AC_MSG_RESULT([$with_tk])
                    370: AC_SUBST([with_tk])
1.1       petere    371: 
                    372: 
1.42      petere    373: # We see if the path to the TCL/TK configuration scripts is specified.
                    374: # This will override the use of tclsh to find the paths to search.
                    375: 
1.43      petere    376: PGAC_ARG_REQ(with, tclconfig, [  --with-tclconfig=DIR    tclConfig.sh and tkConfig.sh are in DIR])
1.1       petere    377: 
1.42      petere    378: # We see if the path to the TK configuration scripts is specified.
                    379: # This will override the use of tclsh to find the paths to search.
1.1       petere    380: 
1.43      petere    381: PGAC_ARG_REQ(with, tkconfig,  [  --with-tkconfig=DIR     tkConfig.sh is in DIR])
1.1       petere    382: 
1.5       petere    383: 
1.42      petere    384: #
                    385: # Optionally build Perl modules (Pg.pm and PL/Perl)
                    386: #
                    387: AC_MSG_CHECKING([whether to build Perl modules])
                    388: PGAC_ARG_BOOL(with, perl, no, [  --with-perl             build Perl interface and PL/Perl])
                    389: AC_MSG_RESULT([$with_perl])
1.5       petere    390: AC_SUBST(with_perl)
                    391: 
                    392: 
1.42      petere    393: #
                    394: # Optionally build Python interface module
                    395: #
                    396: AC_MSG_CHECKING([whether to build Python modules])
                    397: PGAC_ARG_BOOL(with, python, no, [  --with-python           build Python interface module],
                    398: [AC_MSG_RESULT(yes)
                    399: PGAC_PROG_PYTHON
                    400: PGAC_PATH_PYTHONDIR],
1.5       petere    401: [AC_MSG_RESULT(no)])
                    402: AC_SUBST(with_python)
1.1       petere    403: 
1.105     peter     404: #
                    405: # Optionally build the Java/JDBC tools
                    406: #
                    407: AC_MSG_CHECKING([whether to build Java/JDBC tools])
1.108     petere    408: PGAC_ARG_BOOL(with, java, no, [  --with-java             build JDBC interface and Java tools],
1.105     peter     409: [AC_MSG_RESULT(yes)
1.108     petere    410: PGAC_PATH_ANT
                    411: if test -z "$ANT"; then
                    412:   AC_MSG_ERROR([Ant is required to build Java components])
                    413: fi],
1.105     peter     414: [AC_MSG_RESULT(no)])
                    415: AC_SUBST(with_java)
1.13      petere    416: 
1.28      petere    417: dnl A note on the Kerberos and OpenSSL options:
1.13      petere    418: dnl
1.28      petere    419: dnl The user can give an argument to the option in order the specify
                    420: dnl the base path of the respective installation (what he specified
                    421: dnl perhaps as --prefix). If no argument is given ($withval is "yes")
                    422: dnl then we take the path where the package installs by default. This
                    423: dnl way the user doesn't have to use redundant --with-includes and
                    424: dnl --with-libraries options, but he can still use them if the layout
                    425: dnl is non-standard.
                    426: 
                    427: #
                    428: # Kerberos 4
                    429: #
1.42      petere    430: PGAC_ARG_OPTARG(with, krb4, [  --with-krb4[=DIR]       build with Kerberos 4 support [/usr/athena]],
                    431:                 [krb4_prefix=/usr/athena],
                    432:                 [krb4_prefix=$withval],
                    433: [
1.28      petere    434:   AC_MSG_RESULT([building with Kerberos 4 support])
1.42      petere    435:   AC_DEFINE(KRB4, 1, [Define if you are building with Kerberos 4 support.])
1.28      petere    436: 
1.68      petere    437:   if test -d "$krb4_prefix/include"; then
                    438:     INCLUDES="$INCLUDES -I$krb4_prefix/include"
                    439:   fi
                    440:   if test -d "$krb4_prefix/lib"; then
                    441:     LIBDIRS="$LIBDIRS -L$krb4_prefix/lib"
1.13      petere    442:   fi
1.37      petere    443: 
1.42      petere    444:   krb_srvtab="/etc/srvtab"
                    445: ])
                    446: 
                    447: AC_SUBST(with_krb4)
1.13      petere    448: 
                    449: 
1.28      petere    450: #
                    451: # Kerberos 5
                    452: #
1.42      petere    453: PGAC_ARG_OPTARG(with, krb5, [  --with-krb5[=DIR]       build with Kerberos 5 support [/usr/athena]],
                    454:               [krb5_prefix=/usr/athena],
                    455:               [krb5_prefix=$withval],
                    456: [
1.28      petere    457:   AC_MSG_RESULT([building with Kerberos 5 support])
1.42      petere    458:   AC_DEFINE(KRB5, 1, [Define if you are building with Kerberos 5 support.])
1.28      petere    459: 
1.68      petere    460:   if test -d "$krb5_prefix/include"; then
                    461:     INCLUDES="$INCLUDES -I$krb5_prefix/include"
                    462:   fi
                    463:   if test -d "$krb5_prefix/lib"; then
                    464:     LIBDIRS="$LIBDIRS -L$krb5_prefix/lib"
1.13      petere    465:   fi
1.28      petere    466: 
1.42      petere    467:   krb_srvtab="FILE:\$(sysconfdir)/krb5.keytab"
                    468: ])
                    469: 
                    470: AC_SUBST(with_krb5)
1.28      petere    471: 
                    472: 
                    473: # Using both Kerberos 4 and Kerberos 5 at the same time isn't going to work.
                    474: if test "$with_krb4" = yes && test "$with_krb5" = yes ; then
                    475:   AC_MSG_ERROR([Kerberos 4 and Kerberos 5 support cannot be combined])
                    476: fi
1.13      petere    477: 
1.37      petere    478: AC_SUBST(krb_srvtab)
1.13      petere    479: 
                    480: 
1.28      petere    481: #
                    482: # Kerberos configuration parameters
                    483: #
1.42      petere    484: PGAC_ARG_REQ(with, krb-srvnam,
1.68      petere    485:              [  --with-krb-srvnam=NAME  name of the service principal in Kerberos [postgres]],
1.42      petere    486:              [],
                    487:              [with_krb_srvnam="postgres"])
                    488: AC_DEFINE_UNQUOTED([PG_KRB_SRVNAM], ["$with_krb_srvnam"],
                    489:                    [The name of the PostgreSQL service principal in Kerberos])
1.13      petere    490: 
1.28      petere    491: 
                    492: 
                    493: #
                    494: # OpenSSL
                    495: #
1.42      petere    496: PGAC_ARG_OPTARG(with, openssl,
                    497:                 [  --with-openssl[=DIR]    build with OpenSSL support [/usr/local/ssl]],
                    498:                 [openssl_prefix=/usr/local/ssl],
                    499:                 [openssl_prefix=$withval],
                    500: [
1.28      petere    501:   AC_MSG_RESULT([building with OpenSSL support])
1.42      petere    502:   AC_DEFINE([USE_SSL], 1, [Define to build with (Open)SSL support])
1.28      petere    503: 
                    504:   if test -d "${openssl_prefix}/include" ; then
                    505:     INCLUDES="$INCLUDES -I${openssl_prefix}/include"
                    506:   fi
                    507:   if test -d "${openssl_prefix}/lib" ; then
1.68      petere    508:     LIBDIRS="$LIBDIRS -L${openssl_prefix}/lib"
1.28      petere    509:   fi
1.42      petere    510: ])
                    511: 
                    512: AC_SUBST(with_openssl)
1.28      petere    513: 
1.13      petere    514: 
                    515: 
1.42      petere    516: #
                    517: # Optionally enable the building of the ODBC driver
                    518: #
1.15      petere    519:  
1.42      petere    520: # Old option name
                    521: if test "${with_odbc+set}" = set && test "${enable_odbc+set}" != set; then
1.15      petere    522:   enable_odbc=$with_odbc
                    523: fi
                    524:  
1.42      petere    525: AC_MSG_CHECKING([whether to build the ODBC driver])
                    526: PGAC_ARG_BOOL(enable, odbc, no, [  --enable-odbc           build the ODBC driver package])
                    527: AC_MSG_RESULT([$enable_odbc])
                    528: AC_SUBST([enable_odbc])
1.8       momjian   529: 
1.1       petere    530: 
1.42      petere    531: # Allow for overriding the default location of the odbcinst.ini
                    532: # file which is normally ${sysconfdir} (i.e., ${prefix}/etc).
                    533: PGAC_ARG_REQ(with, odbcinst,
                    534:              [  --with-odbcinst=DIR     default directory for odbcinst.ini [sysconfdir]],
                    535:              [odbcinst_ini_dir=$withval],
                    536:              [odbcinst_ini_dir="\${sysconfdir}"])
                    537: AC_SUBST([odbcinst_ini_dir])
1.3       momjian   538: 
                    539: 
                    540: 
1.30      petere    541: # Assume system is ELF if it predefines __ELF__ as 1,
                    542: # otherwise believe host_os based default.
                    543: case $host_os in
                    544:   freebsd1*|freebsd2*) elf=yes;;
                    545: esac
1.1       petere    546: 
                    547: AC_EGREP_CPP(yes,
                    548: [#if __ELF__
                    549:   yes
                    550: #endif
                    551: ],
1.30      petere    552: [ELF_SYS=true],
                    553: [if test "X$elf" = "Xyes" ; then
                    554:   ELF_SYS=true
1.1       petere    555: else
1.30      petere    556:   ELF_SYS=
                    557: fi])
                    558: AC_SUBST(ELF_SYS)
1.1       petere    559: 
                    560: 
                    561: 
1.42      petere    562: #
                    563: # Optionally build C++ code (i.e., libpq++)
                    564: #
1.36      petere    565: AC_MSG_CHECKING([whether to build C++ modules])
1.42      petere    566: PGAC_ARG_OPTARG(with, CXX, [  --with-CXX              build C++ modules (libpq++)],
                    567:                 [],
                    568:                 [CXX=$withval],
                    569: [
                    570:   AC_MSG_RESULT(yes)
1.71      petere    571: 
                    572:   # If the user has specified CXXFLAGS in the environment, leave it
                    573:   # alone, else use a default.
                    574: 
1.74      petere    575:   has_environ_CXXFLAGS="${CXXFLAGS+yes}"
1.6       petere    576:   AC_PROG_CXX
1.74      petere    577:   if test "$has_environ_CXXFLAGS" != yes; then
1.71      petere    578:     if test "$GXX" = yes; then
                    579:       CXXFLAGS=-O2
                    580:     else
                    581:       case $template in
                    582:        osf)            CXXFLAGS='-O4 -Olimit 2000' ;;
                    583:         unixware)      CXXFLAGS='-O' ;;
                    584:        *)              CXXFLAGS= ;;
                    585:       esac
                    586:     fi
                    587:   fi
                    588:   if test "$enable_debug" = yes && test "$ac_cv_prog_cxx_g" = yes; then
                    589:     CXXFLAGS="$CXXFLAGS -g"
                    590:   fi
                    591:   echo "using CXXFLAGS=$CXXFLAGS"
                    592: 
1.6       petere    593:   AC_PROG_CXXCPP
1.61      petere    594:   AC_SUBST(GXX)
1.6       petere    595:   PGAC_CLASS_STRING
                    596:   PGAC_CXX_NAMESPACE_STD
1.42      petere    597: ],
                    598: [AC_MSG_RESULT(no)])
                    599: AC_SUBST(with_CXX)
1.1       petere    600: 
1.30      petere    601: CPPFLAGS="$CPPFLAGS $INCLUDES"
1.68      petere    602: LDFLAGS="$LDFLAGS $LIBDIRS"
1.30      petere    603: 
                    604: echo "using CPPFLAGS=$CPPFLAGS"
                    605: echo "using LDFLAGS=$LDFLAGS"
                    606: 
                    607: 
1.2       petere    608: AC_PROG_AWK
1.39      petere    609: PGAC_PATH_FLEX
1.1       petere    610: AC_PROG_LN_S
1.62      petere    611: AC_PROG_LD
1.67      petere    612: AC_SUBST(LD)
                    613: AC_SUBST(with_gnu_ld)
1.77      petere    614: case $host_os in sysv5uw*)
                    615:   AC_CACHE_CHECK([whether ld -R works], [pgac_cv_prog_ld_R],
                    616:   [
                    617:     pgac_save_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS -Wl,-R/usr/lib"
                    618:     AC_TRY_LINK([], [], [pgac_cv_prog_ld_R=yes], [pgac_cv_prog_ld_R=no])
                    619:     LDFLAGS=$pgac_save_LDFLAGS
                    620:   ])
                    621:   ld_R_works=$pgac_cv_prog_ld_R
                    622:   AC_SUBST(ld_R_works)
                    623: esac
1.1       petere    624: AC_PROG_RANLIB
1.58      petere    625: AC_CHECK_PROGS(LORDER, lorder)
1.56      petere    626: AC_PATH_PROG(TAR, tar)
1.58      petere    627: AC_CHECK_PROGS(PERL, perl)
1.98      petere    628: 
                    629: AC_CHECK_PROGS(YACC, ['bison -y'])
                    630: if test -z "$YACC"; then
                    631:   AC_MSG_WARN([
                    632: *** Without Bison you will not be able to build PostgreSQL from CVS or
                    633: *** change any of the parser definition files.  You can obtain Bison from
                    634: *** a GNU mirror site.  (If you are using the official distribution of
                    635: *** PostgreSQL then you do not need to worry about this because the Bison
                    636: *** output is pre-generated.)  To use a different yacc program (possible,
                    637: *** but not recommended), set the environment variable YACC before running
                    638: *** 'configure'.])
                    639: fi
1.6       petere    640: AC_SUBST(YFLAGS)
1.98      petere    641: 
1.43      petere    642: if test "$with_tk" = yes; then
                    643:     AC_PATH_PROG(WISH, wish)
1.80      petere    644:     test -z "$WISH" && AC_MSG_ERROR(['wish' is required for Tk support])
1.43      petere    645: fi
1.1       petere    646: 
                    647: 
1.29      petere    648: ##
                    649: ## Libraries
                    650: ##
                    651: 
1.1       petere    652: AC_CHECK_LIB(sfio,     main)
1.96      petere    653: PGAC_CHECK_READLINE
1.52      petere    654: AC_SEARCH_LIBS(using_history, history, [AC_DEFINE(HAVE_HISTORY_FUNCTIONS)])
1.1       petere    655: 
                    656: if test "$PORTNAME" != "aix" -a "$PORTNAME" != "alpha"
                    657: then
                    658:        AC_CHECK_LIB(bsd,      main)
                    659: fi
1.21      petere    660: AC_CHECK_LIB(util,     setproctitle)
1.1       petere    661: AC_CHECK_LIB(m,        main)
                    662: AC_CHECK_LIB(dl,       main)
                    663: AC_CHECK_LIB(socket,   main)
                    664: AC_CHECK_LIB(nsl,      main)
                    665: AC_CHECK_LIB(ipc,      main)
                    666: AC_CHECK_LIB(IPC,      main)
                    667: AC_CHECK_LIB(lc,       main)
                    668: AC_CHECK_LIB(dld,      main)
                    669: AC_CHECK_LIB(ld,       main)
                    670: AC_CHECK_LIB(compat,   main)
                    671: AC_CHECK_LIB(BSD,      main)
                    672: AC_CHECK_LIB(gen,      main)
                    673: AC_CHECK_LIB(PW,       main)
1.95      petere    674: AC_CHECK_LIB(resolv,   main)
1.104     petere    675: AC_CHECK_LIB([[unix]], main)
1.21      petere    676: AC_SEARCH_LIBS(crypt,  crypt)
1.86      tgl       677: AC_CHECK_LIB(bind,     __inet_ntoa)
                    678: dnl only consider libz to be present if we find <zlib.h> as well
                    679: AC_CHECK_HEADER(zlib.h, [
1.28      petere    680: AC_CHECK_LIB(z,        inflate)
1.86      tgl       681: ])
1.60      momjian   682: 
1.28      petere    683: 
                    684: if test "$with_krb4" = yes ; then
1.80      petere    685:   AC_CHECK_LIB(des, [des_encrypt], [], [AC_MSG_ERROR([library 'des' is required for Kerberos 4])])
                    686:   AC_CHECK_LIB(krb, [krb_sendauth], [], [AC_MSG_ERROR([library 'krb' is required for Kerberos 4])])
1.28      petere    687: fi
                    688: 
                    689: if test "$with_krb5" = yes ; then
1.80      petere    690:   AC_CHECK_LIB(com_err, [com_err], [], [AC_MSG_ERROR([library 'com_err' is required for Kerberos 5])])
1.68      petere    691:   AC_CHECK_LIB(crypto,  [krb5_encrypt], [],
1.80      petere    692:     [AC_CHECK_LIB(k5crypto, [krb5_encrypt], [], [AC_MSG_ERROR([library 'crypto' or 'k5crypto' is required for Kerberos 5])])])
                    693:   AC_CHECK_LIB(krb5,    [krb5_sendauth], [], [AC_MSG_ERROR([library 'krb5' is required for Kerberos 5])])
1.28      petere    694: fi
                    695: 
                    696: if test "$with_openssl" = yes ; then
                    697:   dnl Order matters!
1.80      petere    698:   AC_CHECK_LIB(crypto, [CRYPTO_new_ex_data], [], [AC_MSG_ERROR([library 'crypto' is required for OpenSSL])])
                    699:   AC_CHECK_LIB(ssl,    [SSL_library_init], [], [AC_MSG_ERROR([library 'ssl' is required for OpenSSL])])
1.28      petere    700: fi
1.1       petere    701: 
1.28      petere    702: 
1.29      petere    703: ##
                    704: ## Header files
                    705: ##
                    706: dnl sys/socket.h and sys/types.h are required by AC_FUNC_ACCEPT_ARGTYPES
1.66      tgl       707: AC_CHECK_HEADERS([crypt.h dld.h endian.h fp_class.h getopt.h ieeefp.h pwd.h sys/ipc.h sys/pstat.h sys/select.h sys/sem.h sys/socket.h sys/shm.h sys/types.h sys/un.h termios.h kernel/OS.h kernel/image.h SupportDefs.h])
                    708: 
                    709: dnl At least on IRIX, cpp test for netinet/tcp.h will fail unless netinet/in.h
                    710: dnl is included first.  So can't just use AC_CHECK_HEADERS; do it this way:
                    711: AC_CHECK_HEADERS([netinet/in.h])
                    712: AC_MSG_CHECKING([for netinet/tcp.h])
                    713: AC_TRY_CPP([
                    714: #ifdef HAVE_NETINET_IN_H
                    715: #include <netinet/in.h>
                    716: #endif
                    717: #include <netinet/tcp.h>
                    718: ], [AC_DEFINE(HAVE_NETINET_TCP_H) AC_MSG_RESULT(yes)],
                    719: [AC_MSG_RESULT(no)])
1.29      petere    720: 
1.73      petere    721: PGAC_HEADER_STRING
                    722: 
1.28      petere    723: AC_CHECK_HEADERS([readline/readline.h readline.h], [break])
                    724: AC_CHECK_HEADERS([readline/history.h history.h], [break])
1.15      petere    725: 
1.28      petere    726: if test "$with_krb4" = yes ; then
                    727:   AC_CHECK_HEADER(krb.h, [], [AC_MSG_ERROR([header file <krb.h> is required for Kerberos 4])])
                    728: fi
                    729: 
                    730: if test "$with_krb5" = yes ; then
                    731:   AC_CHECK_HEADER(krb5.h, [], [AC_MSG_ERROR([header file <krb5.h> is required for Kerberos 5])])
                    732:   AC_CHECK_HEADER(com_err.h, [], [AC_MSG_ERROR([header file <com_err.h> is required for Kerberos 5])])
                    733: fi
                    734: 
                    735: if test "$with_openssl" = yes ; then
                    736:   AC_CHECK_HEADER([openssl/ssl.h], [], [AC_MSG_ERROR([header file <openssl/ssl.h> is required for OpenSSL])])
                    737:   AC_CHECK_HEADER([openssl/err.h], [], [AC_MSG_ERROR([header file <openssl/err.h> is required for OpenSSL])])
                    738: fi
                    739: 
1.1       petere    740: 
1.29      petere    741: ##
                    742: ## Types, structures, compiler characteristics
                    743: ##
1.1       petere    744: AC_C_CONST
                    745: AC_C_INLINE
                    746: AC_C_STRINGIZE
1.40      petere    747: PGAC_C_SIGNED
                    748: PGAC_C_VOLATILE
1.29      petere    749: AC_STRUCT_TIMEZONE
                    750: PGAC_UNION_SEMUN
1.44      petere    751: PGAC_STRUCT_SOCKADDR_UN
1.1       petere    752: 
1.29      petere    753: ##
                    754: ## Functions, global variables
                    755: ##
1.6       petere    756: PGAC_VAR_INT_TIMEZONE
1.29      petere    757: AC_FUNC_ACCEPT_ARGTYPES
1.6       petere    758: PGAC_FUNC_GETTIMEOFDAY_1ARG
1.1       petere    759: 
1.99      tgl       760: AC_CHECK_FUNCS([fcvt getopt_long memmove pstat setproctitle setsid sigprocmask sysconf waitpid dlopen fdatasync])
                    761: 
                    762: dnl Check whether <unistd.h> declares fdatasync().
                    763: AC_EGREP_HEADER(fdatasync, unistd.h, AC_DEFINE(HAVE_FDATASYNC_DECL))
1.1       petere    764: 
1.28      petere    765: AC_CACHE_CHECK([for PS_STRINGS], [pgac_cv_var_PS_STRINGS],
                    766: [AC_TRY_LINK(
                    767: [#include <machine/vmparam.h>
                    768: #include <sys/exec.h>
                    769: ],
1.1       petere    770: [PS_STRINGS->ps_nargvstr = 1;
                    771: PS_STRINGS->ps_argvstr = "foo";],
1.28      petere    772: [pgac_cv_var_PS_STRINGS=yes],
                    773: [pgac_cv_var_PS_STRINGS=no])])
                    774: if test "$pgac_cv_var_PS_STRINGS" = yes ; then
                    775:   AC_DEFINE([HAVE_PS_STRINGS], [], [Define if the PS_STRINGS thing exists.])
                    776: fi
1.1       petere    777: 
                    778: dnl We use our snprintf.c emulation if either snprintf() or vsnprintf()
                    779: dnl is missing.  Yes, there are machines that have only one.
                    780: dnl We may also decide to use snprintf.c if snprintf() is present but does
                    781: dnl not have working "long long int" support -- see below.
                    782: SNPRINTF=''
                    783: AC_CHECK_FUNC(snprintf,
                    784:              AC_DEFINE(HAVE_SNPRINTF),
                    785:              SNPRINTF='snprintf.o')
                    786: AC_CHECK_FUNC(vsnprintf,
                    787:              AC_DEFINE(HAVE_VSNPRINTF),
                    788:              SNPRINTF='snprintf.o')
                    789: AC_SUBST(SNPRINTF)
                    790: dnl Check whether <stdio.h> declares snprintf() and vsnprintf(); if not,
                    791: dnl include/c.h will provide declarations.  Note this is a separate test
                    792: dnl from whether the functions exist in the C library --- there are systems
                    793: dnl that have the functions but don't bother to declare them :-(
                    794: dnl Note: simple-minded pattern here will do wrong thing if stdio.h
                    795: dnl declares vsnprintf() but not snprintf().  Hopefully there are no
                    796: dnl systems that are *that* brain-damaged...
                    797: AC_EGREP_HEADER(snprintf, stdio.h, AC_DEFINE(HAVE_SNPRINTF_DECL))
                    798: AC_EGREP_HEADER(vsnprintf, stdio.h, AC_DEFINE(HAVE_VSNPRINTF_DECL))
1.29      petere    799: 
                    800: # do this one the hard way in case isinf() is a macro
                    801: AC_CACHE_CHECK([for isinf], ac_cv_func_isinf,
1.1       petere    802: [AC_TRY_LINK(
1.29      petere    803: [#include <math.h>
                    804: ],
1.1       petere    805: [double x = 0.0; int res = isinf(x);],
1.29      petere    806: [ac_cv_func_isinf=yes],
                    807: [ac_cv_func_isinf=no])])
                    808: 
                    809: if test $ac_cv_func_isinf = yes ; then
1.1       petere    810:   AC_DEFINE(HAVE_ISINF)
1.29      petere    811:   ISINF=
1.1       petere    812: else
                    813:   ISINF='isinf.o'
1.29      petere    814:   # Look for a way to implement a substitute for isinf()
                    815:   AC_CHECK_FUNCS([fpclass fp_class fp_class_d class], [break])
1.1       petere    816: fi
                    817: AC_SUBST(ISINF)
1.29      petere    818: 
1.1       petere    819: AC_CHECK_FUNC(getrusage,
                    820:              AC_DEFINE(HAVE_GETRUSAGE),
                    821:              GETRUSAGE='getrusage.o')
                    822: AC_SUBST(GETRUSAGE)
                    823: AC_CHECK_FUNC(srandom,
                    824:              AC_DEFINE(HAVE_SRANDOM),
                    825:              SRANDOM='srandom.o')
                    826: AC_SUBST(SRANDOM)
                    827: AC_CHECK_FUNC(gethostname,
                    828:              AC_DEFINE(HAVE_GETHOSTNAME),
                    829:              GETHOSTNAME='gethostname.o')
                    830: AC_SUBST(GETHOSTNAME)
                    831: AC_CHECK_FUNC(random,
                    832:              AC_DEFINE(HAVE_RANDOM),
                    833:              MISSING_RANDOM='random.o')
                    834: AC_SUBST(MISSING_RANDOM)
                    835: AC_CHECK_FUNC(inet_aton,
                    836:              AC_DEFINE(HAVE_INET_ATON),
                    837:              INET_ATON='inet_aton.o')
                    838: AC_SUBST(INET_ATON)
                    839: AC_CHECK_FUNC(strerror,
                    840:              AC_DEFINE(HAVE_STRERROR),
1.92      tgl       841:              STRERROR='strerror.o')
1.1       petere    842: AC_SUBST(STRERROR)
                    843: AC_CHECK_FUNC(strdup,
                    844:              AC_DEFINE(HAVE_STRDUP),
                    845:              STRDUP='../../utils/strdup.o')
                    846: AC_SUBST(STRDUP)
                    847: AC_CHECK_FUNC(strtol,
                    848:              AC_DEFINE(HAVE_STRTOL),
                    849:              STRTOL='strtol.o')
                    850: AC_SUBST(STRTOL)
                    851: AC_CHECK_FUNC(strtoul,
                    852:              AC_DEFINE(HAVE_STRTOUL),
1.100     ishii     853:              STRTOUL='strtoul.o')
1.1       petere    854: AC_SUBST(STRTOUL)
                    855: AC_CHECK_FUNC(strcasecmp,
                    856:              AC_DEFINE(HAVE_STRCASECMP),
                    857:              STRCASECMP='strcasecmp.o')
                    858: AC_SUBST(STRCASECMP)
                    859: AC_CHECK_FUNC(cbrt,
                    860:              AC_DEFINE(HAVE_CBRT),
                    861:              AC_CHECK_LIB(m, cbrt, AC_DEFINE(HAVE_CBRT)))
                    862: 
                    863: # On HPUX 9, rint() is not in regular libm.a but in /lib/pa1.1/libm.a;
                    864: # this hackery with HPUXMATHLIB allows us to cope.
                    865: HPUXMATHLIB=""
1.30      petere    866: case $host_cpu in
1.1       petere    867:   hppa1.1) 
                    868:        if [[ -r /lib/pa1.1/libm.a ]] ; then
                    869:            HPUXMATHLIB="-L /lib/pa1.1 -lm"
                    870:        fi ;;
                    871: esac
                    872: AC_SUBST(HPUXMATHLIB)
                    873: 
                    874: AC_CHECK_FUNC(rint,
                    875:              AC_DEFINE(HAVE_RINT),
                    876:              AC_CHECK_LIB(m, rint, AC_DEFINE(HAVE_RINT), , $HPUXMATHLIB))
                    877: 
1.52      petere    878: 
                    879: # Readline versions < 2.1 don't have rl_completion_append_character
                    880: AC_MSG_CHECKING([for rl_completion_append_character])
                    881: AC_TRY_LINK([#include <stdio.h>
                    882: #ifdef HAVE_READLINE_H
                    883: # include <readline.h>
                    884: #endif
                    885: #ifdef HAVE_READLINE_READLINE_H
                    886: # include <readline/readline.h>
                    887: #endif],
                    888: [rl_completion_append_character = 'x';],
                    889: [AC_MSG_RESULT(yes)
                    890: AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER)],
                    891: [AC_MSG_RESULT(no)])
                    892: 
                    893: 
                    894: # Check whether readline's filename_completion_function is declared.
                    895: # Some prehistoric versions of readline, in particular those shipped
                    896: # with earlier Cygwins don't have this declared, although it's in the
                    897: # library.
                    898: AC_MSG_CHECKING([whether filename_completion_function is declared])
                    899: if test "$ac_cv_header_readline_h" = yes; then
                    900:     _readline_header='readline.h'
                    901: elif test "$ac_cv_header_readline_readline_h" = yes; then
                    902:     _readline_header='readline/readline.h'
                    903: else
                    904:     _readline_header='xxx'
                    905: fi
                    906: AC_EGREP_HEADER([filename_completion_function], [$_readline_header],
                    907: [AC_DEFINE(HAVE_FILENAME_COMPLETION_FUNCTION_DECL)
                    908: AC_MSG_RESULT(yes)],
                    909: [AC_MSG_RESULT(no)])
                    910: 
1.1       petere    911: 
                    912: 
                    913: dnl Cannot use AC_CHECK_FUNC because finite may be a macro
                    914: AC_MSG_CHECKING(for finite)
                    915: AC_TRY_LINK([#include <math.h>],
                    916:        [int dummy=finite(1.0);],
                    917:        [AC_DEFINE(HAVE_FINITE) AC_MSG_RESULT(yes)],
                    918:        AC_MSG_RESULT(no))
                    919: 
                    920: dnl Cannot use AC_CHECK_FUNC because sigsetjmp may be a macro
                    921: dnl (especially on GNU libc)
                    922: dnl See also comments in config.h.
                    923: AC_MSG_CHECKING(for sigsetjmp)
                    924: AC_TRY_LINK([#include <setjmp.h>],
                    925:        [sigjmp_buf x; sigsetjmp(x, 1);],
                    926:        [AC_DEFINE(HAVE_SIGSETJMP) AC_MSG_RESULT(yes)],
                    927:        AC_MSG_RESULT(no))
                    928: 
1.42      petere    929: 
                    930: PGAC_ARG_BOOL(enable, syslog, no, [  --enable-syslog         enable logging to syslog],
                    931:               [AC_CHECK_FUNC(syslog,
                    932:                              [AC_DEFINE([ENABLE_SYSLOG], 1,
                    933:                                         [Define to 1 if to enable the syslogging code])],
                    934:                              [AC_MSG_ERROR([no syslog interface found])])])
                    935: 
1.1       petere    936: 
1.76      petere    937: AC_CACHE_CHECK([for optreset], pgac_cv_var_int_optreset,
                    938: [AC_TRY_LINK([#include <unistd.h>],
                    939:   [extern int optreset; optreset = 1;],
                    940:   [pgac_cv_var_int_optreset=yes],
                    941:   [pgac_cv_var_int_optreset=no])])
                    942: if test x"$pgac_cv_var_int_optreset" = x"yes"; then
                    943:   AC_DEFINE(HAVE_INT_OPTRESET, 1)
                    944: fi
                    945: 
1.109     petere    946: 
                    947: # This test makes sure that run tests work at all.  Sometimes a shared
                    948: # library is found by the linker, but the runtime linker can't find it.
                    949: # This check should come after all modifications of compiler or linker
                    950: # variables, and before any other run tests.
                    951: AC_MSG_CHECKING([test program])
                    952: AC_TRY_RUN([int main() { return 0; }],
                    953: [AC_MSG_RESULT(ok)],
                    954: [AC_MSG_RESULT(failed)
                    955: AC_MSG_ERROR([[
                    956: *** Could not execute a simple test program.  This may be a problem
                    957: *** related to locating shared libraries.  Check the file 'config.log'
                    958: *** for the exact reason.]])],
                    959: [AC_MSG_RESULT([cross-compiling])])
                    960: 
                    961: 
1.1       petere    962: dnl Check to see if we have a working 64-bit integer type.
                    963: dnl This breaks down into two steps:
                    964: dnl (1) figure out if the compiler has a 64-bit int type with working
                    965: dnl arithmetic, and if so
                    966: dnl (2) see whether snprintf() can format the type correctly.  (Currently,
                    967: dnl snprintf is the only library routine we really need for int8 support.)
                    968: dnl It's entirely possible to have a compiler that handles a 64-bit type
                    969: dnl when the C library doesn't; this is fairly likely when using gcc on
                    970: dnl an older platform, for example.
                    971: dnl If there is no native snprintf() or it does not handle the 64-bit type,
                    972: dnl we force our own version of snprintf() to be used instead.
                    973: dnl Note this test must be run after our initial check for snprintf/vsnprintf.
                    974: 
1.6       petere    975: PGAC_TYPE_64BIT_INT([long int])
1.1       petere    976: 
1.6       petere    977: if test x"$HAVE_LONG_INT_64" = x"no" ; then
                    978:   PGAC_TYPE_64BIT_INT([long long int])
                    979: fi
1.1       petere    980: 
                    981: 
                    982: dnl If we found "long int" is 64 bits, assume snprintf handles it.
                    983: dnl If we found we need to use "long long int", better check.
                    984: dnl We cope with snprintfs that use either %lld or %qd as the format.
                    985: dnl If neither works, fall back to our own snprintf emulation (which we
                    986: dnl know uses %lld).
                    987: 
1.7       petere    988: if [[ x"$HAVE_LONG_LONG_INT_64" = xyes ]] ; then
1.1       petere    989:   if [[ x$SNPRINTF = x ]] ; then
                    990:     AC_MSG_CHECKING(whether snprintf handles 'long long int' as %lld)
                    991:     AC_TRY_RUN([#include <stdio.h>
                    992: typedef long long int int64;
                    993: #define INT64_FORMAT "%lld"
                    994: 
                    995: int64 a = 20000001;
                    996: int64 b = 40000005;
                    997: 
                    998: int does_int64_snprintf_work()
                    999: {
                   1000:   int64 c;
                   1001:   char buf[100];
                   1002: 
                   1003:   if (sizeof(int64) != 8)
                   1004:     return 0;                  /* doesn't look like the right size */
                   1005: 
                   1006:   c = a * b;
                   1007:   snprintf(buf, 100, INT64_FORMAT, c);
                   1008:   if (strcmp(buf, "800000140000005") != 0)
                   1009:     return 0;                  /* either multiply or snprintf is busted */
                   1010:   return 1;
                   1011: }
                   1012: main() {
                   1013:   exit(! does_int64_snprintf_work());
                   1014: }],
                   1015:        [ AC_MSG_RESULT(yes)
                   1016:          INT64_FORMAT='"%lld"'
                   1017:        ],
                   1018:   [ AC_MSG_RESULT(no)
                   1019:     AC_MSG_CHECKING(whether snprintf handles 'long long int' as %qd) 
                   1020:     AC_TRY_RUN([#include <stdio.h>
                   1021: typedef long long int int64;
                   1022: #define INT64_FORMAT "%qd"
                   1023:    
                   1024: int64 a = 20000001;
                   1025: int64 b = 40000005;
                   1026:    
                   1027: int does_int64_snprintf_work()
                   1028: {  
                   1029:   int64 c;
                   1030:   char buf[100];
                   1031: 
                   1032:   if (sizeof(int64) != 8)
                   1033:     return 0;     /* doesn't look like the right size */
                   1034: 
                   1035:   c = a * b;
                   1036:   snprintf(buf, 100, INT64_FORMAT, c);
                   1037:   if (strcmp(buf, "800000140000005") != 0)
                   1038:     return 0;     /* either multiply or snprintf is busted */
                   1039:   return 1;
                   1040: }
                   1041: main() {
                   1042:   exit(! does_int64_snprintf_work());
                   1043: }],
                   1044:   [ AC_MSG_RESULT(yes)
                   1045:     INT64_FORMAT='"%qd"'
                   1046:   ],
                   1047:   [ AC_MSG_RESULT(no)
                   1048:        # Force usage of our own snprintf, since system snprintf is broken
                   1049:        SNPRINTF='snprintf.o'
                   1050:        INT64_FORMAT='"%lld"'
                   1051:   ],
                   1052:   [ AC_MSG_RESULT(assuming not on target machine)
                   1053:        # Force usage of our own snprintf, since we cannot test foreign snprintf
                   1054:        SNPRINTF='snprintf.o'
                   1055:        INT64_FORMAT='"%lld"'
                   1056:   ]) ],
                   1057:   [ AC_MSG_RESULT(assuming not on target machine)
                   1058:        # Force usage of our own snprintf, since we cannot test foreign snprintf
                   1059:        SNPRINTF='snprintf.o'
                   1060:        INT64_FORMAT='"%lld"'
                   1061:   ])
                   1062:   else
                   1063:     # here if we previously decided we needed to use our own snprintf
                   1064:     INT64_FORMAT='"%lld"'
                   1065:   fi
                   1066: else
                   1067:   # Here if we are not using 'long long int' at all
                   1068:   INT64_FORMAT='"%ld"'
                   1069: fi
                   1070: 
                   1071: AC_DEFINE_UNQUOTED(INT64_FORMAT, $INT64_FORMAT)
                   1072: 
                   1073: 
1.78      petere   1074: AC_CHECK_FUNCS([strtoll strtoq], [break])
                   1075: AC_CHECK_FUNCS([strtoull strtouq], [break])
                   1076: 
1.102     ishii    1077: dnl psql needs atexit() or on_exit()
                   1078: AC_CHECK_FUNC(atexit,
                   1079:        [AC_DEFINE(HAVE_ATEXIT)],
                   1080:        [AC_CHECK_FUNCS(on_exit,
                   1081:                [AC_DEFINE(HAVE_ON_EXIT)],
                   1082:                [AC_MSG_ERROR([atexi() nor on_exit() found])])])
1.78      petere   1083: 
1.84      tgl      1084: dnl Need a #define for the size of Datum (unsigned long)
                   1085: 
                   1086: AC_CHECK_SIZEOF(unsigned long, 4)
                   1087: AC_DEFINE_UNQUOTED(SIZEOF_DATUM, $ac_cv_sizeof_unsigned_long)
                   1088: 
1.1       petere   1089: dnl Determine memory alignment requirements for the basic C datatypes.
                   1090: 
1.6       petere   1091: PGAC_CHECK_ALIGNOF(short)
                   1092: PGAC_CHECK_ALIGNOF(int)
                   1093: PGAC_CHECK_ALIGNOF(long)
1.7       petere   1094: if [[ x"$HAVE_LONG_LONG_INT_64" = xyes ]] ; then
1.6       petere   1095:   PGAC_CHECK_ALIGNOF(long long int)
1.1       petere   1096: fi
1.6       petere   1097: PGAC_CHECK_ALIGNOF(double)
1.1       petere   1098: 
                   1099: dnl Compute maximum alignment of any basic type.
                   1100: dnl We assume long's alignment is at least as strong as char, short, or int;
                   1101: dnl but we must check long long (if it exists) and double.
                   1102: 
1.6       petere   1103: if test $pgac_cv_alignof_double != 'sizeof(double)' ; then
                   1104:   MAX_ALIGNOF=$pgac_cv_alignof_long
                   1105:   if test $MAX_ALIGNOF -lt $pgac_cv_alignof_double ; then
                   1106:     MAX_ALIGNOF=$pgac_cv_alignof_double
1.1       petere   1107:   fi
1.7       petere   1108:   if test x"$HAVE_LONG_LONG_INT_64" = xyes && test $MAX_ALIGNOF -lt $pgac_cv_alignof_long_long_int ; then
1.6       petere   1109:     MAX_ALIGNOF="$pgac_cv_alignof_long_long_int"
1.1       petere   1110:   fi
                   1111: else
                   1112:   dnl cross-compiling: assume that double's alignment is worst case
1.6       petere   1113:   MAX_ALIGNOF="$pgac_cv_alignof_double"
1.1       petere   1114: fi
1.6       petere   1115: AC_DEFINE_UNQUOTED(MAXIMUM_ALIGNOF, $MAX_ALIGNOF, [Define as the maximum alignment requirement of any type])
1.1       petere   1116: 
1.6       petere   1117: PGAC_FUNC_POSIX_SIGNALS
1.1       petere   1118: 
                   1119: 
1.43      petere   1120: # Check for Tcl configuration script tclConfig.sh
                   1121: if test "$with_tcl" = yes; then
                   1122:     PGAC_PATH_TCLCONFIGSH([$with_tclconfig])
                   1123: fi
1.1       petere   1124: 
1.43      petere   1125: # Check for Tk configuration script tkConfig.sh
                   1126: if test "$with_tk" = yes; then
                   1127:     PGAC_PATH_TKCONFIGSH([$with_tkconfig $with_tclconfig])
1.1       petere   1128: fi
                   1129: 
                   1130: 
1.75      petere   1131: #
                   1132: # Check for DocBook and tools
                   1133: #
                   1134: PGAC_PROG_NSGMLS
                   1135: # If you don't have nsgmls you won't get very far, so save the cycles.
                   1136: if test -n "$NSGMLS"; then
                   1137:   PGAC_PROG_JADE
                   1138:   PGAC_CHECK_DOCBOOK([3.1])
                   1139:   PGAC_PATH_DOCBOOK_STYLESHEETS
                   1140:   AC_CHECK_PROGS(SGMLSPL, sgmlspl)
                   1141: fi
                   1142: 
1.104     petere   1143: # check whether 'test -ef' works
                   1144: if (test "$srcdir" -ef "$srcdir") >/dev/null 2>&1 ; then
                   1145:   test_ef_works=yes
                   1146: else
                   1147:   test_ef_works=no
                   1148: fi
                   1149: 
                   1150: abs_top_srcdir=
                   1151: AC_SUBST(abs_top_srcdir)
1.61      petere   1152: 
1.104     petere   1153: if test "$test_ef_works" = yes ; then
                   1154: # prepare build tree if outside source tree
                   1155:   if test "$srcdir" -ef . ; then : ; else
                   1156:     abs_top_srcdir=`cd $srcdir && pwd`
                   1157:     echo $ac_n "preparing build tree... $ac_c" 1>&6
                   1158:     /bin/sh "$srcdir/config/prep_buildtree" "$abs_top_srcdir" "." \
                   1159:       || AC_MSG_ERROR(failed)
                   1160:     AC_MSG_RESULT(done)
                   1161:   fi
1.61      petere   1162: fi
1.1       petere   1163: 
                   1164: AC_OUTPUT(
1.33      petere   1165: [
                   1166:   GNUmakefile
                   1167:   src/GNUmakefile
                   1168:   src/Makefile.global
                   1169:   src/backend/port/Makefile
1.85      tgl      1170: ],
                   1171: [
                   1172: # Update timestamp for config.h (see Makefile.global)
1.87      petere   1173: test x"$CONFIG_HEADERS" != x"" && echo >src/include/stamp-h
1.83      petere   1174: ])

PostgreSQL CVSweb <[email protected]>