Annotation of pgsql/configure.in, revision 1.398.4.30

1.292     momjian     1: dnl Process this file with autoconf to produce a configure script.
1.398.4.30! tgl         2: dnl $PostgreSQL: pgsql/configure.in,v 1.398.4.29 2008/10/31 02:54:50 scrappy Exp $
1.185     petere      3: dnl
1.28      petere      4: dnl Developers, please strive to achieve this order:
                      5: dnl
                      6: dnl 0. Initialization and options processing
                      7: dnl 1. Programs
                      8: dnl 2. Libraries
1.356     tgl         9: dnl 3. Header files
1.28      petere     10: dnl 4. Types
                     11: dnl 5. Structures
                     12: dnl 6. Compiler characteristics
                     13: dnl 7. Functions, global variables
                     14: dnl 8. System services
                     15: dnl
                     16: dnl Read the Autoconf manual for details.
1.185     petere     17: dnl
                     18: m4_pattern_forbid(^PGAC_)dnl to catch undefined macros
1.304     petere     19: 
1.398.4.29  scrappy    20: AC_INIT([PostgreSQL], [8.0.19], [[email protected]])
1.171     petere     21: 
1.398.4.23  tgl        22: m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.53], [], [m4_fatal([Autoconf version 2.53 is required.
1.398.4.21  momjian    23: Untested combinations of 'autoconf' and PostgreSQL versions are not
                     24: recommended.  You can remove the check from 'configure.in' but it is then
                     25: your responsibility whether the result works or not.])])
1.395     tgl        26: AC_COPYRIGHT([Copyright (c) 1996-2005, PostgreSQL Global Development Group])
1.171     petere     27: AC_CONFIG_SRCDIR([src/backend/access/common/heaptuple.c])
                     28: AC_CONFIG_AUX_DIR(config)
1.1       petere     29: AC_PREFIX_DEFAULT(/usr/local/pgsql)
1.171     petere     30: AC_SUBST(configure_args, [$ac_configure_args])
1.5       petere     31: 
1.171     petere     32: AC_DEFINE_UNQUOTED(PG_VERSION, "$PACKAGE_VERSION", [PostgreSQL version])
1.61      petere     33: 
1.1       petere     34: AC_CANONICAL_HOST
                     35: 
1.30      petere     36: template=
                     37: AC_MSG_CHECKING([which template to use])
                     38: 
1.42      petere     39: PGAC_ARG_REQ(with, template, [],
                     40: [
                     41:   case $withval in
1.30      petere     42:     list)   echo; ls "$srcdir/src/template"; exit;;
                     43:     *)      if test -f "$srcdir/src/template/$with_template" ; then
1.42      petere     44:               template=$withval
1.30      petere     45:             else
1.80      petere     46:               AC_MSG_ERROR(['$withval' is not a valid template name. Use 'list' for a list.])
1.30      petere     47:             fi;;
                     48:   esac
1.42      petere     49: ],
                     50: [
1.280     tgl        51: # --with-template not given
1.30      petere     52: 
                     53: case $host_os in
                     54:      aix*) template=aix ;;
1.54      momjian    55:     beos*) template=beos ;;
1.30      petere     56:     bsdi*) template=bsdi ;;
1.239     petere     57:   cygwin*) template=cygwin ;;
1.72      petere     58:   darwin*) template=darwin ;;
1.30      petere     59:     dgux*) template=dgux ;;
                     60:  freebsd*) template=freebsd ;;
                     61:     hpux*) template=hpux ;;
1.352     momjian    62:     irix*) template=irix ;;
1.377     petere     63:  linux*|gnu*|k*bsd*-gnu)
                     64:            template=linux ;;
1.250     momjian    65:    mingw*) template=win32 ;;
1.30      petere     66:   netbsd*) template=netbsd ;;
                     67: nextstep*) template=nextstep ;;
                     68:  openbsd*) template=openbsd ;;
                     69:      osf*) template=osf ;;
                     70:      qnx*) template=qnx4 ;;
                     71:      sco*) template=sco ;;
1.58      petere     72:  solaris*) template=solaris ;;
1.30      petere     73:    sunos*) template=sunos4 ;;
1.1       petere     74:  sysv4.2*)
1.30      petere     75:         case $host_vendor in
                     76:           univel) template=univel ;;
                     77:         esac ;;
                     78:    sysv4*) template=svr4 ;;
1.133     petere     79:    sysv5*) template=unixware ;;
1.30      petere     80:   ultrix*) template=ultrix4 ;;
1.1       petere     81: esac
                     82: 
1.30      petere     83:   if test x"$template" = x"" ; then
1.80      petere     84:     AC_MSG_ERROR([[
1.30      petere     85: *******************************************************************
                     86: PostgreSQL has apparently not been ported to your platform yet.
1.32      petere     87: To try a manual configuration, look into the src/template directory
1.80      petere     88: for a similar platform and use the '--with-template=' option.
1.30      petere     89: 
1.398.4.30! tgl        90: Please also contact <[email protected]> to see about
1.80      petere     91: rectifying this.  Include the above 'checking host system type...'
1.30      petere     92: line.
                     93: *******************************************************************
1.80      petere     94: ]])
1.30      petere     95:   fi
                     96: 
1.42      petere     97: ])
1.1       petere     98: 
1.30      petere     99: AC_MSG_RESULT([$template])
1.1       petere    100: 
1.30      petere    101: PORTNAME=$template
                    102: AC_SUBST(PORTNAME)
1.1       petere    103: 
1.309     tgl       104: # Initialize default assumption that we do not need separate assembly code
                    105: # for TAS (test-and-set).  This can be overridden by the template file
                    106: # when it's executed.
                    107: need_tas=no
                    108: tas_file=dummy.s
1.1       petere    109: 
                    110: 
                    111: 
1.30      petere    112: ##
                    113: ## Command line options
                    114: ##
1.13      petere    115: 
1.304     petere    116: #
                    117: # Installation directory for documentation
                    118: #
                    119: PGAC_ARG(with, docdir, [  --with-docdir=DIR       install the documentation in DIR [[PREFIX/doc]]
                    120:   --without-docdir        do not install the documentation],
                    121:          [AC_MSG_ERROR([option --with-docdir requires an argument])],
                    122:          [docdir=],
                    123:          [docdir=$withval],
                    124:          [docdir='${prefix}/doc'])
                    125: AC_SUBST(docdir)
                    126: 
1.1       petere    127: 
1.30      petere    128: #
                    129: # Add non-standard directories to the include path
                    130: #
1.42      petere    131: PGAC_ARG_REQ(with, includes, [  --with-includes=DIRS    look for additional header files in DIRS])
1.1       petere    132: 
                    133: 
1.30      petere    134: #
                    135: # Add non-standard directories to the library search path
                    136: #
1.42      petere    137: PGAC_ARG_REQ(with, libraries, [  --with-libraries=DIRS   look for additional libraries in DIRS],
                    138:              [LIBRARY_DIRS=$withval])
1.1       petere    139: 
1.42      petere    140: PGAC_ARG_REQ(with, libs,      [  --with-libs=DIRS        alternative spelling of --with-libraries],
                    141:              [LIBRARY_DIRS=$withval])
1.2       petere    142: 
1.1       petere    143: 
1.29      petere    144: #
1.180     thomas    145: # 64-bit integer date/time storage (--enable-integer-datetimes)
                    146: #
                    147: AC_MSG_CHECKING([whether to build with 64-bit integer date/time support])
                    148: PGAC_ARG_BOOL(enable, integer-datetimes, no, [  --enable-integer-datetimes  enable 64-bit integer date/time support],
                    149:               [AC_DEFINE([USE_INTEGER_DATETIMES], 1,
1.242     petere    150:                          [Define to 1 if you want 64-bit integer timestamp and interval support. (--enable-integer-datetimes)])])
1.180     thomas    151: AC_MSG_RESULT([$enable_integer_datetimes])
1.1       petere    152: 
                    153: 
1.70      ishii     154: #
1.128     petere    155: # NLS
                    156: #
                    157: AC_MSG_CHECKING([whether NLS is wanted])
                    158: PGAC_ARG_OPTARG(enable, nls,
1.171     petere    159:                 [[  --enable-nls[=LANGUAGES]  enable Native Language Support]],
1.128     petere    160:                 [],
                    161:                 [WANTED_LANGUAGES=$enableval],
1.171     petere    162:                 [AC_DEFINE(ENABLE_NLS, 1,
1.242     petere    163:                            [Define to 1 if you want National Language Support. (--enable-nls)])])
1.128     petere    164: AC_MSG_RESULT([$enable_nls])
                    165: AC_SUBST(enable_nls)
                    166: AC_SUBST(WANTED_LANGUAGES)
                    167: 
                    168: #
1.29      petere    169: # Default port number (--with-pgport), default 5432
                    170: #
                    171: AC_MSG_CHECKING([for default port number])
1.42      petere    172: PGAC_ARG_REQ(with, pgport, [  --with-pgport=PORTNUM   change default port number [5432]],
                    173:              [default_port=$withval],
                    174:              [default_port=5432])
1.97      tgl       175: AC_MSG_RESULT([$default_port])
                    176: # Need both of these because some places want an integer and some a string
1.171     petere    177: AC_DEFINE_UNQUOTED(DEF_PGPORT, ${default_port},
1.242     petere    178: [Define to the default TCP port number on which the server listens and
1.280     tgl       179: to which clients will try to connect.  This can be overridden at run-time,
                    180: but it's convenient if your clients have the right default compiled in.
                    181: (--with-pgport=PORTNUM)])
