Annotation of pgsql/configure.in, revision 1.13

1.1       petere      1: dnl Process this file with autoconf to produce a configure script.
                      2: AC_INIT(src/backend/access/common/heaptuple.c)
                      3: AC_PREFIX_DEFAULT(/usr/local/pgsql)
                      4: AC_CONFIG_HEADER(src/include/config.h)
                      5: 
                      6: AC_PREREQ(2.13)
1.5       petere      7: AC_CONFIG_AUX_DIR(`pwd`/config)
                      8: 
                      9: mkinstalldirs="\$(SHELL) \$(top_srcdir)/config/mkinstalldirs"
                     10: AC_SUBST(mkinstalldirs)
1.1       petere     11: 
                     12: AC_CANONICAL_HOST
                     13: 
                     14: tas_file=dummy.s
                     15: case "$host_os" in
                     16:  solaris*)
                     17:        case "$host_cpu" in
                     18:          sparc) os=solaris_sparc need_tas=yes tas_file=solaris_sparc.s ;;
                     19:           i386) os=solaris_i386 need_tas=yes tas_file=solaris_i386.s ;;
                     20:        esac ;;
                     21:    sunos*) os=sunos4 need_tas=no ;;
                     22:      beos) os=beos need_tas=no ;;
                     23:      aux*) os=aux need_tas=no ;;
                     24:    linux*) os=linux need_tas=no ;;
                     25:     bsdi*) os=bsdi need_tas=no ;;
                     26:  freebsd1*|freebsd2*) os=freebsd need_tas=no ;;
                     27:  freebsd*) os=freebsd need_tas=no elf=yes ;;
                     28:   netbsd*) os=netbsd need_tas=no ;;
                     29:   openbsd*) os=bsd need_tas=no ;;
                     30:     dgux*) os=dgux need_tas=no ;;
                     31:      aix*) os=aix need_tas=no ;;
                     32: nextstep*) os=nextstep need_tas=no ;;
                     33:   ultrix*) os=ultrix4 need_tas=no ;;
                     34:     irix*) os=irix5 need_tas=no ;;
                     35:     hpux*) os=hpux need_tas=yes tas_file=hpux.s ;;
                     36:      osf*) os=alpha need_tas=no ;;
                     37:      sco*) os=sco need_tas=no ;;
                     38:  machten*) os=machten need_tas=no ;;
                     39:   cygwin*) os=win need_tas=no ;;
                     40:  sysv4.2*)
                     41:        case "$host_vendor" in
                     42:               univel) os=univel need_tas=no ;;
                     43:                    *) os=unknown need_tas=no ;;
                     44:        esac ;;
                     45:    sysv4*) os=svr4 need_tas=no ;;
                     46:    sysv5uw*) os=unixware need_tas=no ;;
                     47:    unixware*) os=unixware need_tas=no ;;
                     48:     qnx*) os=qnx4 need_tas=no ;;
                     49: *) echo ""
                     50:    echo "*************************************************************"
                     51:    echo "configure does not currently recognize your operating system,"
                     52:    echo "therefore you must do a manual configuration of:"
                     53:    echo "$host_os"
                     54:    echo "Please contact [email protected] to see about rectifying this, "
                     55:    echo "including the above 'checking host system type...' line "
                     56:    echo "*************************************************************"
                     57:    echo ""
                     58:    exit;;
                     59: esac
                     60: 
                     61: PORTNAME=${os}
                     62: CPU=${host_cpu}
                     63: AC_LINK_FILES(src/backend/port/dynloader/${os}.c, src/backend/port/dynloader.c)
                     64: AC_LINK_FILES(src/backend/port/dynloader/${os}.h, src/include/dynloader.h)
                     65: AC_LINK_FILES(src/include/port/${os}.h, src/include/os.h)
                     66: AC_LINK_FILES(src/makefiles/Makefile.${os}, src/Makefile.port)
                     67: 
                     68: if test "X$need_tas" = "Xyes"
                     69: then
                     70:        AC_LINK_FILES(src/backend/port/tas/${tas_file}, src/backend/port/tas.s)
                     71:        TAS=tas.o
                     72:        AC_SUBST(TAS)
                     73: fi
                     74: 
                     75: dnl this part selects the template from the ones in the template directory.
                     76: 
                     77: AC_MSG_CHECKING(setting template to)
                     78: AC_ARG_WITH(template,
                     79:     [  --with-template=TEMPLATE
                     80:                           use operating system template file 
                     81:                               see template directory],
                     82:     [  TEMPLATE=$withval ],
                     83:     [
                     84: 
                     85: # lowercase $host
                     86: host="`echo $host | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`"
                     87: 
                     88: # First, try for a template exactly matching $host
                     89: if test -f "src/template/$host"
                     90: then TEMPLATE="$host"
                     91: else
                     92:     # Scan template/.similar for a rule that tells us which template to use.
                     93:     # The format of each line of the file is
                     94:     #           hostnamepattern=templatefilename
                     95:     # where the hostnamepattern is evaluated per the rules of expr(1) ---
                     96:     # namely, it is a standard regular expression with an implicit ^ at the
                     97:     # start.  If multiple lines match, we will end up using the last match.
                     98:     #
                     99:     # The tempfile hackery is needed because some shells will run the loop
                    100:     # inside a subshell, whereupon shell variables set therein aren't seen
                    101:     # outside the loop :-(
                    102:     TMPFILE="guesses.$$"
                    103:     cat /dev/null > $TMPFILE
                    104:     while read LINE
                    105:     do
                    106:        SIMHOST=`expr "$LINE" : '\(.*\)='`
                    107:        MATCH=`expr "$host" : "$SIMHOST"`
                    108:        if test "$MATCH" != 0
                    109:        then
                    110:            echo "$LINE" | sed 's/^.*=//' > $TMPFILE
                    111:        fi
                    112:     done <src/template/.similar
                    113:     GUESS=`cat $TMPFILE`
                    114:     rm -f $TMPFILE
                    115:     if test "$GUESS"
                    116:     then TEMPLATE="$GUESS"
                    117:     else
                    118:        # Last chance ... maybe uname -s will match an entry.
                    119:        TEMPLATE=`uname -s | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
                    120:     fi
                    121: fi
                    122:     ])
                    123: AC_MSG_RESULT($TEMPLATE)
                    124: 
                    125: export TEMPLATE
                    126: if test ! -f "src/template/$TEMPLATE"; then
                    127:        echo ""
                    128:        echo "$TEMPLATE does not exist"
                    129:        echo ""
                    130:        echo "Available Templates (select one using --with-template):"
                    131:        echo ""
                    132:        ls template
                    133:        echo ""
                    134:        exit
                    135: fi
                    136: 
                    137: dnl Read the selected template file.
                    138: dnl For reasons of backwards compatibility, lines of the form
                    139: dnl     IDENTIFIER: something
                    140: dnl should be treated as variable assignments.  However, we also want to
                    141: dnl allow other shell commands in the template file (in case the file
                    142: dnl needs to make conditional tests, etc).  So, generate a temp file with
                    143: dnl the IDENTIFIER: lines translated, then source it.
                    144: 
                    145: [
                    146: rm -f conftest.sh
                    147: sed 's/^\([A-Za-z_]*\):\(.*\)$/\1="\2"/' "src/template/$TEMPLATE" >conftest.sh
                    148: . ./conftest.sh
                    149: rm -f conftest.sh
                    150: ]
                    151: 
1.13    ! petere    152: dnl
        !           153: dnl Add non-standard directories to the include path
        !           154: dnl
        !           155: AC_ARG_WITH(includes, [  --with-includes=DIRS    add non-standard include paths],
        !           156: [if test x"$withval" = x"yes" || test x"$withval" = x"no" ; then
        !           157:   AC_MSG_ERROR([You must supply an argument to the --with-includes option.])
        !           158: fi])
        !           159: 
        !           160: # SRCH_INC comes from the template file
        !           161: ac_save_IFS=$IFS
        !           162: IFS=':'
        !           163: for dir in $with_includes $SRCH_INC; do
        !           164:   if test -d "$dir"; then
        !           165:     INCLUDES="$INCLUDES -I$dir"
        !           166:   else
        !           167:     AC_MSG_WARN([*** Include directory $dir does not exist.])
        !           168:   fi
        !           169: done
        !           170: IFS=$ac_save_IFS
        !           171: AC_SUBST(INCLUDES)
1.1       petere    172: 
                    173: 
1.13    ! petere    174: dnl
        !           175: dnl Add non-standard directories to the library search path
        !           176: dnl
1.1       petere    177: AC_ARG_WITH(libraries,
                    178:     [  --with-libraries=DIRS   look for additional libraries in DIRS],
                    179:     [
                    180:        case "$withval" in
                    181:        "" | y | ye | yes | n | no)
                    182:            AC_MSG_ERROR([*** You must supply an argument to the --with-libraries option.])
                    183:          ;;
                    184:        esac
                    185:        LIBRARY_DIRS="$withval"
                    186:     ])
                    187: 
                    188: AC_ARG_WITH(libs,
                    189:     [  --with-libs=DIRS        alternate spelling of --with-libraries],
                    190:     [
                    191:        case "$withval" in
                    192:        "" | y | ye | yes | n | no)
                    193:            AC_MSG_ERROR([*** You must supply an argument to the --with-libs option.])
                    194:          ;;
                    195:        esac
                    196:        LIBRARY_DIRS="$withval"
                    197:     ])
                    198: 
                    199: dnl LIBRARY_DIRS comes from command line, SRCH_LIB from template file.
                    200: dnl Each can name one or more directories.
                    201: if test "$LIBRARY_DIRS" -o "$SRCH_LIB"; then
                    202:        for dir in $LIBRARY_DIRS $SRCH_LIB; do
                    203:                if test -d "$dir"; then
                    204:                        PGSQL_LDFLAGS="$PGSQL_LDFLAGS -L$dir"
                    205:                else
                    206:                        AC_MSG_WARN([*** Library directory $dir does not exist.])
                    207:                fi
                    208:        done
                    209: fi
                    210: 
1.2       petere    211: 
1.1       petere    212: AC_MSG_CHECKING(whether to support locale)
                    213: AC_ARG_ENABLE(
                    214:    locale,
                    215:    [  --enable-locale         enable locale support ],
1.2       petere    216:    [AC_DEFINE(USE_LOCALE) AC_MSG_RESULT(enabled)],
1.1       petere    217:    AC_MSG_RESULT(disabled)
                    218: )
                    219: 
                    220: dnl We exclude cyrillic recode support unless we override it with
                    221: dnl    --enable-recode to explicitly enable it
                    222: dnl It defaults to disabled
                    223: AC_MSG_CHECKING(whether to support cyrillic recode)
                    224: AC_ARG_ENABLE(
                    225:    recode,
                    226:    [  --enable-recode         enable cyrillic recode support ],
1.2       petere    227:    [AC_DEFINE(CYR_RECODE) AC_MSG_RESULT(enabled)],
1.1       petere    228:    AC_MSG_RESULT(disabled)
                    229: )
                    230: 
                    231: dnl Multibyte support
                    232: 
                    233: AC_MSG_CHECKING(whether to support multibyte)
                    234: AC_ARG_ENABLE(multibyte,
                    235:     [  --enable-multibyte      enable multibyte character support ], 
                    236:     [
                    237:         MULTIBYTE=SQL_ASCII
                    238:         if test "$enableval" != "yes"; then
                    239:                 case "$enableval" in
                    240:                         SQL_ASCII|EUC_JP|EUC_CN|EUC_KR|EUC_TW|UNICODE|MULE_INTERNAL|LATIN1|LATIN2|LATIN3|LATIN4|LATIN5|KOI8|WIN|ALT)
                    241:                         # ok
                    242:                         ;;
                    243:                 *)
                    244:                         AC_MSG_ERROR(
                    245: [Argument to --enable-multibyte must be one of:
                    246:   SQL_ASCII, EUC_JP, EUC_CN, EUC_KR, EUC_TW,
                    247:   UNICODE, MULE_INTERNAL,
                    248:   LATIN1, LATIN2, LATIN3, LATIN4, LATIN5,
                    249:   KOI8, WIN, ALT
                    250: Or do not specify an argument to the option to use the default.])
                    251:                 esac
                    252:                 MULTIBYTE=$enableval
                    253:         fi
                    254:         AC_DEFINE(MULTIBYTE)
                    255:         AC_MSG_RESULT(enabled)
                    256:     ],
                    257:     AC_MSG_RESULT("disabled")
                    258: )
                    259: 
                    260: dnl Old option variant
1.4       tgl       261: if test "${with_mb}"; then
1.1       petere    262:   AC_MSG_ERROR([--with-mb is not supported anymore. Use --enable-multibyte instead.])
1.4       tgl       263: fi
1.1       petere    264: 
                    265: 
                    266: dnl We use the default value of 5432 for the DEF_PGPORT value. If
                    267: dnl we over-ride it with --with-pgport=port then we bypass this piece
                    268: AC_MSG_CHECKING(setting DEF_PGPORT)
                    269: AC_ARG_WITH(
                    270:    pgport,
                    271:    [  --with-pgport=PORTNUM   change default postmaster port ],
                    272:    [default_port="$withval"],
                    273:    [default_port=5432]
                    274: )
1.4       tgl       275: dnl Need both of these because backend wants an integer and frontend a string
1.1       petere    276: AC_DEFINE_UNQUOTED(DEF_PGPORT, ${default_port})
                    277: AC_DEFINE_UNQUOTED(DEF_PGPORT_STR, "${default_port}")
                    278: AC_MSG_RESULT(${default_port})
                    279: 
                    280: 
                    281: dnl DEF_MAXBACKENDS can be set by --with-maxbackends.  Default value is 32.
                    282: AC_MSG_CHECKING(setting DEF_MAXBACKENDS)
                    283: AC_ARG_WITH(
                    284:    maxbackends,
                    285:    [  --with-maxbackends=N    set default maximum number of server processes ],
                    286:    AC_DEFINE_UNQUOTED(DEF_MAXBACKENDS, ${withval}) AC_MSG_RESULT($with_maxbackends),
                    287:    AC_DEFINE_UNQUOTED(DEF_MAXBACKENDS, 32) AC_MSG_RESULT(32)
                    288: )
                    289: 
1.4       tgl       290: 
                    291: dnl Check for C support (allow override if needed)
                    292: dnl Note: actually, setting CC environment variable works just as well.
                    293: AC_ARG_WITH(CC,
                    294:     [  --with-CC=compiler      use specific C compiler],
                    295:     [
                    296:        case "$withval" in
                    297:        "" | y | ye | yes | n | no)
                    298:            AC_MSG_ERROR([*** You must supply an argument to the --with-CC option.])
                    299:          ;;
                    300:        esac
                    301:        CC="$withval"
                    302:     ])
                    303: 
                    304: dnl Find a compiler if CC is not already set.
                    305: AC_PROG_CC
                    306: dnl Find CPP, then check traditional.
                    307: dnl Caution: these macros must be called in this order...
                    308: AC_PROG_CPP
                    309: AC_PROG_GCC_TRADITIONAL
1.6       petere    310: AC_SUBST(GCC)
1.4       tgl       311: 
                    312: if test "$CC" = "gcc"
                    313: then
                    314:        CC_VERSION=`${CC} --version`
                    315: else
                    316:        CC_VERSION=""
                    317: fi
                    318: AC_SUBST(CC_VERSION)
                    319: 
                    320: 
1.1       petere    321: dnl We exclude tcl support unless user says --with-tcl
                    322: AC_MSG_CHECKING(setting USE_TCL)
                    323: AC_ARG_WITH(
                    324:    tcl,
                    325:    [  --with-tcl              build Tcl interfaces and pgtclsh ],
                    326:    [
                    327:        case "$withval" in
                    328:        y | ye | yes)           USE_TCL=true; USE_TK=true; AC_MSG_RESULT(enabled) ;;
                    329:        *)                      USE_TCL=; USE_TK=; AC_MSG_RESULT(disabled) ;;
                    330:        esac
                    331:    ],
                    332:    [ USE_TCL=; USE_TK=; AC_MSG_RESULT(disabled) ]
                    333: )
                    334: 
                    335: export USE_TCL
                    336: export USE_TK
                    337: 
                    338: dnl We see if the path to the TCL/TK configuration scripts is specified.
                    339: dnl This will override the use of tclsh to find the paths to search.
                    340: 
                    341: AC_ARG_WITH(tclconfig,
                    342:     [  --with-tclconfig=DIR    tclConfig.sh and tkConfig.sh are in DIR],
                    343:     [
                    344:        case "$withval" in
                    345:        "" | y | ye | yes | n | no)
                    346:            AC_MSG_ERROR([*** You must supply an argument to the --with-tclconfig option.])
                    347:          ;;
                    348:        esac
                    349:        TCL_DIRS="$withval"
                    350:     ]
                    351: )
                    352: 
                    353: dnl We see if the path to the TK configuration scripts is specified.
                    354: dnl This will override the use of tclsh to find the paths to search.
                    355: 
                    356: AC_ARG_WITH(tkconfig,
                    357:     [  --with-tkconfig=DIR     tkConfig.sh is in DIR],
                    358:     [
                    359:        case "$withval" in
                    360:        "" | y | ye | yes | n | no)
                    361:            AC_MSG_ERROR([*** You must supply an argument to the --with-tkconfig option.])
                    362:          ;;
                    363:        esac
                    364:        TK_DIRS="$withval"
                    365:     ]
                    366: )
                    367: 
1.5       petere    368: 
                    369: dnl
                    370: dnl Optionally build Perl modules (Pg.pm and PL/Perl)
                    371: dnl
                    372: AC_MSG_CHECKING(whether to build Perl modules)
                    373: AC_ARG_WITH(perl, [  --with-perl             build Perl interface and plperl],
                    374: [if test x"${withval}" = x"yes" ; then
                    375:   AC_MSG_RESULT(yes)
                    376: else
                    377:   AC_MSG_RESULT(no)
                    378: fi],
                    379: [AC_MSG_RESULT(no)])
                    380: AC_SUBST(with_perl)
                    381: 
                    382: 
                    383: dnl
                    384: dnl Optionally build Python interface module
                    385: dnl
                    386: AC_MSG_CHECKING(whether to build Python modules)
                    387: AC_ARG_WITH(python, [  --with-python           build Python interface module],
                    388: [if test x"${withval}" = x"yes" ; then
                    389:   AC_MSG_RESULT(yes)
                    390:   PGAC_PROG_PYTHON
                    391:   PGAC_PATH_PYTHONDIR
                    392: else
                    393:   AC_MSG_RESULT(no)
                    394: fi],
                    395: [AC_MSG_RESULT(no)])
                    396: AC_SUBST(with_python)
1.1       petere    397: 
1.13    ! petere    398: 
        !           399: dnl
        !           400: dnl Optionally build with Kerberos 4 support
        !           401: dnl
        !           402: AC_MSG_CHECKING(whether to build with Kerberos 4 support)
        !           403: AC_ARG_WITH(krb4, [  --with-krb4[=DIR]       use Kerberos 4 [/usr/athena]],
        !           404: [if test x"$withval" != x"no"; then
        !           405:   # If the user didn't give an argument, we take the Kerberos 4 default
        !           406:   # path /usr/athena. We look into lib/ and include/ for the Kerberos
        !           407:   # libraries and includes. If the user has a more complicated layout
        !           408:   # he can use --with-includes and --with-libraries.
        !           409:   if test x"$withval" = x"yes"; then
        !           410:     krb4dir=/usr/athena
        !           411:   else
        !           412:     krb4dir=$withval
        !           413:   fi
        !           414:   with_krb4=yes
        !           415:   AC_MSG_RESULT(yes)
        !           416:   if test -d $krb4dir; then
        !           417:     if test -d "$krb4dir/include"; then
        !           418:       INCLUDES="$INCLUDES -I$krb4dir/include"
        !           419:     fi
        !           420:     if test -d "$krb4dir/lib"; then
        !           421:       krb_libdir="-L$krb4dir/lib"
        !           422:       LIBS="$krb_libdir $LIBS"
        !           423:     fi
        !           424:   fi
        !           425:   AC_CHECK_LIB(des, main, [], [AC_MSG_ERROR([library \`des' is required for Kerberos 4])])
        !           426:   AC_CHECK_LIB(krb, main, [], [AC_MSG_ERROR([library \`krb' is required for Kerberos 4])])
        !           427:   KRB_LIBS="$krb_libdir -lkrb -ldes"
        !           428:   AC_DEFINE(KRB4,, [Define if you are building with Kerberos 4 support.])
        !           429: else
        !           430:   AC_MSG_RESULT(no)
        !           431: fi],
        !           432: [AC_MSG_RESULT(no)])
        !           433: AC_SUBST(with_krb4)
        !           434: 
        !           435: 
        !           436: dnl
        !           437: dnl Optionally build with Kerberos 5 support
        !           438: dnl
        !           439: AC_MSG_CHECKING(whether to build with Kerberos 5 support)
        !           440: AC_ARG_WITH(krb5, [  --with-krb5[=DIR]       use Kerberos 5 [/usr/athena]],
        !           441: [if test x"$withval" != x"no"; then
        !           442:   if test x"$withval" = x"yes"; then
        !           443:     krb5dir=/usr/athena
        !           444:   else
        !           445:     krb5dir=$withval
        !           446:   fi
        !           447:   with_krb5=yes
        !           448:   AC_MSG_RESULT(yes)
        !           449:   if test -d $krb5dir; then
        !           450:     if test -d "$krb5dir/include"; then
        !           451:       INCLUDES="$INCLUDES -I$krb5dir/include"
        !           452:     fi
        !           453:     if test -d "$krb5dir/lib"; then
        !           454:       krb_libdir="-L$krb5dir/lib"
        !           455:       LIBS="$krb_libdir $LIBS"
        !           456:     fi
        !           457:   fi
        !           458:   AC_CHECK_LIB(com_err, main, [], [AC_MSG_ERROR([library \`com_err' is required for Kerberos 5])])
        !           459:   AC_CHECK_LIB(crypto, main, [], [AC_MSG_ERROR([library \`crypto' is required for Kerberos 5])])
        !           460:   AC_CHECK_LIB(krb5, main, [], [AC_MSG_ERROR([library \`krb5' is required for Kerberos 5])])
        !           461:   KRB_LIBS="$krb_libdir -lkrb5 -lcrypto -lcom_err"
        !           462:   AC_DEFINE(KRB5,, [Define if you are building with Kerberos 5 support.])
        !           463: else
        !           464:   AC_MSG_RESULT(no)
        !           465: fi],
        !           466: [AC_MSG_RESULT(no)])
        !           467: AC_SUBST(with_krb5)
        !           468: 
        !           469: dnl Necessary for special libpq link
        !           470: AC_SUBST(KRB_LIBS)
        !           471: 
        !           472: 
        !           473: dnl
        !           474: dnl Kerberos configuration parameters
        !           475: dnl
        !           476: AC_ARG_WITH(krb-srvnam, [  --with-krb-srvnam=NAME  name of the Postgres service principal in Kerberos],
        !           477: [if test x"$withval" = x"yes"; then
        !           478:   AC_MSG_ERROR([argument required for --with-krb-srvnam])
        !           479: else
        !           480:   krb_srvnam=$withval
        !           481: fi],
        !           482: [krb_srvnam="postgres"])
        !           483: AC_DEFINE_UNQUOTED(PG_KRB_SRVNAM, ["$krb_srvnam"], [The name of the Postgres service principal])
        !           484: 
        !           485: AC_ARG_WITH(krb-srvtab, [  --with-krb-srvtab=FILE  location of Kerberos server's keytab file],
        !           486: [if test x"$withval" = x"yes"; then
        !           487:   AC_MSG_ERROR([argument required for --with-krb-srvtab])
        !           488: else
        !           489:   krb_srvtab=$withval
        !           490: fi],
        !           491: [if test x"$with_krb5" = x"yes"; then
        !           492:   krb_srvtab="FILE:/usr/local/postgres/krb5.keytab"
        !           493: else
        !           494:   krb_srvtab="/etc/srvtab"
        !           495: fi])
        !           496: AC_DEFINE_UNQUOTED(PG_KRB_SRVTAB, ["$krb_srvtab"], [The location of the Kerberos server's keytab file])
        !           497: 
        !           498: 
        !           499: 
1.1       petere    500: dnl We include odbc support unless we disable it with --with-odbc=false
                    501: AC_MSG_CHECKING(setting USE_ODBC)
                    502: AC_ARG_WITH(
                    503:    odbc,
                    504:    [  --with-odbc             build ODBC driver package ],
                    505:    [
                    506:        case "$withval" in
                    507:        y | ye | yes)           USE_ODBC=true; AC_MSG_RESULT(enabled) ;;
                    508:        *)                      USE_ODBC=false; AC_MSG_RESULT(disabled) ;;
                    509:        esac
                    510:    ],
                    511:    [ USE_ODBC=false; AC_MSG_RESULT(disabled) ]
                    512: )
                    513: export USE_ODBC
                    514: 
1.8       momjian   515: dnl check if we want to use unixODBC to provide access to the odbc.ini
                    516: dnl files
                    517: 
                    518: use_unixODBC=no
                    519: AC_MSG_CHECKING(setting USE_UNIXODBC)
                    520: AC_ARG_WITH(
                    521:     unixODBC,
                    522:     [  --with-unixODBC[=DIR]   Use unixODBC located in DIR],
                    523:     [
                    524:         use_unixODBC=yes;
                    525:         unixODBC="$withval";
                    526:         USE_ODBC=true;
                    527:         AC_MSG_RESULT(enabled);
                    528:     ],
                    529:     [ USE_ODBC=false; use_unixODBC=no; AC_MSG_RESULT(disabled) ]
                    530: )
                    531: export USE_ODBC
1.1       petere    532: 
                    533: dnl Allow for overriding the default location of the odbcinst.ini
                    534: dnl file which is normally ${prefix}/share or ${prefix} if this is
                    535: dnl being compiled inside the postgres distribution.
                    536: dnl Link in the port and template directories
                    537: dnl to help build a "standalone ODBC" tar file
                    538: if test "X$USE_ODBC" = "Xtrue"
                    539: then
                    540:    AC_LINK_FILES(src/include/port, src/interfaces/odbc/port)
                    541:    AC_LINK_FILES(src/makefiles, src/interfaces/odbc/makefiles)
                    542:    AC_LINK_FILES(src/template, src/interfaces/odbc/template)
                    543:    AC_LINK_FILES(src/include/config.h, src/interfaces/odbc/config.h)
                    544: 
                    545:    AC_MSG_CHECKING(setting ODBCINST)
                    546:    AC_ARG_WITH(
                    547:       odbcinst,
                    548:       [  --with-odbcinst=DIR     change default directory for odbcinst.ini],
                    549:       AC_DEFINE_UNQUOTED(ODBCINST, ${with_odbcinst}) AC_MSG_RESULT($with_odbcinst),
                    550:       AC_DEFINE_UNQUOTED(ODBCINST, ${ODBCINSTDIR}) AC_MSG_RESULT(${ODBCINSTDIR})
                    551:    )
                    552: fi
                    553: if test "X$with_odbcinst" != "X"
                    554: then
                    555:     ODBCINSTDIR=$with_odbcinst
                    556: fi
                    557: AC_SUBST(ODBCINSTDIR)
                    558: 
1.8       momjian   559: #check for unixODBC libs
1.3       momjian   560: 
                    561: if test "x$use_unixODBC" = "xyes"
                    562: then
                    563: 
1.8       momjian   564:   # default to /usr/local if not specified
                    565:   if test "x$unixODBC" = "x"
                    566:   then
                    567:       unixODBC="/usr/local";
                    568:   fi
                    569:   
                    570:   unixODBC_libs="$unixODBC/lib"
                    571:   unixODBC_includes="$unixODBC/include"
                    572: 
1.13    ! petere    573:   INCLUDES="$INCLUDES -I$unixODBC_includes"
1.8       momjian   574:   AC_CHECK_HEADERS(sql.h sqlext.h odbcinst.h,
                    575:           unixODBC_ok=yes;
                    576:           odbc_headers="$odbc_headers $ac_hdr",
                    577:           unixODBC_ok=no )
                    578:   
                    579:   if test "x$unixODBC_ok" != "xyes"
                    580:   then
                    581:       AC_MSG_ERROR([Unable to find the unixODBC headers in $1])
                    582:   fi
                    583:  
                    584:   save_LIBS="$LIBS"
                    585:   LIBS="-L$unixODBC_libs $LIBS"
                    586:   
                    587:   AC_CHECK_LIB(odbcinst,SQLGetPrivateProfileString,
                    588:     [AC_DEFINE(HAVE_SQLGETPRIVATEPROFILESTRING)
                    589:     SHLIB_ODBC="$LDFLAGS_ODBC -L$unixODBC_libs -lodbcinst" ],
                    590:     [LIBS="$save_LIBS"] )
1.3       momjian   591: fi
1.8       momjian   592: export SHLIB_ODBC
1.3       momjian   593: 
1.1       petere    594: dnl Unless we specify the command line options
                    595: dnl    --enable cassert        to explicitly enable it
                    596: dnl If you do not explicitly do it, it defaults to disabled
                    597: AC_MSG_CHECKING(setting ASSERT CHECKING)
                    598: AC_ARG_ENABLE(
                    599:    cassert,
                    600:    [  --enable-cassert        enable assertion checks (for debugging) ],
                    601:    AC_DEFINE(USE_ASSERT_CHECKING) AC_MSG_RESULT(enabled),
                    602:    AC_MSG_RESULT(disabled)
                    603: )
                    604: 
1.13    ! petere    605: CPPFLAGS="$CPPFLAGS $INCLUDES"
1.1       petere    606: echo "- setting CPPFLAGS=$CPPFLAGS"
                    607: 
                    608: LDFLAGS="$LDFLAGS $PGSQL_LDFLAGS"
                    609: echo "- setting LDFLAGS=$LDFLAGS"
                    610: 
                    611: dnl --enable-debug adds -g to compiler flags
                    612: dnl --disable-debug will forcefully remove it
                    613: AC_MSG_CHECKING(setting debug compiler flag)
                    614: AC_ARG_ENABLE(
                    615:     debug,
                    616:     [  --enable-debug          build with debugging symbols (-g) ],
                    617:     [
                    618:         case "$enableval" in
                    619:        y | ye | yes)
                    620:             CFLAGS="$CFLAGS -g"
                    621:             AC_MSG_RESULT(enabled)
                    622:             ;;
                    623:         *)
                    624:             CFLAGS=`echo "$CFLAGS" | sed -e 's/ -g/ /g' | sed -e 's/^-g//'`
                    625:             AC_MSG_RESULT(disabled)
                    626:             ;;
                    627:         esac            
                    628:    ],
                    629:    AC_MSG_RESULT(using default)
                    630: )
                    631: 
                    632: # Assume system is ELF if it predefines __ELF__ as 1,
                    633: # otherwise believe "elf" setting from check of host_os above.
                    634: AC_EGREP_CPP(yes,
                    635: [#if __ELF__
                    636:   yes
                    637: #endif
                    638: ],
                    639:        ELF_SYS=true,
                    640: [if test "X$elf" = "Xyes"
                    641: then
                    642:        ELF_SYS=true
                    643: else
                    644:        ELF_SYS=
                    645: fi
                    646: ])
                    647: 
                    648: AC_SUBST(ELF_SYS)
                    649: AC_SUBST(PORTNAME)
                    650: AC_SUBST(CPU)
                    651: AC_SUBST(SRCDIR)
                    652: AC_SUBST(LDFLAGS)
                    653: AC_SUBST(AROPT)
                    654: AC_SUBST(SHARED_LIB)
                    655: AC_SUBST(CFLAGS)
                    656: AC_SUBST(DLSUFFIX)
                    657: AC_SUBST(DL_LIB)
                    658: AC_SUBST(USE_TCL)
                    659: AC_SUBST(USE_TK)
                    660: AC_SUBST(WISH)
                    661: AC_SUBST(USE_ODBC)
1.8       momjian   662: AC_SUBST(SHLIB_ODBC)
1.1       petere    663: AC_SUBST(MULTIBYTE)
                    664: 
                    665: 
1.6       petere    666: dnl
                    667: dnl Optionally build C++ code (i.e., libpq++)
                    668: dnl
                    669: AC_MSG_CHECKING(whether to build C++ modules)
                    670: AC_ARG_WITH(CXX, [  --with-CXX              build C++ modules (libpq++)],
                    671: [if test "x${withval+set}" = xset; then
                    672:   AC_MSG_RESULT(yes)
                    673:   if test x"$withval" != xyes ; then
                    674:     CXX=$withval
                    675:   fi
                    676:   AC_PROG_CXX
                    677:   AC_PROG_CXXCPP
                    678:   PGAC_CLASS_STRING
                    679:   PGAC_CXX_NAMESPACE_STD
                    680: else
                    681:   AC_MSG_RESULT(no)
                    682: fi],
                    683: [AC_MSG_RESULT(no)])
                    684: AC_SUBST(with_CXX)
1.1       petere    685: 
                    686: 
                    687: 
                    688: dnl Figure out how to invoke "install" and what install options to use.
                    689: 
                    690: AC_PROG_INSTALL
                    691: 
                    692: INSTLOPTS="-m 444"
                    693: INSTL_EXE_OPTS="-m 555"
                    694: INSTL_LIB_OPTS="-m 644"
                    695: INSTL_SHLIB_OPTS="-m 644"
                    696: 
                    697: dnl HPUX wants shared libs to be mode 555.
                    698: case "$host_os" in
                    699:  hpux*)
                    700:        INSTL_SHLIB_OPTS="-m 555" ;;
                    701: esac
                    702: 
                    703: AC_SUBST(INSTALL)
                    704: AC_SUBST(INSTLOPTS)
                    705: AC_SUBST(INSTL_LIB_OPTS)
                    706: AC_SUBST(INSTL_SHLIB_OPTS)
                    707: AC_SUBST(INSTL_EXE_OPTS)
                    708: 
1.2       petere    709: AC_PROG_AWK
                    710: 
1.1       petere    711: AC_PROG_LEX
                    712: if test "$LEX" = "flex"; then
                    713:         $LEX --version 2> /dev/null | grep -s '2\.5\.3' > /dev/null 2>&1
                    714:         if test $? -eq 0 ; then
                    715:                 AC_MSG_WARN([
                    716: ***
                    717: You have flex version 2.5.3, which is broken. Get version 2.5.4 or
                    718: a different lex.
                    719: (If you are using the official distribution of PostgreSQL then you
                    720: do not need to worry about this because the lexer files are
                    721: pre-generated. However, other software using flex is likely to be
                    722: broken as well.)
                    723: ***])
                    724:         fi
                    725: fi
                    726: AC_PROG_LN_S
                    727: AC_PROG_RANLIB
                    728: AC_PATH_PROG(find, find)
                    729: AC_PATH_PROG(tar, tar)
                    730: AC_PATH_PROG(split, split)
                    731: AC_PATH_PROG(etags, etags)
                    732: AC_PATH_PROG(xargs, xargs)
                    733: AC_PATH_PROGS(GZCAT, gzcat zcat, gzcat)
                    734: AC_CHECK_PROGS(PERL, perl,)
1.2       petere    735: AC_PROG_YACC
1.6       petere    736: AC_SUBST(YFLAGS)
1.1       petere    737: 
                    738: 
                    739: AC_CHECK_LIB(sfio,     main)
1.13    ! petere    740: AC_CHECK_LIB(ncurses,  main, [], [AC_CHECK_LIB(curses, main)])
1.1       petere    741: AC_CHECK_LIB(termcap,  main)
                    742: AC_CHECK_LIB(readline, main)
                    743: AC_CHECK_LIB(readline, using_history, AC_DEFINE(HAVE_HISTORY_IN_READLINE),
                    744:     AC_CHECK_LIB(history,  main) )
                    745: 
                    746: if test "$PORTNAME" != "aix" -a "$PORTNAME" != "alpha"
                    747: then
                    748:        AC_CHECK_LIB(bsd,      main)
                    749: fi
                    750: AC_CHECK_LIB(util,     main)
                    751: AC_CHECK_LIB(m,        main)
                    752: AC_CHECK_LIB(dl,       main)
                    753: AC_CHECK_LIB(socket,   main)
                    754: AC_CHECK_LIB(nsl,      main)
                    755: AC_CHECK_LIB(ipc,      main)
                    756: AC_CHECK_LIB(IPC,      main)
                    757: AC_CHECK_LIB(lc,       main)
                    758: AC_CHECK_LIB(dld,      main)
                    759: AC_CHECK_LIB(ln,       main)
                    760: AC_CHECK_LIB(ld,       main)
                    761: AC_CHECK_LIB(compat,   main)
                    762: AC_CHECK_LIB(BSD,      main)
                    763: AC_CHECK_LIB(crypt,    main)
                    764: AC_CHECK_LIB(gen,      main)
                    765: AC_CHECK_LIB(PW,       main)
                    766: 
                    767: dnl Checks for header files.
                    768: AC_HEADER_STDC
                    769: AC_HEADER_SYS_WAIT
                    770: AC_CHECK_HEADERS(arpa/inet.h)
                    771: AC_CHECK_HEADERS(crypt.h)
                    772: AC_CHECK_HEADERS(dld.h)
                    773: AC_CHECK_HEADERS(endian.h)
                    774: AC_CHECK_HEADERS(float.h)
                    775: AC_CHECK_HEADERS(fp_class.h)
                    776: AC_CHECK_HEADERS(getopt.h)
                    777: AC_CHECK_HEADERS(history.h)
                    778: AC_CHECK_HEADERS(ieeefp.h)
                    779: AC_CHECK_HEADERS(limits.h)
                    780: AC_CHECK_HEADERS(netdb.h)
                    781: AC_CHECK_HEADERS(netinet/in.h)
                    782: AC_CHECK_HEADERS(readline.h)
                    783: AC_CHECK_HEADERS(readline/history.h)
                    784: AC_CHECK_HEADERS(readline/readline.h)
                    785: AC_CHECK_HEADERS(sys/select.h)
                    786: AC_CHECK_HEADERS(termios.h)
                    787: AC_CHECK_HEADERS(unistd.h)
                    788: AC_CHECK_HEADERS(values.h)
                    789: AC_CHECK_HEADERS(sys/exec.h sys/pstat.h machine/vmparam.h)
1.6       petere    790: AC_CHECK_HEADERS(sys/types.h sys/socket.h)
1.1       petere    791: dnl ODBC headers...
                    792: AC_CHECK_HEADERS(sys/param.h pwd.h)
                    793: dnl
                    794: 
                    795: dnl Checks for typedefs, structures, and compiler characteristics.
                    796: AC_C_CONST
                    797: AC_C_INLINE
                    798: AC_C_STRINGIZE
                    799: AC_TYPE_UID_T
                    800: AC_TYPE_MODE_T
                    801: AC_TYPE_OFF_T
                    802: AC_TYPE_SIZE_T
                    803: AC_STRUCT_TIMEZONE
1.6       petere    804: PGAC_C_SIGNED
                    805: PGAC_C_VOLATILE
                    806: AC_FUNC_ACCEPT_ARGTYPES
1.1       petere    807: 
                    808: 
1.6       petere    809: PGAC_VAR_INT_TIMEZONE
                    810: PGAC_FUNC_GETTIMEOFDAY_1ARG
                    811: PGAC_UNION_SEMUN
1.1       petere    812: 
                    813: 
                    814: AC_MSG_CHECKING(for fcntl(F_SETLK))
                    815: AC_TRY_LINK([#include <fcntl.h>],
                    816:            [struct flock lck;
                    817:             lck.l_whence = SEEK_SET; lck.l_start = lck.l_len = 0;
                    818:             lck.l_type = F_WRLCK;
                    819:             fcntl(0, F_SETLK, &lck);],
                    820:            [AC_DEFINE(HAVE_FCNTL_SETLK) AC_MSG_RESULT(yes)],
                    821:            AC_MSG_RESULT(no))
                    822: 
                    823: dnl Checks for library functions.
                    824: AC_FUNC_MEMCMP
                    825: AC_TYPE_SIGNAL
                    826: AC_FUNC_VPRINTF
                    827: AC_CHECK_FUNCS(memmove sysconf)
                    828: AC_CHECK_FUNCS(sigprocmask waitpid setsid fcvt)
                    829: AC_CHECK_FUNCS(setproctitle pstat)
                    830: 
                    831: AC_MSG_CHECKING(for PS_STRINGS)
                    832: AC_TRY_LINK(
                    833: [#ifdef HAVE_MACHINE_VMPARAM_H
                    834: # include <machine/vmparam.h>
                    835: #endif
                    836: #ifdef HAVE_SYS_EXEC_H
                    837: # include <sys/exec.h>
                    838: #endif],
                    839: [PS_STRINGS->ps_nargvstr = 1;
                    840: PS_STRINGS->ps_argvstr = "foo";],
                    841: [AC_MSG_RESULT(yes) AC_DEFINE(HAVE_PS_STRINGS)],
                    842: AC_MSG_RESULT(no))
                    843: 
                    844: AC_CHECK_FUNCS(fpclass fp_class fp_class_d class)
                    845: dnl We use our snprintf.c emulation if either snprintf() or vsnprintf()
                    846: dnl is missing.  Yes, there are machines that have only one.
                    847: dnl We may also decide to use snprintf.c if snprintf() is present but does
                    848: dnl not have working "long long int" support -- see below.
                    849: SNPRINTF=''
                    850: AC_CHECK_FUNC(snprintf,
                    851:              AC_DEFINE(HAVE_SNPRINTF),
                    852:              SNPRINTF='snprintf.o')
                    853: AC_CHECK_FUNC(vsnprintf,
                    854:              AC_DEFINE(HAVE_VSNPRINTF),
                    855:              SNPRINTF='snprintf.o')
                    856: AC_SUBST(SNPRINTF)
                    857: dnl Check whether <stdio.h> declares snprintf() and vsnprintf(); if not,
                    858: dnl include/c.h will provide declarations.  Note this is a separate test
                    859: dnl from whether the functions exist in the C library --- there are systems
                    860: dnl that have the functions but don't bother to declare them :-(
                    861: dnl Note: simple-minded pattern here will do wrong thing if stdio.h
                    862: dnl declares vsnprintf() but not snprintf().  Hopefully there are no
                    863: dnl systems that are *that* brain-damaged...
                    864: AC_EGREP_HEADER(snprintf, stdio.h, AC_DEFINE(HAVE_SNPRINTF_DECL))
                    865: AC_EGREP_HEADER(vsnprintf, stdio.h, AC_DEFINE(HAVE_VSNPRINTF_DECL))
                    866: dnl
                    867: dnl do this one the hard way in case isinf() is a macro
                    868: AC_MSG_CHECKING(for isinf)
                    869: AC_CACHE_VAL(ac_cv_func_or_macro_isinf,
                    870: [AC_TRY_LINK(
                    871: [#include <math.h>],
                    872: [double x = 0.0; int res = isinf(x);],
                    873: [ac_cv_func_or_macro_isinf=yes],
                    874: [ac_cv_func_or_macro_isinf=no])])
                    875: if [[ $ac_cv_func_or_macro_isinf = yes ]]; then
                    876:   AC_MSG_RESULT(yes)
                    877:   AC_DEFINE(HAVE_ISINF)
                    878:   ISINF=''
                    879: else
                    880:   AC_MSG_RESULT(no)
                    881:   ISINF='isinf.o'
                    882: fi
                    883: AC_SUBST(ISINF)
                    884: AC_CHECK_FUNC(getrusage,
                    885:              AC_DEFINE(HAVE_GETRUSAGE),
                    886:              GETRUSAGE='getrusage.o')
                    887: AC_SUBST(GETRUSAGE)
                    888: AC_CHECK_FUNC(srandom,
                    889:              AC_DEFINE(HAVE_SRANDOM),
                    890:              SRANDOM='srandom.o')
                    891: AC_SUBST(SRANDOM)
                    892: AC_CHECK_FUNC(gethostname,
                    893:              AC_DEFINE(HAVE_GETHOSTNAME),
                    894:              GETHOSTNAME='gethostname.o')
                    895: AC_SUBST(GETHOSTNAME)
                    896: AC_CHECK_FUNC(random,
                    897:              AC_DEFINE(HAVE_RANDOM),
                    898:              MISSING_RANDOM='random.o')
                    899: AC_SUBST(MISSING_RANDOM)
                    900: AC_CHECK_FUNC(inet_aton,
                    901:              AC_DEFINE(HAVE_INET_ATON),
                    902:              INET_ATON='inet_aton.o')
                    903: AC_SUBST(INET_ATON)
                    904: AC_CHECK_FUNC(strerror,
                    905:              AC_DEFINE(HAVE_STRERROR),
                    906:              [STRERROR='strerror.o' STRERROR2='../../backend/port/strerror.o'])
                    907: AC_SUBST(STRERROR)
                    908: AC_SUBST(STRERROR2)
                    909: AC_CHECK_FUNC(strdup,
                    910:              AC_DEFINE(HAVE_STRDUP),
                    911:              STRDUP='../../utils/strdup.o')
                    912: AC_SUBST(STRDUP)
                    913: AC_CHECK_FUNC(strtol,
                    914:              AC_DEFINE(HAVE_STRTOL),
                    915:              STRTOL='strtol.o')
                    916: AC_SUBST(STRTOL)
                    917: AC_CHECK_FUNC(strtoul,
                    918:              AC_DEFINE(HAVE_STRTOUL),
                    919:              STRTOL='strtoul.o')
                    920: AC_SUBST(STRTOUL)
                    921: AC_CHECK_FUNC(strcasecmp,
                    922:              AC_DEFINE(HAVE_STRCASECMP),
                    923:              STRCASECMP='strcasecmp.o')
                    924: AC_SUBST(STRCASECMP)
                    925: AC_CHECK_FUNC(cbrt,
                    926:              AC_DEFINE(HAVE_CBRT),
                    927:              AC_CHECK_LIB(m, cbrt, AC_DEFINE(HAVE_CBRT)))
                    928: 
                    929: # On HPUX 9, rint() is not in regular libm.a but in /lib/pa1.1/libm.a;
                    930: # this hackery with HPUXMATHLIB allows us to cope.
                    931: HPUXMATHLIB=""
                    932: case "$host_cpu" in
                    933:   hppa1.1) 
                    934:        if [[ -r /lib/pa1.1/libm.a ]] ; then
                    935:            HPUXMATHLIB="-L /lib/pa1.1 -lm"
                    936:        fi ;;
                    937: esac
                    938: AC_SUBST(HPUXMATHLIB)
                    939: 
                    940: AC_CHECK_FUNC(rint,
                    941:              AC_DEFINE(HAVE_RINT),
                    942:              AC_CHECK_LIB(m, rint, AC_DEFINE(HAVE_RINT), , $HPUXMATHLIB))
                    943: 
                    944: dnl Some old versions of libreadline don't have rl_completion_append_character
                    945: AC_EGREP_HEADER(rl_completion_append_character, readline.h,
                    946:        AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER),
                    947:        [AC_EGREP_HEADER(rl_completion_append_character, readline/readline.h,
                    948:                AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER))])
                    949: AC_SUBST(HAVE_RL_COMPLETION_APPEND_CHARACTER)
                    950: 
                    951: dnl Check for readline's filename_completion_function.
                    952: dnl Some versions have it but it's not in the headers, so we have to take
                    953: dnl care of that, too.
                    954: AC_CHECK_FUNCS(filename_completion_function,
                    955:     AC_EGREP_HEADER(filename_completion_function, readline.h,
                    956:         AC_DEFINE(HAVE_FILENAME_COMPLETION_FUNCTION_DECL),
                    957:         [AC_EGREP_HEADER(filename_completion_function, readline/readline.h,
                    958:             AC_DEFINE(HAVE_FILENAME_COMPLETION_FUNCTION_DECL))])
                    959: )
                    960: AC_SUBST(HAVE_FILENAME_COMPLETION_FUNCTION)
                    961: AC_SUBST(HAVE_FILENAME_COMPLETION_FUNCTION_DECL)
                    962: 
                    963: dnl Check for GNU style long options support (getopt_long)
                    964: AC_CHECK_FUNCS(getopt_long)
                    965: 
                    966: dnl Cannot use AC_CHECK_FUNC because finite may be a macro
                    967: AC_MSG_CHECKING(for finite)
                    968: AC_TRY_LINK([#include <math.h>],
                    969:        [int dummy=finite(1.0);],
                    970:        [AC_DEFINE(HAVE_FINITE) AC_MSG_RESULT(yes)],
                    971:        AC_MSG_RESULT(no))
                    972: 
                    973: dnl Cannot use AC_CHECK_FUNC because sigsetjmp may be a macro
                    974: dnl (especially on GNU libc)
                    975: dnl See also comments in config.h.
                    976: AC_MSG_CHECKING(for sigsetjmp)
                    977: AC_TRY_LINK([#include <setjmp.h>],
                    978:        [sigjmp_buf x; sigsetjmp(x, 1);],
                    979:        [AC_DEFINE(HAVE_SIGSETJMP) AC_MSG_RESULT(yes)],
                    980:        AC_MSG_RESULT(no))
                    981: 
                    982: AC_ARG_ENABLE(syslog, [  --enable-syslog         enable logging to syslog],
                    983:     [case $enableval in y|ye|yes)
                    984:        AC_CHECK_FUNC(syslog, [AC_DEFINE(ENABLE_SYSLOG)], [AC_MSG_ERROR([no syslog interface found])])
                    985:         ;;
                    986:      esac]
                    987: )
                    988: 
                    989: dnl Check to see if we have a working 64-bit integer type.
                    990: dnl This breaks down into two steps:
                    991: dnl (1) figure out if the compiler has a 64-bit int type with working
                    992: dnl arithmetic, and if so
                    993: dnl (2) see whether snprintf() can format the type correctly.  (Currently,
                    994: dnl snprintf is the only library routine we really need for int8 support.)
                    995: dnl It's entirely possible to have a compiler that handles a 64-bit type
                    996: dnl when the C library doesn't; this is fairly likely when using gcc on
                    997: dnl an older platform, for example.
                    998: dnl If there is no native snprintf() or it does not handle the 64-bit type,
                    999: dnl we force our own version of snprintf() to be used instead.
                   1000: dnl Note this test must be run after our initial check for snprintf/vsnprintf.
                   1001: 
1.6       petere   1002: PGAC_TYPE_64BIT_INT([long int])
1.1       petere   1003: 
1.6       petere   1004: if test x"$HAVE_LONG_INT_64" = x"no" ; then
                   1005:   PGAC_TYPE_64BIT_INT([long long int])
                   1006: fi
1.1       petere   1007: 
                   1008: 
                   1009: dnl If we found "long int" is 64 bits, assume snprintf handles it.
                   1010: dnl If we found we need to use "long long int", better check.
                   1011: dnl We cope with snprintfs that use either %lld or %qd as the format.
                   1012: dnl If neither works, fall back to our own snprintf emulation (which we
                   1013: dnl know uses %lld).
                   1014: 
1.7       petere   1015: if [[ x"$HAVE_LONG_LONG_INT_64" = xyes ]] ; then
1.1       petere   1016:   if [[ x$SNPRINTF = x ]] ; then
                   1017:     AC_MSG_CHECKING(whether snprintf handles 'long long int' as %lld)
                   1018:     AC_TRY_RUN([#include <stdio.h>
                   1019: typedef long long int int64;
                   1020: #define INT64_FORMAT "%lld"
                   1021: 
                   1022: int64 a = 20000001;
                   1023: int64 b = 40000005;
                   1024: 
                   1025: int does_int64_snprintf_work()
                   1026: {
                   1027:   int64 c;
                   1028:   char buf[100];
                   1029: 
                   1030:   if (sizeof(int64) != 8)
                   1031:     return 0;                  /* doesn't look like the right size */
                   1032: 
                   1033:   c = a * b;
                   1034:   snprintf(buf, 100, INT64_FORMAT, c);
                   1035:   if (strcmp(buf, "800000140000005") != 0)
                   1036:     return 0;                  /* either multiply or snprintf is busted */
                   1037:   return 1;
                   1038: }
                   1039: main() {
                   1040:   exit(! does_int64_snprintf_work());
                   1041: }],
                   1042:        [ AC_MSG_RESULT(yes)
                   1043:          INT64_FORMAT='"%lld"'
                   1044:        ],
                   1045:   [ AC_MSG_RESULT(no)
                   1046:     AC_MSG_CHECKING(whether snprintf handles 'long long int' as %qd) 
                   1047:     AC_TRY_RUN([#include <stdio.h>
                   1048: typedef long long int int64;
                   1049: #define INT64_FORMAT "%qd"
                   1050:    
                   1051: int64 a = 20000001;
                   1052: int64 b = 40000005;
                   1053:    
                   1054: int does_int64_snprintf_work()
                   1055: {  
                   1056:   int64 c;
                   1057:   char buf[100];
                   1058: 
                   1059:   if (sizeof(int64) != 8)
                   1060:     return 0;     /* doesn't look like the right size */
                   1061: 
                   1062:   c = a * b;
                   1063:   snprintf(buf, 100, INT64_FORMAT, c);
                   1064:   if (strcmp(buf, "800000140000005") != 0)
                   1065:     return 0;     /* either multiply or snprintf is busted */
                   1066:   return 1;
                   1067: }
                   1068: main() {
                   1069:   exit(! does_int64_snprintf_work());
                   1070: }],
                   1071:   [ AC_MSG_RESULT(yes)
                   1072:     INT64_FORMAT='"%qd"'
                   1073:   ],
                   1074:   [ AC_MSG_RESULT(no)
                   1075:        # Force usage of our own snprintf, since system snprintf is broken
                   1076:        SNPRINTF='snprintf.o'
                   1077:        INT64_FORMAT='"%lld"'
                   1078:   ],
                   1079:   [ AC_MSG_RESULT(assuming not on target machine)
                   1080:        # Force usage of our own snprintf, since we cannot test foreign snprintf
                   1081:        SNPRINTF='snprintf.o'
                   1082:        INT64_FORMAT='"%lld"'
                   1083:   ]) ],
                   1084:   [ AC_MSG_RESULT(assuming not on target machine)
                   1085:        # Force usage of our own snprintf, since we cannot test foreign snprintf
                   1086:        SNPRINTF='snprintf.o'
                   1087:        INT64_FORMAT='"%lld"'
                   1088:   ])
                   1089:   else
                   1090:     # here if we previously decided we needed to use our own snprintf
                   1091:     INT64_FORMAT='"%lld"'
                   1092:   fi
                   1093: else
                   1094:   # Here if we are not using 'long long int' at all
                   1095:   INT64_FORMAT='"%ld"'
                   1096: fi
                   1097: 
                   1098: AC_DEFINE_UNQUOTED(INT64_FORMAT, $INT64_FORMAT)
                   1099: 
                   1100: 
                   1101: dnl Determine memory alignment requirements for the basic C datatypes.
                   1102: 
1.6       petere   1103: PGAC_CHECK_ALIGNOF(short)
                   1104: PGAC_CHECK_ALIGNOF(int)
                   1105: PGAC_CHECK_ALIGNOF(long)
1.7       petere   1106: if [[ x"$HAVE_LONG_LONG_INT_64" = xyes ]] ; then
1.6       petere   1107:   PGAC_CHECK_ALIGNOF(long long int)
1.1       petere   1108: fi
1.6       petere   1109: PGAC_CHECK_ALIGNOF(double)
1.1       petere   1110: 
                   1111: dnl Compute maximum alignment of any basic type.
                   1112: dnl We assume long's alignment is at least as strong as char, short, or int;
                   1113: dnl but we must check long long (if it exists) and double.
                   1114: 
1.6       petere   1115: if test $pgac_cv_alignof_double != 'sizeof(double)' ; then
                   1116:   MAX_ALIGNOF=$pgac_cv_alignof_long
                   1117:   if test $MAX_ALIGNOF -lt $pgac_cv_alignof_double ; then
                   1118:     MAX_ALIGNOF=$pgac_cv_alignof_double
1.1       petere   1119:   fi
1.7       petere   1120:   if test x"$HAVE_LONG_LONG_INT_64" = xyes && test $MAX_ALIGNOF -lt $pgac_cv_alignof_long_long_int ; then
1.6       petere   1121:     MAX_ALIGNOF="$pgac_cv_alignof_long_long_int"
1.1       petere   1122:   fi
                   1123: else
                   1124:   dnl cross-compiling: assume that double's alignment is worst case
1.6       petere   1125:   MAX_ALIGNOF="$pgac_cv_alignof_double"
1.1       petere   1126: fi
1.6       petere   1127: AC_DEFINE_UNQUOTED(MAXIMUM_ALIGNOF, $MAX_ALIGNOF, [Define as the maximum alignment requirement of any type])
1.1       petere   1128: 
1.6       petere   1129: PGAC_FUNC_POSIX_SIGNALS
1.1       petere   1130: 
                   1131: 
                   1132: dnl Check for Tcl configuration script tclConfig.sh
                   1133: 
                   1134: dnl If --with-tclconfig was given, don't check for tclsh, tcl
                   1135: if test -z "$TCL_DIRS"
                   1136: then
                   1137:        AC_PATH_PROG(TCLSH, tclsh)
                   1138:        if test -z "$TCLSH"
                   1139:        then
                   1140:                AC_PATH_PROG(TCLSH, tcl)
                   1141:                if test -z "$TCLSH"
                   1142:                then
                   1143:                        AC_MSG_WARN(TCL/TK support disabled; tcl shell is not in your path)
                   1144:                        USE_TCL=
                   1145:                fi
                   1146:        fi
                   1147: fi
                   1148:        
                   1149: if test "$USE_TCL" = true
                   1150: then
                   1151:        AC_MSG_CHECKING(for tclConfig.sh)
                   1152:        TCL_CONFIG_SH=
                   1153:        library_dirs=
                   1154:        if test -z "$TCL_DIRS"
                   1155:        then
                   1156:                library_dirs=`echo 'puts $auto_path' | $TCLSH`
                   1157:        fi
                   1158:        library_dirs="$TCL_DIRS $TK_DIRS $library_dirs"
                   1159:        for dir in $library_dirs; do
                   1160:                if test -d "$dir" -a -r "$dir/tclConfig.sh"; then
                   1161:                        TCL_CONFIG_SH=$dir/tclConfig.sh
                   1162:                        break
                   1163:                fi
                   1164:        done
                   1165:        if test -z "$TCL_CONFIG_SH"; then
                   1166:                AC_MSG_RESULT(no)
                   1167:                AC_MSG_WARN(TCL/TK support disabled; Tcl configuration script missing)
                   1168:                USE_TCL=
                   1169:        else
                   1170:                AC_MSG_RESULT($TCL_CONFIG_SH)
                   1171:                AC_SUBST(TCL_CONFIG_SH)
                   1172:        fi
                   1173: fi
                   1174: 
                   1175: USE_TK=$USE_TCL                # If TCL is disabled, disable TK
                   1176: 
                   1177: dnl Check for Tk configuration script tkConfig.sh
                   1178: if test "$USE_TK" = true
                   1179: then
                   1180:        AC_MSG_CHECKING(for tkConfig.sh)
                   1181:        TK_CONFIG_SH=
                   1182:        # library_dirs are set in the check for TCL
                   1183:        for dir in $library_dirs
                   1184:        do
                   1185:                if test -d "$dir" -a -r "$dir/tkConfig.sh"
                   1186:                then
                   1187:                        TK_CONFIG_SH=$dir/tkConfig.sh
                   1188:                        break
                   1189:                fi
                   1190:        done
                   1191:        if test -z "$TK_CONFIG_SH"
                   1192:        then
                   1193:                AC_MSG_RESULT(no)
                   1194:                AC_MSG_WARN(TK support disabled; Tk configuration script missing)
                   1195:                USE_TK=
                   1196:        else
                   1197:                AC_MSG_RESULT($TK_CONFIG_SH)
                   1198:                AC_SUBST(TK_CONFIG_SH)
                   1199:                AC_PATH_PROG(WISH, wish)
                   1200:        fi
                   1201: fi
                   1202: 
                   1203: USE_X=$USE_TK
                   1204: 
                   1205: dnl Check for X libraries
                   1206: 
                   1207: if test "$USE_X" = true; then
                   1208: 
                   1209:        ice_save_LIBS="$LIBS"
                   1210:        ice_save_CFLAGS="$CFLAGS"
                   1211:        ice_save_CPPFLAGS="$CPPFLAGS"
                   1212:        ice_save_LDFLAGS="$LDFLAGS"
                   1213: 
                   1214:        AC_PATH_XTRA
                   1215: 
                   1216:        LIBS="$LIBS $X_EXTRA_LIBS"
                   1217:        CFLAGS="$CFLAGS $X_CFLAGS"
                   1218:        CPPFLAGS="$CPPFLAGS $X_CFLAGS"
                   1219:        LDFLAGS="$LDFLAGS $X_LIBS"
                   1220: 
                   1221:        dnl Check for X library
                   1222: 
                   1223:        X11_LIBS=""
                   1224:        AC_CHECK_LIB(X11, XOpenDisplay, X11_LIBS="-lX11",,${X_PRE_LIBS})
                   1225:        if test "$X11_LIBS" = ""; then
                   1226:                dnl Not having X is bad news for pgtksh. Let the user fix this.
                   1227:                AC_MSG_WARN([The X11 library '-lX11' could not be found,
                   1228: so TK support will be disabled.  To enable TK support,
                   1229: please use the configure options '--x-includes=DIR'
                   1230: and '--x-libraries=DIR' to specify the X location.
                   1231: See the file 'config.log' for further diagnostics.])
                   1232:                USE_TK=
                   1233:        fi
                   1234:        AC_SUBST(X_LIBS)
                   1235:        AC_SUBST(X11_LIBS)
                   1236:        AC_SUBST(X_PRE_LIBS)
                   1237: 
                   1238:        LIBS="$ice_save_LIBS"
                   1239:        CFLAGS="$ice_save_CFLAGS"
                   1240:        CPPFLAGS="$ice_save_CPPFLAGS"
                   1241:        LDFLAGS="$ice_save_LDFLAGS"
                   1242: fi
                   1243: 
                   1244: dnl cause configure to recurse into subdirectories with their own configure
                   1245: dnl Darn, setting AC_CONFIG_SUBDIRS sets a list $subdirs$ in the configure output
                   1246: dnl  file, but then configure doesn't bother using that list. Probably a bug in
                   1247: dnl  this version of autoconf.
                   1248: dnl So at the moment interfaces/odbc gets configured unconditionally.
                   1249: dnl - thomas 1998-10-05
                   1250: #if test "X$USE_ODBC" = "Xtrue"
                   1251: #then
                   1252: #      AC_CONFIG_SUBDIRS(interfaces/odbc)
                   1253: #fi
                   1254: if test "$USE_ODBC" = "true"
                   1255: then
                   1256:        PWD_INCDIR=no
                   1257:        AC_CHECK_HEADER(pwd.h, PWD_INCDIR=yes)
                   1258:        if test "$PWD_INCDIR" = "no"; then
                   1259:                AC_MSG_WARN(odbc support disabled; pwd.h missing)
                   1260:                USE_ODBC=
                   1261:        fi
                   1262:        AC_SUBST(USE_ODBC)
                   1263: fi
                   1264: 
                   1265: dnl Output files that are neither makefiles nor shell scripts probably
                   1266: dnl need fully-expanded substitutions, rather than partial expansions
                   1267: dnl that include references to other variables.  Currently the only
                   1268: dnl such item that's needed is an expanded version of libdir, but
                   1269: dnl others may be needed someday.  NOTE: 'eval' technique only copes
                   1270: dnl with one level of indirect reference per expansion; two levels is
                   1271: dnl currently enough for libdir, but it's ugly...
                   1272: 
                   1273: dnl First we have to force 'NONE' prefix to be expanded itself.
                   1274: dnl For some reason, autoconf 2.13 doesn't do this until AC_OUTPUT,
                   1275: dnl which is too late...
                   1276: test "x$prefix" = xNONE && prefix=$ac_default_prefix
                   1277: test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
                   1278: 
                   1279: eval expanded_libdir="$libdir"
                   1280: eval expanded_libdir="$expanded_libdir"
                   1281: AC_SUBST(expanded_libdir)
                   1282: 
                   1283: dnl Finally ready to produce output files ...
                   1284: 
                   1285: AC_OUTPUT(
                   1286:        GNUmakefile
                   1287:        src/GNUmakefile
                   1288:        src/Makefile.global
                   1289:        src/backend/port/Makefile
                   1290:        src/backend/catalog/genbki.sh
                   1291:        src/backend/utils/Gen_fmgrtab.sh
                   1292:        src/bin/pg_dump/Makefile
                   1293:        src/bin/pg_version/Makefile
                   1294:        src/bin/pgtclsh/mkMakefile.tcldefs.sh
                   1295:        src/bin/pgtclsh/mkMakefile.tkdefs.sh
                   1296:        src/bin/psql/Makefile
                   1297:        src/include/version.h
1.5       petere   1298:        src/interfaces/Makefile
1.1       petere   1299:        src/interfaces/libpq/Makefile
                   1300:        src/interfaces/ecpg/lib/Makefile
                   1301:        src/interfaces/ecpg/preproc/Makefile
1.5       petere   1302:        src/interfaces/perl5/GNUmakefile
1.1       petere   1303:        src/interfaces/libpq++/Makefile
                   1304:        src/interfaces/libpgeasy/Makefile
                   1305:        src/interfaces/libpgtcl/Makefile
                   1306:        src/interfaces/odbc/GNUmakefile
                   1307:        src/interfaces/odbc/Makefile.global
1.5       petere   1308:        src/interfaces/python/GNUmakefile
                   1309:        src/pl/Makefile
1.1       petere   1310:        src/pl/plpgsql/src/Makefile
                   1311:        src/pl/plpgsql/src/mklang.sql
                   1312:        src/pl/tcl/mkMakefile.tcldefs.sh
1.5       petere   1313:        src/pl/plperl/GNUmakefile
1.1       petere   1314:        src/test/regress/GNUmakefile
                   1315: )

PostgreSQL CVSweb <[email protected]>