Annotation of pgsql/configure.in, revision 1.65

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

PostgreSQL CVSweb <[email protected]>