1.171     petere    182: AC_DEFINE_UNQUOTED(DEF_PGPORT_STR, "${default_port}",
1.280     tgl       183:                    [Define to the default TCP port number as a string constant.])
1.97      tgl       184: AC_SUBST(default_port)
1.1       petere    185: 
1.29      petere    186: #
1.65      petere    187: # Option to disable shared libraries
                    188: #
                    189: PGAC_ARG_BOOL(enable, shared, yes,
1.68      petere    190:               [  --disable-shared        do not build shared libraries])
1.65      petere    191: AC_SUBST(enable_shared)
                    192: 
1.69      petere    193: #
                    194: # '-rpath'-like feature can be disabled
                    195: #
                    196: PGAC_ARG_BOOL(enable, rpath, yes,
                    197:               [  --disable-rpath         do not embed shared library search path in executables])
                    198: AC_SUBST(enable_rpath)
                    199: 
1.289     momjian   200: #
                    201: # Spinlocks
                    202: #
                    203: PGAC_ARG_BOOL(enable, spinlocks, yes,
1.298     petere    204:               [  --disable-spinlocks     do not use spinlocks])
1.65      petere    205: 
                    206: #
1.74      petere    207: # --enable-debug adds -g to compiler flags
                    208: #
                    209: PGAC_ARG_BOOL(enable, debug, no,
                    210:               [  --enable-debug          build with debugging symbols (-g)])
1.168     momjian   211: AC_SUBST(enable_debug)
1.74      petere    212: 
                    213: #
1.30      petere    214: # C compiler
                    215: #
                    216: 
1.29      petere    217: # For historical reasons you can also use --with-CC to specify the C compiler
                    218: # to use, although the standard way to do this is to set the CC environment
                    219: # variable.
1.42      petere    220: PGAC_ARG_REQ(with, CC, [], [CC=$with_CC])
1.4       tgl       221: 
1.171     petere    222: case $template in
                    223:   aix) pgac_cc_list="gcc xlc";;
                    224:  irix) pgac_cc_list="cc";; # no gcc
                    225:     *) pgac_cc_list="gcc cc";;
                    226: esac
1.4       tgl       227: 
1.171     petere    228: AC_PROG_CC([$pgac_cc_list])
1.280     tgl       229: 
1.300     petere    230: unset CFLAGS
1.298     petere    231: 
1.280     tgl       232: #
1.30      petere    233: # Read the template
1.280     tgl       234: #
1.30      petere    235: . "$srcdir/src/template/$template" || exit
1.74      petere    236: 
1.298     petere    237: # CFLAGS are selected so:
                    238: # If the user specifies something in the environment, that is used.
                    239: # else:  If the template file set something, that is used.
                    240: # else:  If the compiler is GCC, then we use -O2.
                    241: # else:  If the compiler is something else, then we use -0.
                    242: 
1.171     petere    243: if test "$ac_env_CFLAGS_set" = set; then
                    244:   CFLAGS=$ac_env_CFLAGS_value
1.300     petere    245: elif test "${CFLAGS+set}" = set; then
1.298     petere    246:   : # (keep what template set)
                    247: elif test "$GCC" = yes; then
                    248:   CFLAGS="-O2"
1.296     tgl       249: else
1.300     petere    250:   # if the user selected debug mode, don't use -O
                    251:   if test "$enable_debug" != yes; then
                    252:     CFLAGS="-O"
                    253:   fi
1.294     momjian   254: fi
1.298     petere    255: 
1.398.4.13  tgl       256: # Some versions of GCC support some additional useful warning flags.
                    257: # Check whether they are supported, and add them to CFLAGS if so.
                    258: 
1.382     neilc     259: if test "$GCC" = yes; then
                    260: 
1.398.4.13  tgl       261: # ICC pretends to be GCC but it's lying; it doesn't support these options.
                    262: # So we have to check if "GCC" is really ICC.
                    263: AC_TRY_COMPILE([], [@%:@ifndef __INTEL_COMPILER
                    264: choke me
                    265: @%:@endif], [ICC=[yes]], [ICC=[no]])
                    266: 
                    267:   if test "$ICC" = no; then
                    268:     CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wpointer-arith"
                    269: 
                    270:     PGAC_PROG_CC_CFLAGS_OPT([-Wdeclaration-after-statement])
                    271:     PGAC_PROG_CC_CFLAGS_OPT([-Wendif-labels])
                    272:   else
                    273:     # Intel compiler has a bug/misoptimization in checking for
                    274:     # division by NAN (NaN == 0), -mp1 fixes it, so add it to the
                    275:     # CFLAGS.
                    276:     PGAC_PROG_CC_CFLAGS_OPT([-mp1])
                    277:   fi
1.382     neilc     278: 
                    279:   # Disable strict-aliasing rules; needed for gcc 3.3+
                    280:   PGAC_PROG_CC_CFLAGS_OPT([-fno-strict-aliasing])
1.398.4.24  tgl       281:   # Disable optimizations that assume no overflow; needed for gcc 4.3+
                    282:   PGAC_PROG_CC_CFLAGS_OPT([-fwrapv])
1.398.4.13  tgl       283: elif test x"${CC}" = x"xlc"; then
                    284:   # AIX xlc has to have strict aliasing turned off too
                    285:   PGAC_PROG_CC_CFLAGS_OPT([-qnoansialias])
1.382     neilc     286: fi
1.298     petere    287: 
1.296     tgl       288: # supply -g if --enable-debug
1.300     petere    289: if test "$enable_debug" = yes && test "$ac_cv_prog_cc_g" = yes; then
1.74      petere    290:   CFLAGS="$CFLAGS -g"
1.296     tgl       291: fi
1.298     petere    292: 
1.171     petere    293: AC_MSG_NOTICE([using CFLAGS=$CFLAGS])
1.285     momjian   294: 
                    295: # We already have this in Makefile.win32, but configure needs it too
1.298     petere    296: if test "$PORTNAME" = "win32"; then
1.312     momjian   297:   CPPFLAGS="$CPPFLAGS -I$srcdir/src/include/port/win32 -DEXEC_BACKEND"
1.285     momjian   298: fi
1.210     petere    299: 
1.30      petere    300: # Check if the compiler still works with the template settings
1.171     petere    301: AC_MSG_CHECKING([whether the C compiler still works])
                    302: AC_TRY_LINK([], [return 0;],
                    303:   [AC_MSG_RESULT(yes)],
                    304:   [AC_MSG_RESULT(no)
                    305:    AC_MSG_ERROR([cannot proceed])])
1.210     petere    306: 
1.296     tgl       307: # Defend against gcc -ffast-math
1.210     petere    308: if test "$GCC" = yes; then
                    309: AC_TRY_COMPILE([], [@%:@ifdef __FAST_MATH__
                    310: choke me
                    311: @%:@endif], [], [AC_MSG_ERROR([do not put -ffast-math in CFLAGS])])
                    312: fi
                    313: 
1.4       tgl       314: AC_PROG_CPP
1.6       petere    315: AC_SUBST(GCC)
1.4       tgl       316: 
1.29      petere    317: # Create compiler version string
1.24      petere    318: if test x"$GCC" = x"yes" ; then
1.169     momjian   319:   cc_string="GCC `${CC} --version | sed q`"
1.4       tgl       320: else
1.24      petere    321:   cc_string=$CC
1.4       tgl       322: fi
1.242     petere    323: AC_DEFINE_UNQUOTED(PG_VERSION_STR,
                    324:                    ["PostgreSQL $PACKAGE_VERSION on $host, compiled by $cc_string"],
                    325:                    [A string containing the version number, platform, and C compiler])
1.309     tgl       326: 
                    327: 
                    328: #
                    329: # Set up TAS assembly code if needed; the template file has now had its
                    330: # chance to request this.
                    331: #
                    332: AC_CONFIG_LINKS([src/backend/port/tas.s:src/backend/port/tas/${tas_file}])
                    333: 
                    334: if test "$need_tas" = yes ; then
                    335:   TAS=tas.o
                    336: else
                    337:   TAS=""
                    338: fi
                    339: AC_SUBST(TAS)
1.24      petere    340: 
1.4       tgl       341: 
1.31      petere    342: #
                    343: # Automatic dependency tracking
                    344: #
1.42      petere    345: PGAC_ARG_BOOL(enable, depend, no, [  --enable-depend         turn on automatic dependency tracking],
                    346:               [autodepend=yes])
1.31      petere    347: AC_SUBST(autodepend)
                    348: 
                    349: 
1.42      petere    350: #
                    351: # Enable assert checks
                    352: #
                    353: PGAC_ARG_BOOL(enable, cassert, no, [  --enable-cassert        enable assertion checks (for debugging)],
                    354:               [AC_DEFINE([USE_ASSERT_CHECKING], 1,
1.242     petere    355:                          [Define to 1 to build with assertion checks. (--enable-cassert)])])
1.30      petere    356: 
                    357: 
                    358: #
                    359: # Include directories
                    360: #
                    361: ac_save_IFS=$IFS
1.375     tgl       362: IFS="${IFS}${PATH_SEPARATOR}"
1.30      petere    363: # SRCH_INC comes from the template file
                    364: for dir in $with_includes $SRCH_INC; do
                    365:   if test -d "$dir"; then
                    366:     INCLUDES="$INCLUDES -I$dir"
                    367:   else
                    368:     AC_MSG_WARN([*** Include directory $dir does not exist.])
                    369:   fi
                    370: done
                    371: IFS=$ac_save_IFS
                    372: AC_SUBST(INCLUDES)
                    373: 
                    374: 
                    375: #
                    376: # Library directories
                    377: #
                    378: ac_save_IFS=$IFS
