Annotation of pgsql/configure.in, revision 1.129

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

PostgreSQL CVSweb <[email protected]>