Annotation of pgsql/configure.in, revision 1.75

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

PostgreSQL CVSweb <[email protected]>