1.375     tgl       379: IFS="${IFS}${PATH_SEPARATOR}"
1.30      petere    380: # LIBRARY_DIRS comes from command line, SRCH_LIB from template file.
                    381: for dir in $LIBRARY_DIRS $SRCH_LIB; do
                    382:   if test -d "$dir"; then
1.68      petere    383:     LIBDIRS="$LIBDIRS -L$dir"
1.30      petere    384:   else
                    385:     AC_MSG_WARN([*** Library directory $dir does not exist.])
                    386:   fi
                    387: done
                    388: IFS=$ac_save_IFS
                    389: 
1.43      petere    390: #
1.280     tgl       391: # Enable thread-safe client libraries
1.261     momjian   392: #
1.280     tgl       393: AC_MSG_CHECKING([allow thread-safe client libraries])
1.366     momjian   394: PGAC_ARG_BOOL(enable, thread-safety, no, [  --enable-thread-safety  make client libraries thread-safe])
                    395: PGAC_ARG_BOOL(enable, thread-safety-force, no, [  --enable-thread-safety-force  force thread-safety in spite of thread test failure])
1.369     momjian   396: if test "$enable_thread_safety" = yes -o \
                    397:         "$enable_thread_safety_force" = yes; then
1.366     momjian   398:   enable_thread_safety="yes"   # for 'force'
                    399:   AC_DEFINE([ENABLE_THREAD_SAFETY], 1,
                    400:           [Define to 1 to build client libraries as thread-safe code. (--enable-thread-safety)])
                    401: fi
1.271     momjian   402: AC_MSG_RESULT([$enable_thread_safety])
                    403: AC_SUBST(enable_thread_safety)
1.261     momjian   404: 
                    405: #
1.379     neilc     406: # Optionally build Tcl modules (PL/Tcl)
1.43      petere    407: #
                    408: AC_MSG_CHECKING([whether to build with Tcl])
1.379     neilc     409: PGAC_ARG_BOOL(with, tcl, no, [  --with-tcl              build Tcl modules (PL/Tcl)])
1.43      petere    410: AC_MSG_RESULT([$with_tcl])
                    411: AC_SUBST([with_tcl])
                    412: 
1.171     petere    413: # We see if the path to the Tcl/Tk configuration scripts is specified.
1.42      petere    414: # This will override the use of tclsh to find the paths to search.
                    415: 
1.323     pgsql     416: PGAC_ARG_REQ(with, tclconfig, [  --with-tclconfig=DIR    tclConfig.sh is in DIR])
1.125     petere    417: 
1.42      petere    418: #
1.205     petere    419: # Optionally build Perl modules (PL/Perl)
1.199     momjian   420: #
                    421: AC_MSG_CHECKING([whether to build Perl modules])
1.205     petere    422: PGAC_ARG_BOOL(with, perl, no, [  --with-perl             build Perl modules (PL/Perl)])
1.199     momjian   423: AC_MSG_RESULT([$with_perl])
                    424: AC_SUBST(with_perl)
                    425: 
                    426: #
1.283     petere    427: # Optionally build Python modules (PL/Python)
1.42      petere    428: #
                    429: AC_MSG_CHECKING([whether to build Python modules])
1.283     petere    430: PGAC_ARG_BOOL(with, python, no, [  --with-python           build Python modules (PL/Python)])
1.126     petere    431: AC_MSG_RESULT([$with_python])
1.5       petere    432: AC_SUBST(with_python)
1.13      petere    433: 
1.28      petere    434: #
                    435: # Kerberos 4
                    436: #
1.171     petere    437: AC_MSG_CHECKING([whether to build with Kerberos 4 support])
1.307     petere    438: PGAC_ARG_BOOL(with, krb4, no, [  --with-krb4             build with Kerberos 4 support],
1.42      petere    439: [
1.242     petere    440:   AC_DEFINE(KRB4, 1, [Define to build with Kerberos 4 support. (--with-krb4)])
1.42      petere    441:   krb_srvtab="/etc/srvtab"
1.307     petere    442: ])
                    443: AC_MSG_RESULT([$with_krb4])
1.42      petere    444: AC_SUBST(with_krb4)
1.13      petere    445: 
                    446: 
1.28      petere    447: #
                    448: # Kerberos 5
                    449: #
1.171     petere    450: AC_MSG_CHECKING([whether to build with Kerberos 5 support])
1.307     petere    451: PGAC_ARG_BOOL(with, krb5, no, [  --with-krb5             build with Kerberos 5 support],
1.42      petere    452: [
1.242     petere    453:   AC_DEFINE(KRB5, 1, [Define to build with Kerberos 5 support. (--with-krb5)])
1.42      petere    454:   krb_srvtab="FILE:\$(sysconfdir)/krb5.keytab"
1.307     petere    455: ])
                    456: AC_MSG_RESULT([$with_krb5])
1.42      petere    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.304     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"],
1.242     petere    476:                    [Define to the name of the PostgreSQL service principal in Kerberos. (--with-krb-srvnam=NAME)])
1.13      petere    477: 
1.28      petere    478: 
1.136     momjian   479: #
                    480: # PAM
                    481: #
                    482: AC_MSG_CHECKING([whether to build with PAM support])
1.158     petere    483: PGAC_ARG_BOOL(with, pam, no,
                    484:               [  --with-pam              build with PAM support],
1.242     petere    485:               [AC_DEFINE([USE_PAM], 1, [Define to 1 to build with PAM support. (--with-pam)])])
1.158     petere    486: AC_MSG_RESULT([$with_pam])
1.136     momjian   487: AC_SUBST(with_pam)
                    488: 
1.28      petere    489: 
                    490: #
1.258     momjian   491: # Rendezvous
                    492: #
                    493: AC_MSG_CHECKING([whether to build with Rendezvous support])
                    494: PGAC_ARG_BOOL(with, rendezvous, no,
                    495:               [  --with-rendezvous       build with Rendezvous support],
                    496:               [AC_DEFINE([USE_RENDEZVOUS], 1, [Define to 1 to build with Rendezvous support. (--with-rendezvous)])])
                    497: AC_MSG_RESULT([$with_rendezvous])
                    498: AC_SUBST(with_rendezvous)
                    499: 
                    500: 
                    501: #
1.28      petere    502: # OpenSSL
                    503: #
1.307     petere    504: AC_MSG_CHECKING([whether to build with OpenSSL support])
                    505: PGAC_ARG_BOOL(with, openssl, no, [  --with-openssl          build with OpenSSL support],
                    506:               [AC_DEFINE([USE_SSL], 1, [Define to build with (Open)SSL support. (--with-openssl)])])
                    507: AC_MSG_RESULT([$with_openssl])
1.42      petere    508: AC_SUBST(with_openssl)
1.28      petere    509: 
1.13      petere    510: 
1.177     petere    511: #
                    512: # Readline
                    513: #
                    514: PGAC_ARG_BOOL(with, readline, yes,
                    515:               [  --without-readline      do not use Readline])
1.369     momjian   516: # readline on MinGW has problems with backslashes in psql and other bugs.
                    517: # This is particularly a problem with non-US code pages.
                    518: # Therefore disable its use until we understand the cause. 2004-07-20
1.376     momjian   519: if test "$PORTNAME" = "win32"; then
1.369     momjian   520:   if test "$with_readline" = yes; then
                    521:     AC_MSG_WARN([*** Readline does not work on MinGW --- disabling])
                    522:     with_readline=no
1.376     momjian   523:   fi
                    524: fi
1.369     momjian   525: 
1.177     petere    526: 
                    527: #
                    528: # Zlib
                    529: #
                    530: PGAC_ARG_BOOL(with, zlib, yes,
                    531:               [  --without-zlib          do not use Zlib])
1.3       momjian   532: 
1.254     momjian   533: #
                    534: # Elf
                    535: #
1.3       momjian   536: 
1.30      petere    537: # Assume system is ELF if it predefines __ELF__ as 1,
                    538: # otherwise believe host_os based default.
                    539: case $host_os in
1.127     momjian   540:     freebsd1*|freebsd2*) elf=no;;
                    541:     freebsd3*|freebsd4*) elf=yes;;
1.30      petere    542: esac
1.1       petere    543: 
                    544: AC_EGREP_CPP(yes,
                    545: [#if __ELF__
                    546:   yes
                    547: #endif
                    548: ],
1.30      petere    549: [ELF_SYS=true],
                    550: [if test "X$elf" = "Xyes" ; then
                    551:   ELF_SYS=true
1.1       petere    552: else
1.30      petere    553:   ELF_SYS=
                    554: fi])
                    555: AC_SUBST(ELF_SYS)
1.1       petere    556: 
1.254     momjian   557: #
                    558: # Assignments
                    559: #
1.1       petere    560: 
1.30      petere    561: CPPFLAGS="$CPPFLAGS $INCLUDES"
1.68      petere    562: LDFLAGS="$LDFLAGS $LIBDIRS"
1.30      petere    563: 
1.171     petere    564: AC_MSG_NOTICE([using CPPFLAGS=$CPPFLAGS])
                    565: AC_MSG_NOTICE([using LDFLAGS=$LDFLAGS])
1.30      petere    566: 
1.381     momjian   567: AC_ARG_VAR(LDFLAGS_SL)
1.30      petere    568: 
1.2       petere    569: AC_PROG_AWK
1.39      petere    570: PGAC_PATH_FLEX
1.1       petere    571: AC_PROG_LN_S
1.368     petere    572: PGAC_PROG_LD
1.67      petere    573: AC_SUBST(LD)
                    574: AC_SUBST(with_gnu_ld)
1.130     momjian   575: case $host_os in sysv5*)
1.77      petere    576:   AC_CACHE_CHECK([whether ld -R works], [pgac_cv_prog_ld_R],
                    577:   [
                    578:     pgac_save_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS -Wl,-R/usr/lib"
                    579:     AC_TRY_LINK([], [], [pgac_cv_prog_ld_R=yes], [pgac_cv_prog_ld_R=no])
                    580:     LDFLAGS=$pgac_save_LDFLAGS
                    581:   ])
                    582:   ld_R_works=$pgac_cv_prog_ld_R
                    583:   AC_SUBST(ld_R_works)
                    584: esac
1.1       petere    585: AC_PROG_RANLIB
1.58      petere    586: AC_CHECK_PROGS(LORDER, lorder)
1.56      petere    587: AC_PATH_PROG(TAR, tar)
1.176     petere    588: PGAC_CHECK_STRIP
1.98      petere    589: 
                    590: AC_CHECK_PROGS(YACC, ['bison -y'])
1.255     momjian   591: 
                    592: if test "$YACC"; then
1.257     tgl       593:   if $YACC --version | sed q | $AWK '{ if ($4 < 1.875) exit 0; else exit 1;}'; then
1.255     momjian   594:     AC_MSG_WARN([
1.318     momjian   595: *** If you are going to modify the grammar files or build from CVS, the installed
1.317     momjian   596: *** version of Bison is too old.  Bison version 1.875 or later is required.])
1.255     momjian   597:   fi
                    598: fi
                    599: 
1.98      petere    600: if test -z "$YACC"; then
                    601:   AC_MSG_WARN([
                    602: *** Without Bison you will not be able to build PostgreSQL from CVS or
                    603: *** change any of the parser definition files.  You can obtain Bison from
                    604: *** a GNU mirror site.  (If you are using the official distribution of
                    605: *** PostgreSQL then you do not need to worry about this because the Bison
                    606: *** output is pre-generated.)  To use a different yacc program (possible,
                    607: *** but not recommended), set the environment variable YACC before running
                    608: *** 'configure'.])
                    609: fi
1.6       petere    610: AC_SUBST(YFLAGS)
1.98      petere    611: 
1.199     momjian   612: PGAC_PATH_PERL
                    613: if test "$with_perl" = yes; then
1.205     petere    614:   PGAC_CHECK_PERL_CONFIGS([archlibexp,privlibexp,useshrplib])
1.199     momjian   615:   PGAC_CHECK_PERL_EMBED_LDFLAGS
1.126     petere    616: fi
                    617: 
                    618: if test "$with_python" = yes; then
                    619:   PGAC_PATH_PYTHON
                    620:   PGAC_CHECK_PYTHON_EMBED_SETUP
1.43      petere    621: fi
1.1       petere    622: 
                    623: 
1.183     tgl       624: ##
1.29      petere    625: ## Libraries
                    626: ##
                    627: 
1.1       petere    628: if test "$PORTNAME" != "aix" -a "$PORTNAME" != "alpha"
                    629: then
                    630:        AC_CHECK_LIB(bsd,      main)
                    631: fi
1.21      petere    632: AC_CHECK_LIB(util,     setproctitle)
1.1       petere    633: AC_CHECK_LIB(m,        main)
                    634: AC_CHECK_LIB(dl,       main)
1.354     momjian   635: AC_CHECK_LIB(nsl,      main)
                    636: AC_CHECK_LIB(socket,   main)
1.1       petere    637: AC_CHECK_LIB(ipc,      main)
                    638: AC_CHECK_LIB(IPC,      main)
                    639: AC_CHECK_LIB(lc,       main)
                    640: AC_CHECK_LIB(dld,      main)
                    641: AC_CHECK_LIB(ld,       main)
                    642: AC_CHECK_LIB(compat,   main)
                    643: AC_CHECK_LIB(BSD,      main)
1.354     momjian   644: AC_CHECK_LIB(gen,      main)
1.1       petere    645: AC_CHECK_LIB(PW,       main)
1.95      petere    646: AC_CHECK_LIB(resolv,   main)
1.209     momjian   647: AC_SEARCH_LIBS(getopt_long, [getopt gnugetopt])
1.139     petere    648: # QNX:
1.223     momjian   649: AC_CHECK_LIB(unix, main)
1.21      petere    650: AC_SEARCH_LIBS(crypt,  crypt)
1.139     petere    651: # BeOS:
1.273     tgl       652: if test "$PORTNAME" = "beos"
                    653: then
                    654:        AC_CHECK_LIB(bind, __inet_ntoa)
                    655: fi
1.139     petere    656: # Solaris:
1.140     petere    657: AC_SEARCH_LIBS(fdatasync, [rt posix4])
1.206     petere    658: # Cygwin:
                    659: AC_CHECK_LIB(cygipc, shmget)
1.280     tgl       660: # WIN32:
                    661: if test "$PORTNAME" = "win32"
                    662: then
                    663:        AC_CHECK_LIB(wsock32, main)
                    664: fi
1.28      petere    665: 
1.177     petere    666: if test "$with_readline" = yes; then
                    667:   PGAC_CHECK_READLINE
                    668:   if test x"$pgac_cv_check_readline" = x"no"; then
                    669:     AC_MSG_ERROR([readline library not found
1.208     momjian   670: If you have readline already installed, see config.log for details on the
                    671: failure.  It is possible the compiler isn't looking in the proper directory.
1.177     petere    672: Use --without-readline to disable readline support.])
                    673:   fi
                    674: fi
                    675: 
                    676: if test "$with_zlib" = yes; then
                    677:   AC_CHECK_LIB(z, inflate, [],
                    678:                [AC_MSG_ERROR([zlib library not found
1.208     momjian   679: If you have zlib already installed, see config.log for details on the
                    680: failure.  It is possible the compiler isn't looking in the proper directory.
1.177     petere    681: Use --without-zlib to disable zlib support.])])
1.287     momjian   682: fi
                    683: 
1.289     momjian   684: if test "$enable_spinlocks" = yes; then
1.287     momjian   685:   AC_DEFINE(HAVE_SPINLOCKS, 1, [Define to 1 if you have spinlocks.])
                    686: else
                    687:   AC_MSG_WARN([
                    688: *** Not using spinlocks will cause poor performance.])
1.177     petere    689: fi
                    690: 
1.28      petere    691: if test "$with_krb4" = yes ; then
1.223     momjian   692:   AC_CHECK_LIB(des, des_encrypt, [], [AC_MSG_ERROR([library 'des' is required for Kerberos 4])])
                    693:   AC_CHECK_LIB(krb, krb_sendauth, [], [AC_MSG_ERROR([library 'krb' is required for Kerberos 4])])
1.250     momjian   694:   AC_REPLACE_FUNCS([gethostname])
1.28      petere    695: fi
                    696: 
                    697: if test "$with_krb5" = yes ; then
1.398.4.2  tgl       698:   if test "$PORTNAME" != "win32"; then
                    699:      AC_SEARCH_LIBS(com_err, [krb5 'krb5 -ldes -lasn1 -lroken' com_err], [],
                    700:                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
                    701:      AC_SEARCH_LIBS(krb5_encrypt, [krb5 'krb5 -ldes -lasn1 -lroken' crypto k5crypto], [],
                    702:                     [AC_MSG_ERROR([could not find function 'krb5_encrypt' required for Kerberos 5])])
                    703:      AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -ldes -lasn1 -lroken'], [],
                    704:                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
                    705:   else
                    706:      AC_SEARCH_LIBS(com_err, 'comerr32 -lkrb5_32', [],
                    707:                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
                    708:   fi
1.28      petere    709: fi
                    710: 
                    711: if test "$with_openssl" = yes ; then
                    712:   dnl Order matters!
1.380     momjian   713:   if test "$PORTNAME" != "win32"; then
                    714:      AC_CHECK_LIB(crypto, CRYPTO_new_ex_data, [], [AC_MSG_ERROR([library 'crypto' is required for OpenSSL])])
                    715:      AC_CHECK_LIB(ssl,    SSL_library_init, [], [AC_MSG_ERROR([library 'ssl' is required for OpenSSL])])
                    716:   else
                    717:      AC_CHECK_LIB(eay32, CRYPTO_new_ex_data, [], [AC_MSG_ERROR([library 'eay32' is required for OpenSSL])])
                    718:      AC_CHECK_LIB(ssleay32,    SSL_library_init, [], [AC_MSG_ERROR([library 'ssleay32' is required for OpenSSL])])
                    719:   fi
1.128     petere    720: fi
                    721: 
1.136     momjian   722: if test "$with_pam" = yes ; then
1.223     momjian   723:   AC_CHECK_LIB(pam,    pam_start, [], [AC_MSG_ERROR([library 'pam' is required for PAM])])
1.136     momjian   724: fi
                    725: 
1.171     petere    726: 
1.29      petere    727: ##
                    728: ## Header files
                    729: ##
1.194     petere    730: 
1.171     petere    731: dnl sys/socket.h is required by AC_FUNC_ACCEPT_ARGTYPES
1.367     petere    732: AC_CHECK_HEADERS([crypt.h dld.h endian.h fp_class.h getopt.h ieeefp.h langinfo.h poll.h pwd.h sys/ipc.h sys/poll.h sys/pstat.h sys/select.h sys/sem.h sys/socket.h sys/shm.h sys/time.h sys/un.h termios.h utime.h wchar.h wctype.h kernel/OS.h kernel/image.h SupportDefs.h])
1.66      tgl       733: 
1.171     petere    734: # At least on IRIX, cpp test for netinet/tcp.h will fail unless
                    735: # netinet/in.h is included first.
1.223     momjian   736: AC_CHECK_HEADERS(netinet/in.h)
                    737: AC_CHECK_HEADERS(netinet/tcp.h, [], [],
1.173     petere    738: [AC_INCLUDES_DEFAULT
                    739: #ifdef HAVE_NETINET_IN_H
1.66      tgl       740: #include <netinet/in.h>
                    741: #endif
1.171     petere    742: ])
1.73      petere    743: 
1.387     tgl       744: if expr x"$pgac_cv_check_readline" : 'x-lreadline' >/dev/null ; then
1.223     momjian   745:   AC_CHECK_HEADERS(readline/readline.h, [],
1.389     tgl       746:         [AC_CHECK_HEADERS(readline.h, [],
                    747:                 [AC_MSG_ERROR([readline header not found
1.208     momjian   748: If you have readline already installed, see config.log for details on the
                    749: failure.  It is possible the compiler isn't looking in the proper directory.
1.387     tgl       750: Use --without-readline to disable readline support.])])])
1.223     momjian   751:   AC_CHECK_HEADERS(readline/history.h, [],
1.389     tgl       752:         [AC_CHECK_HEADERS(history.h, [],
                    753:                 [AC_MSG_ERROR([history header not found
1.208     momjian   754: If you have readline already installed, see config.log for details on the
                    755: failure.  It is possible the compiler isn't looking in the proper directory.
1.387     tgl       756: Use --without-readline to disable readline support.])])])
                    757: fi
                    758: 
                    759: if expr x"$pgac_cv_check_readline" : 'x-ledit' >/dev/null ; then
1.389     tgl       760: # Some installations of libedit usurp /usr/include/readline/, which seems
                    761: # bad practice, since in combined installations readline will have its headers
                    762: # there.  We might have to resort to AC_EGREP checks to make sure we found
                    763: # the proper header...
1.387     tgl       764:   AC_CHECK_HEADERS(editline/readline.h, [],
1.389     tgl       765:         [AC_CHECK_HEADERS(readline.h, [],
                    766:                 [AC_CHECK_HEADERS(readline/readline.h, [],
                    767:                         [AC_MSG_ERROR([readline header not found
1.387     tgl       768: If you have libedit already installed, see config.log for details on the
                    769: failure.  It is possible the compiler isn't looking in the proper directory.
1.389     tgl       770: Use --without-readline to disable libedit support.])])])])
1.387     tgl       771:   AC_CHECK_HEADERS(editline/history.h, [],
1.389     tgl       772:         [AC_CHECK_HEADERS(history.h, [],
                    773:                 [AC_CHECK_HEADERS(readline/history.h, [],
                    774:                         [AC_MSG_ERROR([history header not found
1.387     tgl       775: If you have libedit already installed, see config.log for details on the
                    776: failure.  It is possible the compiler isn't looking in the proper directory.
1.389     tgl       777: Use --without-readline to disable libedit support.])])])])
1.177     petere    778: fi
                    779: 
                    780: if test "$with_zlib" = yes; then
                    781:   AC_CHECK_HEADER(zlib.h, [], [AC_MSG_ERROR([zlib header not found
1.232     momjian   782: If you have zlib already installed, see config.log for details on the
1.208     momjian   783: failure.  It is possible the compiler isn't looking in the proper directory.
1.177     petere    784: Use --without-zlib to disable zlib support.])])
                    785: fi
1.15      petere    786: 
1.28      petere    787: if test "$with_krb4" = yes ; then
                    788:   AC_CHECK_HEADER(krb.h, [], [AC_MSG_ERROR([header file <krb.h> is required for Kerberos 4])])
                    789: fi
                    790: 
                    791: if test "$with_krb5" = yes ; then
                    792:   AC_CHECK_HEADER(krb5.h, [], [AC_MSG_ERROR([header file <krb5.h> is required for Kerberos 5])])
                    793: fi
                    794: 
                    795: if test "$with_openssl" = yes ; then
1.223     momjian   796:   AC_CHECK_HEADER(openssl/ssl.h, [], [AC_MSG_ERROR([header file <openssl/ssl.h> is required for OpenSSL])])
                    797:   AC_CHECK_HEADER(openssl/err.h, [], [AC_MSG_ERROR([header file <openssl/err.h> is required for OpenSSL])])
1.136     momjian   798: fi
                    799: 
                    800: if test "$with_pam" = yes ; then
1.236     momjian   801:   AC_CHECK_HEADERS(security/pam_appl.h, [],
                    802:                    [AC_CHECK_HEADERS(pam/pam_appl.h, [],
                    803:                                      [AC_MSG_ERROR([header file <security/pam_appl.h> or <pam/pam_appl.h> is required for PAM.])])])
1.258     momjian   804: fi
                    805: 
                    806: if test "$with_rendezvous" = yes ; then
                    807:   AC_CHECK_HEADER(DNSServiceDiscovery/DNSServiceDiscovery.h, [], [AC_MSG_ERROR([header file <DNSServiceDiscovery/DNSServiceDiscovery.h> is required for Rendezvous])])
1.28      petere    808: fi
                    809: 
1.1       petere    810: 
1.29      petere    811: ##
                    812: ## Types, structures, compiler characteristics
                    813: ##
1.194     petere    814: 
1.171     petere    815: m4_defun([AC_PROG_CC_STDC], []) dnl We don't want that.
1.1       petere    816: AC_C_CONST
                    817: AC_C_INLINE
                    818: AC_C_STRINGIZE
1.40      petere    819: PGAC_C_SIGNED
1.171     petere    820: AC_C_VOLATILE
1.244     tgl       821: PGAC_C_FUNCNAME_SUPPORT
1.253     tgl       822: PGAC_STRUCT_TIMEZONE
1.29      petere    823: PGAC_UNION_SEMUN
1.44      petere    824: PGAC_STRUCT_SOCKADDR_UN
1.259     momjian   825: PGAC_STRUCT_SOCKADDR_STORAGE
1.270     tgl       826: PGAC_STRUCT_SOCKADDR_STORAGE_MEMBERS
1.241     tgl       827: PGAC_STRUCT_ADDRINFO
1.166     petere    828: 
1.171     petere    829: AC_CHECK_TYPES([struct cmsgcred, struct fcred, struct sockcred], [], [],
                    830: [#include <sys/param.h>
1.260     tgl       831: #include <sys/types.h>
1.171     petere    832: #include <sys/socket.h>
                    833: #include <sys/ucred.h>])
                    834: 
1.278     tgl       835: AC_CHECK_TYPES([struct option], [], [],
                    836: [#ifdef HAVE_GETOPT_H
1.279     tgl       837: #include <getopt.h>
1.278     tgl       838: #endif])
                    839: 
1.177     petere    840: if test "$with_zlib" = yes; then
                    841:   # Check that <zlib.h> defines z_streamp (versions before about 1.0.4
                    842:   # did not).  While we could work around the lack of z_streamp, it
                    843:   # seems unwise to encourage people to use such old zlib versions...
                    844:   AC_CHECK_TYPE(z_streamp, [], [AC_MSG_ERROR([zlib version is too old
                    845: Use --without-zlib to disable zlib support.])],
                    846:                 [#include <zlib.h>])
                    847: fi
                    848: 
1.166     petere    849: if test "$with_krb5" = yes; then
                    850: # Check for differences between MIT and Heimdal (KTH) releases
1.223     momjian   851:   AC_CHECK_MEMBERS(krb5_ticket.enc_part2, [],
1.229     momjian   852:                    [AC_CHECK_MEMBERS(krb5_ticket.client, [],
1.171     petere    853:                                      [AC_MSG_ERROR([could not determine how to get client name from Kerberos 5 ticket])],
                    854:                                      [#include <krb5.h>])],
                    855:                    [#include <krb5.h>])
1.223     momjian   856:   AC_CHECK_MEMBERS(krb5_error.text.data, [],
                    857:                    [AC_CHECK_MEMBERS(krb5_error.e_data, [],
1.205     petere    858:                                      [AC_MSG_ERROR([could not determine how to extract Kerberos 5 error messages])],
                    859:                                      [#include <krb5.h>])],
1.171     petere    860:                    [#include <krb5.h>])
1.166     petere    861: fi
                    862: 
1.29      petere    863: ##
                    864: ## Functions, global variables
                    865: ##
1.194     petere    866: 
1.6       petere    867: PGAC_VAR_INT_TIMEZONE
1.29      petere    868: AC_FUNC_ACCEPT_ARGTYPES
1.6       petere    869: PGAC_FUNC_GETTIMEOFDAY_1ARG
1.1       petere    870: 
1.159     momjian   871: # SunOS doesn't handle negative byte comparisons properly with +/- return
1.194     petere    872: AC_FUNC_MEMCMP
1.159     momjian   873: 
1.385     tgl       874: AC_CHECK_FUNCS([cbrt dlopen fcvt fdatasync getpeereid memmove poll pstat readlink setproctitle setsid sigprocmask symlink sysconf towlower utime utimes waitpid wcstombs])
1.99      tgl       875: 
1.171     petere    876: AC_CHECK_DECLS(fdatasync, [], [], [#include <unistd.h>])
1.226     momjian   877: 
1.284     tgl       878: HAVE_IPV6=no
1.240     petere    879: AC_CHECK_TYPE([struct sockaddr_in6],
1.398.4.6  tgl       880:         [AC_DEFINE(HAVE_IPV6, 1, [Define to 1 if you have support for IPv6.])
                    881:          HAVE_IPV6=yes],
                    882:         [],
1.231     petere    883: [$ac_includes_default
1.240     petere    884: #include <netinet/in.h>])
1.284     tgl       885: AC_SUBST(HAVE_IPV6)
1.1       petere    886: 
1.28      petere    887: AC_CACHE_CHECK([for PS_STRINGS], [pgac_cv_var_PS_STRINGS],
                    888: [AC_TRY_LINK(
                    889: [#include <machine/vmparam.h>
                    890: #include <sys/exec.h>
                    891: ],
1.1       petere    892: [PS_STRINGS->ps_nargvstr = 1;
                    893: PS_STRINGS->ps_argvstr = "foo";],
1.28      petere    894: [pgac_cv_var_PS_STRINGS=yes],
                    895: [pgac_cv_var_PS_STRINGS=no])])
                    896: if test "$pgac_cv_var_PS_STRINGS" = yes ; then
1.242     petere    897:   AC_DEFINE([HAVE_PS_STRINGS], [], [Define to 1 if the PS_STRINGS thing exists.])
1.28      petere    898: fi
1.1       petere    899: 
1.171     petere    900: 
                    901: # We use our snprintf.c emulation if either snprintf() or vsnprintf()
                    902: # is missing.  Yes, there are machines that have only one.  We may
                    903: # also decide to use snprintf.c if snprintf() is present but does not
                    904: # have working "long long int" support -- see below.
                    905: 
1.194     petere    906: pgac_need_repl_snprintf=no
                    907: AC_CHECK_FUNCS(snprintf, [], pgac_need_repl_snprintf=yes)
                    908: AC_CHECK_FUNCS(vsnprintf, [], pgac_need_repl_snprintf=yes)
1.171     petere    909: 
                    910: 
                    911: # Check whether <stdio.h> declares snprintf() and vsnprintf(); if not,
                    912: # include/c.h will provide declarations.  Note this is a separate test
                    913: # from whether the functions exist in the C library --- there are
                    914: # systems that have the functions but don't bother to declare them :-(
                    915: 
                    916: AC_CHECK_DECLS([snprintf, vsnprintf])
                    917: 
1.29      petere    918: 
1.398.4.10  tgl       919: dnl Cannot use AC_CHECK_FUNC because isinf may be a macro
1.29      petere    920: AC_CACHE_CHECK([for isinf], ac_cv_func_isinf,
1.398.4.10  tgl       921: [AC_TRY_LINK([
                    922: #include <math.h>
                    923: double glob_double;
1.29      petere    924: ],
1.398.4.10  tgl       925: [return isinf(glob_double) ? 0 : 1;],
1.29      petere    926: [ac_cv_func_isinf=yes],
                    927: [ac_cv_func_isinf=no])])
                    928: 
                    929: if test $ac_cv_func_isinf = yes ; then
1.242     petere    930:   AC_DEFINE(HAVE_ISINF, 1, [Define to 1 if you have isinf().])
1.1       petere    931: else
1.194     petere    932:   AC_LIBOBJ(isinf)
1.29      petere    933:   # Look for a way to implement a substitute for isinf()
                    934:   AC_CHECK_FUNCS([fpclass fp_class fp_class_d class], [break])
1.1       petere    935: fi
1.171     petere    936: 
1.345     tgl       937: AC_REPLACE_FUNCS([crypt fseeko getopt getrusage inet_aton random rint srandom strdup strerror strtol strtoul unsetenv])
1.241     tgl       938: 
                    939: # system's version of getaddrinfo(), if any, may be used only if we found
                    940: # a definition for struct addrinfo; see notes in src/include/getaddrinfo.h
                    941: if test x"$ac_cv_type_struct_addrinfo" = xyes ; then
                    942:   AC_REPLACE_FUNCS([getaddrinfo])
                    943: else
                    944:   AC_LIBOBJ(getaddrinfo)
1.278     tgl       945: fi
                    946: 
1.398.4.23  tgl       947: # Similarly, use system's getopt_long() only if system provides struct option.
                    948: # Solaris' getopt() doesn't do what we want for long options, so always use
                    949: # our versions on that platform.
                    950: if test "$PORTNAME" = "solaris"; then
                    951:   AC_LIBOBJ(getopt)
                    952:   AC_LIBOBJ(getopt_long)
                    953: elif test x"$ac_cv_type_struct_option" = xyes ; then
1.278     tgl       954:   AC_REPLACE_FUNCS([getopt_long])
                    955: else
                    956:   AC_LIBOBJ(getopt_long)
1.241     tgl       957: fi
1.193     momjian   958: 
1.216     momjian   959: # BSD/OS & NetBSD use a custom fseeko/ftello built on fsetpos/fgetpos
1.214     momjian   960: # We override the previous test that said fseeko/ftello didn't exist
1.216     momjian   961: # OS tests are also done in include/c.h and port/fseeko.c
                    962: case $host_os in bsdi*|netbsd*)
1.214     momjian   963: ac_cv_func_fseeko=yes
                    964: esac
                    965: 
1.222     momjian   966: # Solaris has a very slow qsort in certain cases, so we replace it.
1.376     momjian   967: if test "$PORTNAME" = "solaris"; then
                    968: AC_LIBOBJ(qsort)
                    969: fi
1.243     momjian   970: 
1.319     momjian   971: # Win32 support
1.376     momjian   972: if test "$PORTNAME" = "win32"; then
1.312     momjian   973: AC_LIBOBJ(copydir)
1.310     momjian   974: AC_LIBOBJ(gettimeofday)
1.359     momjian   975: AC_LIBOBJ(kill)
1.322     momjian   976: AC_LIBOBJ(open)
1.372     momjian   977: AC_LIBOBJ(rand)
                    978: AC_DEFINE([HAVE_SYMLINK], 1,
                    979:           [Define to 1 if you have the `symlink' function.])
1.376     momjian   980: fi
1.313     momjian   981: 
1.177     petere    982: if test "$with_readline" = yes; then
                    983:   PGAC_VAR_RL_COMPLETION_APPEND_CHARACTER
                    984:   AC_CHECK_FUNCS([rl_completion_matches rl_filename_completion_function])
1.237     momjian   985:   AC_CHECK_FUNCS([replace_history_entry])
1.177     petere    986: fi
1.1       petere    987: 
                    988: 
                    989: dnl Cannot use AC_CHECK_FUNC because finite may be a macro
                    990: AC_MSG_CHECKING(for finite)
1.398.4.10  tgl       991: AC_TRY_LINK([
                    992: #include <math.h>
                    993: double glob_double;
                    994: ],
                    995:             [return finite(glob_double) ? 0 : 1;],
1.242     petere    996:             [AC_DEFINE(HAVE_FINITE, 1, [Define to 1 if you have finite().])
1.171     petere    997: AC_MSG_RESULT(yes)],
                    998:             [AC_MSG_RESULT(no)])
1.1       petere    999: 
                   1000: dnl Cannot use AC_CHECK_FUNC because sigsetjmp may be a macro
                   1001: dnl (especially on GNU libc)
1.242     petere   1002: dnl See also comments in c.h.
1.1       petere   1003: AC_MSG_CHECKING(for sigsetjmp)
                   1004: AC_TRY_LINK([#include <setjmp.h>],
1.171     petere   1005:             [sigjmp_buf x; sigsetjmp(x, 1);],
1.242     petere   1006:             [AC_DEFINE(HAVE_SIGSETJMP, 1, [Define to 1 if you have sigsetjmp().])
1.171     petere   1007: AC_MSG_RESULT(yes)],
                   1008:             [AC_MSG_RESULT(no)])
1.1       petere   1009: 
1.222     momjian  1010: AC_CHECK_FUNC(syslog,
1.242     petere   1011:               [AC_CHECK_HEADER(syslog.h,
                   1012:                                [AC_DEFINE(HAVE_SYSLOG, 1, [Define to 1 if you have the syslog interface.])])])
1.1       petere   1013: 
1.76      petere   1014: AC_CACHE_CHECK([for optreset], pgac_cv_var_int_optreset,
                   1015: [AC_TRY_LINK([#include <unistd.h>],
                   1016:   [extern int optreset; optreset = 1;],
                   1017:   [pgac_cv_var_int_optreset=yes],
                   1018:   [pgac_cv_var_int_optreset=no])])
                   1019: if test x"$pgac_cv_var_int_optreset" = x"yes"; then
1.242     petere   1020:   AC_DEFINE(HAVE_INT_OPTRESET, 1, [Define to 1 if you have the global variable 'int optreset'.])
1.76      petere   1021: fi
                   1022: 
1.194     petere   1023: AC_CHECK_FUNCS([strtoll strtoq], [break])
                   1024: AC_CHECK_FUNCS([strtoull strtouq], [break])
                   1025: 
                   1026: # Check for one of atexit() or on_exit()
                   1027: AC_CHECK_FUNCS(atexit, [],
                   1028:                [AC_CHECK_FUNCS(on_exit, [],
1.225     momjian  1029:                [AC_MSG_ERROR([neither atexit() nor on_exit() found])])])
1.213     momjian  1030: 
1.195     petere   1031: AC_FUNC_FSEEKO
1.266     momjian  1032: 
                   1033: #
                   1034: # Pthreads
                   1035: #
                   1036: # For each platform, we need to know about any special compile and link
                   1037: # libraries, and whether the normal C function names are thread-safe.
1.281     momjian  1038: # See the comment at the top of src/port/thread.c for more information.
1.266     momjian  1039: #
1.271     momjian  1040: if test "$enable_thread_safety" = yes; then
1.324     momjian  1041: ACX_PTHREAD    # set thread flags
1.334     momjian  1042: 
                   1043: # Some platforms use these, so just defineed them.  They can't hurt if they
                   1044: # are not supported.
                   1045: PTHREAD_CFLAGS="$PTHREAD_CFLAGS -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS"
                   1046: 
1.324     momjian  1047: 
                   1048: # At this point, we don't want to muck with the compiler name for threading.
                   1049: # Let's see who fails, perhaps AIX.  2004-04-23
                   1050: if test "$PTHREAD_CC" != "$CC"; then
                   1051: AC_MSG_ERROR([
                   1052: PostgreSQL does not support platforms that require a special
                   1053: compiler binary for thread-safety.
                   1054: ])
                   1055: fi
1.266     momjian  1056: 
1.324     momjian  1057: if test "$THREAD_SUPPORT" = no; then
1.266     momjian  1058: AC_MSG_ERROR([
                   1059: Cannot enable threads on your platform.
1.324     momjian  1060: Your platform is known to not support thread-safe programs.
                   1061: For details, compile and run src/bin/pg_thread_test.
1.266     momjian  1062: ])
                   1063: fi
1.262     momjian  1064: 
1.316     momjian  1065: # Check for *_r functions
1.262     momjian  1066: _CFLAGS="$CFLAGS"
1.275     momjian  1067: _LIBS="$LIBS"
1.324     momjian  1068: CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
                   1069: LIBS="$LIBS $PTHREAD_LIBS"
1.384     momjian  1070: 
                   1071: AC_CHECK_HEADER(pthread.h, [], [AC_MSG_ERROR([pthread.h not found, required for --enable-thread-safety])])
                   1072: 
1.288     momjian  1073: AC_CHECK_FUNCS([strerror_r getpwuid_r gethostbyname_r])
1.321     momjian  1074: 
1.364     momjian  1075: # Do test here with the proper thread flags
1.321     momjian  1076: PGAC_FUNC_GETPWUID_R_5ARG
1.361     momjian  1077: PGAC_FUNC_STRERROR_R_INT
1.363     momjian  1078: 
                   1079: CFLAGS="$_CFLAGS"
                   1080: LIBS="$_LIBS"
1.316     momjian  1081: 
                   1082: else
                   1083: # do not use values from template file
1.324     momjian  1084: PTHREAD_CFLAGS=
                   1085: PTHREAD_LIBS=
1.263     momjian  1086: fi
1.316     momjian  1087: 
1.324     momjian  1088: AC_SUBST(PTHREAD_CFLAGS)
                   1089: AC_SUBST(PTHREAD_LIBS)
1.195     petere   1090: 
1.109     petere   1091: 
                   1092: # This test makes sure that run tests work at all.  Sometimes a shared
                   1093: # library is found by the linker, but the runtime linker can't find it.
                   1094: # This check should come after all modifications of compiler or linker
                   1095: # variables, and before any other run tests.
                   1096: AC_MSG_CHECKING([test program])
                   1097: AC_TRY_RUN([int main() { return 0; }],
                   1098: [AC_MSG_RESULT(ok)],
                   1099: [AC_MSG_RESULT(failed)
                   1100: AC_MSG_ERROR([[
                   1101: *** Could not execute a simple test program.  This may be a problem
                   1102: *** related to locating shared libraries.  Check the file 'config.log'
                   1103: *** for the exact reason.]])],
                   1104: [AC_MSG_RESULT([cross-compiling])])
                   1105: 
                   1106: 
1.1       petere   1107: dnl Check to see if we have a working 64-bit integer type.
                   1108: dnl This breaks down into two steps:
                   1109: dnl (1) figure out if the compiler has a 64-bit int type with working
                   1110: dnl arithmetic, and if so
                   1111: dnl (2) see whether snprintf() can format the type correctly.  (Currently,
                   1112: dnl snprintf is the only library routine we really need for int8 support.)
                   1113: dnl It's entirely possible to have a compiler that handles a 64-bit type
                   1114: dnl when the C library doesn't; this is fairly likely when using gcc on
                   1115: dnl an older platform, for example.
                   1116: dnl If there is no native snprintf() or it does not handle the 64-bit type,
                   1117: dnl we force our own version of snprintf() to be used instead.
                   1118: dnl Note this test must be run after our initial check for snprintf/vsnprintf.
                   1119: 
1.6       petere   1120: PGAC_TYPE_64BIT_INT([long int])
1.1       petere   1121: 
1.6       petere   1122: if test x"$HAVE_LONG_INT_64" = x"no" ; then
                   1123:   PGAC_TYPE_64BIT_INT([long long int])
                   1124: fi
1.1       petere   1125: 
                   1126: 
1.112     tgl      1127: dnl If we need to use "long long int", figure out whether nnnLL notation works.
                   1128: 
1.201     momjian  1129: if test x"$HAVE_LONG_LONG_INT_64" = xyes ; then
1.112     tgl      1130:   AC_TRY_COMPILE([
                   1131: #define INT64CONST(x)  x##LL
                   1132: long long int foo = INT64CONST(0x1234567890123456);
                   1133: ],
                   1134:        [],
1.242     petere   1135:        [AC_DEFINE(HAVE_LL_CONSTANTS, 1, [Define to 1 if constants of type 'long long int' should have the suffix LL.])],
1.112     tgl      1136:        [])
                   1137: fi
                   1138: 
                   1139: 
1.234     petere   1140: # If we found "long int" is 64 bits, assume snprintf handles it.  If
                   1141: # we found we need to use "long long int", better check.  We cope with
1.314     tgl      1142: # snprintfs that use %lld, %qd, or %I64d as the format.  If none of these
                   1143: # work, fall back to our own snprintf emulation (which we know uses %lld).
1.1       petere   1144: 
1.234     petere   1145: if test "$HAVE_LONG_LONG_INT_64" = yes ; then
1.194     petere   1146:   if test $pgac_need_repl_snprintf = no; then
1.234     petere   1147:     PGAC_FUNC_SNPRINTF_LONG_LONG_INT_FORMAT
                   1148:     if test "$LONG_LONG_INT_FORMAT" = ""; then
                   1149:       # Force usage of our own snprintf, since system snprintf is broken
                   1150:       pgac_need_repl_snprintf=yes
                   1151:       LONG_LONG_INT_FORMAT='%lld'
                   1152:     fi
1.1       petere   1153:   else
1.234     petere   1154:     # Here if we previously decided we needed to use our own snprintf
                   1155:     LONG_LONG_INT_FORMAT='%lld'
1.1       petere   1156:   fi
1.314     tgl      1157:   LONG_LONG_UINT_FORMAT=`echo "$LONG_LONG_INT_FORMAT" | sed 's/d$/u/'`
1.234     petere   1158:   INT64_FORMAT="\"$LONG_LONG_INT_FORMAT\""
1.314     tgl      1159:   UINT64_FORMAT="\"$LONG_LONG_UINT_FORMAT\""
1.1       petere   1160: else
                   1161:   # Here if we are not using 'long long int' at all
                   1162:   INT64_FORMAT='"%ld"'
1.314     tgl      1163:   UINT64_FORMAT='"%lu"'
1.1       petere   1164: fi
                   1165: 
1.171     petere   1166: AC_DEFINE_UNQUOTED(INT64_FORMAT, $INT64_FORMAT,
1.242     petere   1167:                    [Define to the appropriate snprintf format for 64-bit ints, if any.])
1.314     tgl      1168: 
                   1169: AC_DEFINE_UNQUOTED(UINT64_FORMAT, $UINT64_FORMAT,
                   1170:                    [Define to the appropriate snprintf format for unsigned 64-bit ints, if any.])
1.1       petere   1171: 
1.194     petere   1172: if test $pgac_need_repl_snprintf = yes; then
                   1173:   AC_LIBOBJ(snprintf)
                   1174: fi
1.78      petere   1175: 
1.242     petere   1176: # Need a #define for the size of Datum (unsigned long)
1.171     petere   1177: AC_CHECK_SIZEOF([unsigned long])
1.84      tgl      1178: 
1.171     petere   1179: # Determine memory alignment requirements for the basic C data types.
1.1       petere   1180: 
1.6       petere   1181: PGAC_CHECK_ALIGNOF(short)
                   1182: PGAC_CHECK_ALIGNOF(int)
                   1183: PGAC_CHECK_ALIGNOF(long)
1.171     petere   1184: if test x"$HAVE_LONG_LONG_INT_64" = x"yes" ; then
1.6       petere   1185:   PGAC_CHECK_ALIGNOF(long long int)
1.1       petere   1186: fi
1.6       petere   1187: PGAC_CHECK_ALIGNOF(double)
1.1       petere   1188: 
1.171     petere   1189: # Compute maximum alignment of any basic type.
                   1190: # We assume long's alignment is at least as strong as char, short, or int;
                   1191: # but we must check long long (if it exists) and double.
                   1192: 
                   1193: MAX_ALIGNOF=$pgac_cv_alignof_long
                   1194: if test $MAX_ALIGNOF -lt $pgac_cv_alignof_double ; then
                   1195:   MAX_ALIGNOF=$pgac_cv_alignof_double
                   1196: fi
                   1197: if test x"$HAVE_LONG_LONG_INT_64" = xyes && test $MAX_ALIGNOF -lt $pgac_cv_alignof_long_long_int ; then
                   1198:   MAX_ALIGNOF="$pgac_cv_alignof_long_long_int"
1.1       petere   1199: fi
1.242     petere   1200: AC_DEFINE_UNQUOTED(MAXIMUM_ALIGNOF, $MAX_ALIGNOF, [Define as the maximum alignment requirement of any C data type.])
1.1       petere   1201: 
1.155     petere   1202: 
1.152     momjian  1203: # Some platforms predefine the types int8, int16, etc.  Only check
1.171     petere   1204: # a (hopefully) representative subset.
                   1205: AC_CHECK_TYPES([int8, uint8, int64, uint64], [], [],
                   1206: [#include <stdio.h>
1.155     petere   1207: #ifdef HAVE_SUPPORTDEFS_H
                   1208: #include <SupportDefs.h>
1.171     petere   1209: #endif])
1.155     petere   1210: 
1.171     petere   1211: # We also check for sig_atomic_t, which *should* be defined per ANSI
                   1212: # C, but is missing on some old platforms.
1.223     momjian  1213: AC_CHECK_TYPES(sig_atomic_t, [], [], [#include <signal.h>])
1.155     petere   1214: 
1.152     momjian  1215: 
1.6       petere   1216: PGAC_FUNC_POSIX_SIGNALS
1.388     momjian  1217: if test "$pgac_cv_func_posix_signals" != yes -a "$enable_thread_safety" = yes; then
                   1218:   AC_MSG_ERROR([
                   1219: *** Thread-safety requires POSIX signals, which are not supported by your
                   1220: *** operating system.
                   1221: ])
                   1222: fi
                   1223: 
1.195     petere   1224: if test $ac_cv_func_fseeko = yes; then
                   1225: AC_SYS_LARGEFILE
                   1226: fi
1.172     petere   1227: 
                   1228: 
1.184     tgl      1229: # Select semaphore implementation type.
                   1230: if test x"$USE_NAMED_POSIX_SEMAPHORES" = x"1" ; then
1.242     petere   1231:   AC_DEFINE(USE_NAMED_POSIX_SEMAPHORES, 1, [Define to select named POSIX semaphores.])
1.184     tgl      1232:   SEMA_IMPLEMENTATION="src/backend/port/posix_sema.c"
                   1233: else
                   1234:   if test x"$USE_UNNAMED_POSIX_SEMAPHORES" = x"1" ; then
1.242     petere   1235:     AC_DEFINE(USE_UNNAMED_POSIX_SEMAPHORES, 1, [Define to select unnamed POSIX semaphores.])
1.184     tgl      1236:     SEMA_IMPLEMENTATION="src/backend/port/posix_sema.c"
                   1237:   else
1.242     petere   1238:     AC_DEFINE(USE_SYSV_SEMAPHORES, 1, [Define to select SysV-style semaphores.])
1.184     tgl      1239:     SEMA_IMPLEMENTATION="src/backend/port/sysv_sema.c"
                   1240:   fi
                   1241: fi
                   1242: 
                   1243: 
                   1244: # Select shared-memory implementation type.
1.242     petere   1245: AC_DEFINE(USE_SYSV_SHARED_MEMORY, 1, [Define to select SysV-style shared memory.])
1.184     tgl      1246: SHMEM_IMPLEMENTATION="src/backend/port/sysv_shmem.c"
                   1247: 
                   1248: 
1.172     petere   1249: if test "$enable_nls" = yes ; then
                   1250:   PGAC_CHECK_GETTEXT
                   1251: fi
1.1       petere   1252: 
1.43      petere   1253: # Check for Tcl configuration script tclConfig.sh
                   1254: if test "$with_tcl" = yes; then
                   1255:     PGAC_PATH_TCLCONFIGSH([$with_tclconfig])
1.185     petere   1256:     PGAC_EVAL_TCLCONFIGSH([$TCL_CONFIG_SH],
1.235     petere   1257:                           [TCL_INCLUDE_SPEC,TCL_LIB_FILE,TCL_LIBS,TCL_LIB_SPEC,TCL_SHARED_BUILD])
1.185     petere   1258:     AC_SUBST(TCL_SHLIB_LD_LIBS)dnl don't want to double-evaluate that one
1.391     tgl      1259:     # now that we have TCL_INCLUDE_SPEC, we can check for <tcl.h>
                   1260:     ac_save_CPPFLAGS=$CPPFLAGS
                   1261:     CPPFLAGS="$TCL_INCLUDE_SPEC $CPPFLAGS"
                   1262:     AC_CHECK_HEADER(tcl.h, [], [AC_MSG_ERROR([header file <tcl.h> is required for Tcl])])
                   1263:     CPPFLAGS=$ac_save_CPPFLAGS
1.43      petere   1264: fi
1.1       petere   1265: 
1.75      petere   1266: #
                   1267: # Check for DocBook and tools
                   1268: #
                   1269: PGAC_PROG_NSGMLS
1.178     petere   1270: PGAC_PROG_JADE
1.305     petere   1271: PGAC_CHECK_DOCBOOK(4.2)
1.178     petere   1272: PGAC_PATH_DOCBOOK_STYLESHEETS
                   1273: PGAC_PATH_COLLATEINDEX
                   1274: AC_CHECK_PROGS(SGMLSPL, sgmlspl)
1.75      petere   1275: 
1.337     momjian  1276: # Thread testing
                   1277: 
                   1278: # We have to run the thread test near the end so we have all our symbols
                   1279: # defined.  Cross compiling throws a warning.
                   1280: #
1.366     momjian  1281: if test "$enable_thread_safety_force" = yes; then
                   1282:   AC_MSG_WARN([
                   1283: *** Skipping thread test program.  --enable-thread-safety-force was used.
                   1284: *** Run the program in src/tools/thread on the your machine and add
                   1285: proper locking function calls to your applications to guarantee thread
                   1286: safety.
                   1287: ])
                   1288: elif test "$enable_thread_safety" = yes; then
1.337     momjian  1289: AC_MSG_CHECKING([thread safety of required library functions])
                   1290: 
                   1291: _CFLAGS="$CFLAGS"
                   1292: _LIBS="$LIBS"
                   1293: CFLAGS="$CFLAGS $PTHREAD_CFLAGS -DIN_CONFIGURE"
                   1294: LIBS="$LIBS $PTHREAD_LIBS"
1.338     momjian  1295: AC_TRY_RUN([#include "$srcdir/src/tools/thread/thread_test.c"],
1.337     momjian  1296:   [AC_MSG_RESULT(yes)],
                   1297:   [AC_MSG_RESULT(no)
1.339     momjian  1298:   AC_MSG_ERROR([
1.398.4.28  petere   1299: *** Thread test program failed.  Your platform is not thread-safe.
                   1300: *** Check the file 'config.log' for the exact reason.
1.366     momjian  1301: ***
                   1302: *** You can use the configure option --enable-thread-safety-force
                   1303: *** to force threads to be enabled.  However, you must then run
                   1304: *** the program in src/tools/thread and add locking function calls
                   1305: *** to your applications to guarantee thread safety.
                   1306: ])],
1.337     momjian  1307:   [AC_MSG_RESULT(maybe)
                   1308:   AC_MSG_WARN([
                   1309: *** Skipping thread test program because of cross-compile build.
1.366     momjian  1310: *** Run the program in src/tools/thread on the target machine.
1.337     momjian  1311: ])])
                   1312: CFLAGS="$_CFLAGS"
                   1313: LIBS="$_LIBS"
                   1314: fi
1.61      petere   1315: 
1.104     petere   1316: # prepare build tree if outside source tree
1.138     petere   1317: # Note 1: test -ef might not exist, but it's more reliable than `pwd`.
                   1318: # Note 2: /bin/pwd might be better than shell's built-in at getting
                   1319: #         a symlink-free name.
1.306     petere   1320: if ( test "$srcdir" -ef . ) >/dev/null 2>&1 || test "`cd $srcdir && /bin/pwd`" = "`/bin/pwd`"; then
                   1321:   vpath_build=no
                   1322: else
                   1323:   vpath_build=yes
                   1324:   if test "$no_create" != yes; then
1.171     petere   1325:     _AS_ECHO_N([preparing build tree... ])
                   1326:     pgac_abs_top_srcdir=`cd "$srcdir" && pwd`
                   1327:     $SHELL "$ac_aux_dir/prep_buildtree" "$pgac_abs_top_srcdir" "." \
1.104     petere   1328:       || AC_MSG_ERROR(failed)
                   1329:     AC_MSG_RESULT(done)
1.171     petere   1330:   fi
1.61      petere   1331: fi
1.306     petere   1332: AC_SUBST(vpath_build)
1.1       petere   1333: 
1.171     petere   1334: 
                   1335: AC_CONFIG_FILES([GNUmakefile src/Makefile.global])
                   1336: 
                   1337: AC_CONFIG_LINKS([
                   1338:   src/backend/port/dynloader.c:src/backend/port/dynloader/${template}.c
1.184     tgl      1339:   src/backend/port/pg_sema.c:${SEMA_IMPLEMENTATION}
                   1340:   src/backend/port/pg_shmem.c:${SHMEM_IMPLEMENTATION}
1.171     petere   1341:   src/include/dynloader.h:src/backend/port/dynloader/${template}.h
                   1342:   src/include/pg_config_os.h:src/include/port/${template}.h
                   1343:   src/Makefile.port:src/makefiles/Makefile.${template}
                   1344: ])
1.347     momjian  1345: 
1.376     momjian  1346: if test "$PORTNAME" = "win32"; then
1.350     momjian  1347: AC_CONFIG_COMMANDS([check_win32_symlinks],[
1.347     momjian  1348: # Links sometimes fail undetected on Mingw - 
                   1349: # so here we detect it and warn the user
1.360     momjian  1350: for FILE in $CONFIG_LINKS
1.347     momjian  1351:  do
                   1352:        # test -e works for symlinks in the MinGW console
1.362     momjian  1353:        test -e `expr "$FILE" : '\([[^:]]*\)'` || AC_MSG_WARN([*** link for $FILE - please fix by hand])
1.347     momjian  1354:  done
1.349     momjian  1355: ])
1.376     momjian  1356: fi
1.349     momjian  1357: 
                   1358: AC_CONFIG_HEADERS([src/include/pg_config.h],
                   1359: [
                   1360: # Update timestamp for pg_config.h (see Makefile.global)
                   1361: echo >src/include/stamp-h
                   1362: ])
                   1363: 
                   1364: AC_OUTPUT
1.171     petere   1365: 

PostgreSQL CVSweb <[email protected]>