Annotation of pgsql/configure.in, revision 1.20

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.15      petere    500: dnl
                    501: dnl Optionally enable the building of the ODBC driver
                    502: dnl
                    503:  
                    504: dnl Old option name
                    505: if test "x${with_odbc+set}" = xset && test "x${enable_odbc+set}" != xset; then
                    506:   enable_odbc=$with_odbc
                    507: fi
                    508:  
                    509: AC_MSG_CHECKING(whether to build the ODBC driver)
                    510: AC_ARG_ENABLE(odbc, [  --enable-odbc           build the ODBC driver package],
                    511: [if test x"$enableval" = x"yes" ; then
                    512:   AC_MSG_RESULT(yes)
                    513: else
                    514:   AC_MSG_RESULT(no)
                    515: fi],
                    516: [AC_MSG_RESULT(no)])
                    517: AC_SUBST(enable_odbc)
1.8       momjian   518: 
1.1       petere    519: 
                    520: dnl Allow for overriding the default location of the odbcinst.ini
1.15      petere    521: dnl file which is normally ${datadir} (i.e., ${prefix}/share).
                    522: if test x"$enable_odbc" = x"yes" ; then
                    523: AC_ARG_WITH(odbcinst, [  --with-odbcinst=DIR     default directory for odbcinst.ini [datadir]],
                    524: [if test x"$with_odbcinst" = x"yes" || test x"$with_odbcinst" = x"no" ; then
                    525:   AC_MSG_ERROR([You must supply an argument to the --with-odbcinst option.])
1.1       petere    526: fi
1.15      petere    527: odbcinst_ini_dir=$withval],
                    528: [odbcinst_ini_dir='${datadir}'])
                    529: else
                    530:   odbcinst_ini_dir='${datadir}'
1.1       petere    531: fi
1.15      petere    532: AC_SUBST(odbcinst_ini_dir)
1.3       momjian   533: 
                    534: 
                    535: 
1.1       petere    536: dnl Unless we specify the command line options
                    537: dnl    --enable cassert        to explicitly enable it
                    538: dnl If you do not explicitly do it, it defaults to disabled
                    539: AC_MSG_CHECKING(setting ASSERT CHECKING)
                    540: AC_ARG_ENABLE(
                    541:    cassert,
                    542:    [  --enable-cassert        enable assertion checks (for debugging) ],
                    543:    AC_DEFINE(USE_ASSERT_CHECKING) AC_MSG_RESULT(enabled),
                    544:    AC_MSG_RESULT(disabled)
                    545: )
                    546: 
1.13      petere    547: CPPFLAGS="$CPPFLAGS $INCLUDES"
1.1       petere    548: echo "- setting CPPFLAGS=$CPPFLAGS"
                    549: 
                    550: LDFLAGS="$LDFLAGS $PGSQL_LDFLAGS"
                    551: echo "- setting LDFLAGS=$LDFLAGS"
                    552: 
                    553: dnl --enable-debug adds -g to compiler flags
                    554: dnl --disable-debug will forcefully remove it
                    555: AC_MSG_CHECKING(setting debug compiler flag)
                    556: AC_ARG_ENABLE(
                    557:     debug,
                    558:     [  --enable-debug          build with debugging symbols (-g) ],
                    559:     [
                    560:         case "$enableval" in
                    561:        y | ye | yes)
                    562:             CFLAGS="$CFLAGS -g"
                    563:             AC_MSG_RESULT(enabled)
                    564:             ;;
                    565:         *)
                    566:             CFLAGS=`echo "$CFLAGS" | sed -e 's/ -g/ /g' | sed -e 's/^-g//'`
                    567:             AC_MSG_RESULT(disabled)
                    568:             ;;
                    569:         esac            
                    570:    ],
                    571:    AC_MSG_RESULT(using default)
                    572: )
                    573: 
                    574: # Assume system is ELF if it predefines __ELF__ as 1,
                    575: # otherwise believe "elf" setting from check of host_os above.
                    576: AC_EGREP_CPP(yes,
                    577: [#if __ELF__
                    578:   yes
                    579: #endif
                    580: ],
                    581:        ELF_SYS=true,
                    582: [if test "X$elf" = "Xyes"
                    583: then
                    584:        ELF_SYS=true
                    585: else
                    586:        ELF_SYS=
                    587: fi
                    588: ])
                    589: 
                    590: AC_SUBST(ELF_SYS)
                    591: AC_SUBST(PORTNAME)
                    592: AC_SUBST(CPU)
                    593: AC_SUBST(SRCDIR)
                    594: AC_SUBST(LDFLAGS)
                    595: AC_SUBST(AROPT)
                    596: AC_SUBST(SHARED_LIB)
                    597: AC_SUBST(CFLAGS)
                    598: AC_SUBST(DLSUFFIX)
                    599: AC_SUBST(DL_LIB)
                    600: AC_SUBST(USE_TCL)
                    601: AC_SUBST(USE_TK)
                    602: AC_SUBST(WISH)
                    603: AC_SUBST(MULTIBYTE)
                    604: 
                    605: 
1.6       petere    606: dnl
                    607: dnl Optionally build C++ code (i.e., libpq++)
                    608: dnl
                    609: AC_MSG_CHECKING(whether to build C++ modules)
                    610: AC_ARG_WITH(CXX, [  --with-CXX              build C++ modules (libpq++)],
                    611: [if test "x${withval+set}" = xset; then
                    612:   AC_MSG_RESULT(yes)
                    613:   if test x"$withval" != xyes ; then
                    614:     CXX=$withval
                    615:   fi
                    616:   AC_PROG_CXX
                    617:   AC_PROG_CXXCPP
                    618:   PGAC_CLASS_STRING
                    619:   PGAC_CXX_NAMESPACE_STD
                    620: else
                    621:   AC_MSG_RESULT(no)
                    622: fi],
                    623: [AC_MSG_RESULT(no)])
                    624: AC_SUBST(with_CXX)
1.1       petere    625: 
                    626: 
                    627: 
                    628: dnl Figure out how to invoke "install" and what install options to use.
                    629: 
                    630: AC_PROG_INSTALL
                    631: 
                    632: INSTLOPTS="-m 444"
                    633: INSTL_EXE_OPTS="-m 555"
1.19      tgl       634: INSTL_SCRIPT_OPTS="-m 755"
1.1       petere    635: INSTL_LIB_OPTS="-m 644"
                    636: INSTL_SHLIB_OPTS="-m 644"
                    637: 
                    638: dnl HPUX wants shared libs to be mode 555.
                    639: case "$host_os" in
                    640:  hpux*)
                    641:        INSTL_SHLIB_OPTS="-m 555" ;;
                    642: esac
1.19      tgl       643: 
1.1       petere    644: AC_SUBST(INSTLOPTS)
                    645: AC_SUBST(INSTL_LIB_OPTS)
                    646: AC_SUBST(INSTL_SHLIB_OPTS)
                    647: AC_SUBST(INSTL_EXE_OPTS)
                    648: 
1.19      tgl       649: dnl Fix autoconf's brain-dead defaults for script and shlib installs.
                    650: 
                    651: INSTALL_SCRIPT="\${INSTALL} $INSTL_SCRIPT_OPTS"
                    652: AC_SUBST(INSTALL_SCRIPT)
1.15      petere    653: 
1.17      petere    654: INSTALL_SHLIB="\${INSTALL} $INSTL_SHLIB_OPTS"
1.15      petere    655: AC_SUBST(INSTALL_SHLIB)
                    656: 
                    657: 
1.2       petere    658: AC_PROG_AWK
                    659: 
1.1       petere    660: AC_PROG_LEX
                    661: if test "$LEX" = "flex"; then
                    662:         $LEX --version 2> /dev/null | grep -s '2\.5\.3' > /dev/null 2>&1
                    663:         if test $? -eq 0 ; then
                    664:                 AC_MSG_WARN([
                    665: ***
                    666: You have flex version 2.5.3, which is broken. Get version 2.5.4 or
                    667: a different lex.
                    668: (If you are using the official distribution of PostgreSQL then you
                    669: do not need to worry about this because the lexer files are
                    670: pre-generated. However, other software using flex is likely to be
                    671: broken as well.)
                    672: ***])
                    673:         fi
                    674: fi
                    675: AC_PROG_LN_S
                    676: AC_PROG_RANLIB
                    677: AC_PATH_PROG(find, find)
                    678: AC_PATH_PROG(tar, tar)
                    679: AC_PATH_PROG(split, split)
                    680: AC_PATH_PROG(etags, etags)
                    681: AC_PATH_PROG(xargs, xargs)
                    682: AC_PATH_PROGS(GZCAT, gzcat zcat, gzcat)
                    683: AC_CHECK_PROGS(PERL, perl,)
1.2       petere    684: AC_PROG_YACC
1.6       petere    685: AC_SUBST(YFLAGS)
1.1       petere    686: 
                    687: 
                    688: AC_CHECK_LIB(sfio,     main)
1.13      petere    689: AC_CHECK_LIB(ncurses,  main, [], [AC_CHECK_LIB(curses, main)])
1.1       petere    690: AC_CHECK_LIB(termcap,  main)
                    691: AC_CHECK_LIB(readline, main)
                    692: AC_CHECK_LIB(readline, using_history, AC_DEFINE(HAVE_HISTORY_IN_READLINE),
                    693:     AC_CHECK_LIB(history,  main) )
                    694: 
                    695: if test "$PORTNAME" != "aix" -a "$PORTNAME" != "alpha"
                    696: then
                    697:        AC_CHECK_LIB(bsd,      main)
                    698: fi
                    699: AC_CHECK_LIB(util,     main)
                    700: AC_CHECK_LIB(m,        main)
                    701: AC_CHECK_LIB(dl,       main)
                    702: AC_CHECK_LIB(socket,   main)
                    703: AC_CHECK_LIB(nsl,      main)
                    704: AC_CHECK_LIB(ipc,      main)
                    705: AC_CHECK_LIB(IPC,      main)
                    706: AC_CHECK_LIB(lc,       main)
                    707: AC_CHECK_LIB(dld,      main)
                    708: AC_CHECK_LIB(ln,       main)
                    709: AC_CHECK_LIB(ld,       main)
                    710: AC_CHECK_LIB(compat,   main)
                    711: AC_CHECK_LIB(BSD,      main)
                    712: AC_CHECK_LIB(crypt,    main)
                    713: AC_CHECK_LIB(gen,      main)
                    714: AC_CHECK_LIB(PW,       main)
                    715: 
                    716: dnl Checks for header files.
                    717: AC_HEADER_STDC
                    718: AC_HEADER_SYS_WAIT
                    719: AC_CHECK_HEADERS(arpa/inet.h)
                    720: AC_CHECK_HEADERS(crypt.h)
                    721: AC_CHECK_HEADERS(dld.h)
                    722: AC_CHECK_HEADERS(endian.h)
                    723: AC_CHECK_HEADERS(float.h)
                    724: AC_CHECK_HEADERS(fp_class.h)
                    725: AC_CHECK_HEADERS(getopt.h)
                    726: AC_CHECK_HEADERS(history.h)
                    727: AC_CHECK_HEADERS(ieeefp.h)
                    728: AC_CHECK_HEADERS(limits.h)
                    729: AC_CHECK_HEADERS(netdb.h)
                    730: AC_CHECK_HEADERS(netinet/in.h)
                    731: AC_CHECK_HEADERS(readline.h)
                    732: AC_CHECK_HEADERS(readline/history.h)
                    733: AC_CHECK_HEADERS(readline/readline.h)
                    734: AC_CHECK_HEADERS(sys/select.h)
                    735: AC_CHECK_HEADERS(termios.h)
                    736: AC_CHECK_HEADERS(unistd.h)
                    737: AC_CHECK_HEADERS(values.h)
                    738: AC_CHECK_HEADERS(sys/exec.h sys/pstat.h machine/vmparam.h)
1.6       petere    739: AC_CHECK_HEADERS(sys/types.h sys/socket.h)
1.1       petere    740: AC_CHECK_HEADERS(sys/param.h pwd.h)
1.15      petere    741: 
1.1       petere    742: 
                    743: dnl Checks for typedefs, structures, and compiler characteristics.
                    744: AC_C_CONST
                    745: AC_C_INLINE
                    746: AC_C_STRINGIZE
                    747: AC_TYPE_UID_T
                    748: AC_TYPE_MODE_T
                    749: AC_TYPE_OFF_T
                    750: AC_TYPE_SIZE_T
                    751: AC_STRUCT_TIMEZONE
1.6       petere    752: PGAC_C_SIGNED
                    753: PGAC_C_VOLATILE
                    754: AC_FUNC_ACCEPT_ARGTYPES
1.1       petere    755: 
                    756: 
1.6       petere    757: PGAC_VAR_INT_TIMEZONE
                    758: PGAC_FUNC_GETTIMEOFDAY_1ARG
                    759: PGAC_UNION_SEMUN
1.1       petere    760: 
                    761: 
                    762: AC_MSG_CHECKING(for fcntl(F_SETLK))
                    763: AC_TRY_LINK([#include <fcntl.h>],
                    764:            [struct flock lck;
                    765:             lck.l_whence = SEEK_SET; lck.l_start = lck.l_len = 0;
                    766:             lck.l_type = F_WRLCK;
                    767:             fcntl(0, F_SETLK, &lck);],
                    768:            [AC_DEFINE(HAVE_FCNTL_SETLK) AC_MSG_RESULT(yes)],
                    769:            AC_MSG_RESULT(no))
                    770: 
                    771: dnl Checks for library functions.
                    772: AC_FUNC_MEMCMP
                    773: AC_TYPE_SIGNAL
                    774: AC_FUNC_VPRINTF
                    775: AC_CHECK_FUNCS(memmove sysconf)
                    776: AC_CHECK_FUNCS(sigprocmask waitpid setsid fcvt)
                    777: AC_CHECK_FUNCS(setproctitle pstat)
                    778: 
                    779: AC_MSG_CHECKING(for PS_STRINGS)
                    780: AC_TRY_LINK(
                    781: [#ifdef HAVE_MACHINE_VMPARAM_H
                    782: # include <machine/vmparam.h>
                    783: #endif
                    784: #ifdef HAVE_SYS_EXEC_H
                    785: # include <sys/exec.h>
                    786: #endif],
                    787: [PS_STRINGS->ps_nargvstr = 1;
                    788: PS_STRINGS->ps_argvstr = "foo";],
                    789: [AC_MSG_RESULT(yes) AC_DEFINE(HAVE_PS_STRINGS)],
                    790: AC_MSG_RESULT(no))
                    791: 
                    792: AC_CHECK_FUNCS(fpclass fp_class fp_class_d class)
                    793: dnl We use our snprintf.c emulation if either snprintf() or vsnprintf()
                    794: dnl is missing.  Yes, there are machines that have only one.
                    795: dnl We may also decide to use snprintf.c if snprintf() is present but does
                    796: dnl not have working "long long int" support -- see below.
                    797: SNPRINTF=''
                    798: AC_CHECK_FUNC(snprintf,
                    799:              AC_DEFINE(HAVE_SNPRINTF),
                    800:              SNPRINTF='snprintf.o')
                    801: AC_CHECK_FUNC(vsnprintf,
                    802:              AC_DEFINE(HAVE_VSNPRINTF),
                    803:              SNPRINTF='snprintf.o')
                    804: AC_SUBST(SNPRINTF)
                    805: dnl Check whether <stdio.h> declares snprintf() and vsnprintf(); if not,
                    806: dnl include/c.h will provide declarations.  Note this is a separate test
                    807: dnl from whether the functions exist in the C library --- there are systems
                    808: dnl that have the functions but don't bother to declare them :-(
                    809: dnl Note: simple-minded pattern here will do wrong thing if stdio.h
                    810: dnl declares vsnprintf() but not snprintf().  Hopefully there are no
                    811: dnl systems that are *that* brain-damaged...
                    812: AC_EGREP_HEADER(snprintf, stdio.h, AC_DEFINE(HAVE_SNPRINTF_DECL))
                    813: AC_EGREP_HEADER(vsnprintf, stdio.h, AC_DEFINE(HAVE_VSNPRINTF_DECL))
                    814: dnl
                    815: dnl do this one the hard way in case isinf() is a macro
                    816: AC_MSG_CHECKING(for isinf)
                    817: AC_CACHE_VAL(ac_cv_func_or_macro_isinf,
                    818: [AC_TRY_LINK(
                    819: [#include <math.h>],
                    820: [double x = 0.0; int res = isinf(x);],
                    821: [ac_cv_func_or_macro_isinf=yes],
                    822: [ac_cv_func_or_macro_isinf=no])])
                    823: if [[ $ac_cv_func_or_macro_isinf = yes ]]; then
                    824:   AC_MSG_RESULT(yes)
                    825:   AC_DEFINE(HAVE_ISINF)
                    826:   ISINF=''
                    827: else
                    828:   AC_MSG_RESULT(no)
                    829:   ISINF='isinf.o'
                    830: fi
                    831: AC_SUBST(ISINF)
                    832: AC_CHECK_FUNC(getrusage,
                    833:              AC_DEFINE(HAVE_GETRUSAGE),
                    834:              GETRUSAGE='getrusage.o')
                    835: AC_SUBST(GETRUSAGE)
                    836: AC_CHECK_FUNC(srandom,
                    837:              AC_DEFINE(HAVE_SRANDOM),
                    838:              SRANDOM='srandom.o')
                    839: AC_SUBST(SRANDOM)
                    840: AC_CHECK_FUNC(gethostname,
                    841:              AC_DEFINE(HAVE_GETHOSTNAME),
                    842:              GETHOSTNAME='gethostname.o')
                    843: AC_SUBST(GETHOSTNAME)
                    844: AC_CHECK_FUNC(random,
                    845:              AC_DEFINE(HAVE_RANDOM),
                    846:              MISSING_RANDOM='random.o')
                    847: AC_SUBST(MISSING_RANDOM)
                    848: AC_CHECK_FUNC(inet_aton,
                    849:              AC_DEFINE(HAVE_INET_ATON),
                    850:              INET_ATON='inet_aton.o')
                    851: AC_SUBST(INET_ATON)
                    852: AC_CHECK_FUNC(strerror,
                    853:              AC_DEFINE(HAVE_STRERROR),
                    854:              [STRERROR='strerror.o' STRERROR2='../../backend/port/strerror.o'])
                    855: AC_SUBST(STRERROR)
                    856: AC_SUBST(STRERROR2)
                    857: AC_CHECK_FUNC(strdup,
                    858:              AC_DEFINE(HAVE_STRDUP),
                    859:              STRDUP='../../utils/strdup.o')
                    860: AC_SUBST(STRDUP)
                    861: AC_CHECK_FUNC(strtol,
                    862:              AC_DEFINE(HAVE_STRTOL),
                    863:              STRTOL='strtol.o')
                    864: AC_SUBST(STRTOL)
                    865: AC_CHECK_FUNC(strtoul,
                    866:              AC_DEFINE(HAVE_STRTOUL),
                    867:              STRTOL='strtoul.o')
                    868: AC_SUBST(STRTOUL)
                    869: AC_CHECK_FUNC(strcasecmp,
                    870:              AC_DEFINE(HAVE_STRCASECMP),
                    871:              STRCASECMP='strcasecmp.o')
                    872: AC_SUBST(STRCASECMP)
                    873: AC_CHECK_FUNC(cbrt,
                    874:              AC_DEFINE(HAVE_CBRT),
                    875:              AC_CHECK_LIB(m, cbrt, AC_DEFINE(HAVE_CBRT)))
                    876: 
                    877: # On HPUX 9, rint() is not in regular libm.a but in /lib/pa1.1/libm.a;
                    878: # this hackery with HPUXMATHLIB allows us to cope.
                    879: HPUXMATHLIB=""
                    880: case "$host_cpu" in
                    881:   hppa1.1) 
                    882:        if [[ -r /lib/pa1.1/libm.a ]] ; then
                    883:            HPUXMATHLIB="-L /lib/pa1.1 -lm"
                    884:        fi ;;
                    885: esac
                    886: AC_SUBST(HPUXMATHLIB)
                    887: 
                    888: AC_CHECK_FUNC(rint,
                    889:              AC_DEFINE(HAVE_RINT),
                    890:              AC_CHECK_LIB(m, rint, AC_DEFINE(HAVE_RINT), , $HPUXMATHLIB))
                    891: 
                    892: dnl Some old versions of libreadline don't have rl_completion_append_character
                    893: AC_EGREP_HEADER(rl_completion_append_character, readline.h,
                    894:        AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER),
                    895:        [AC_EGREP_HEADER(rl_completion_append_character, readline/readline.h,
                    896:                AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER))])
                    897: AC_SUBST(HAVE_RL_COMPLETION_APPEND_CHARACTER)
                    898: 
                    899: dnl Check for readline's filename_completion_function.
                    900: dnl Some versions have it but it's not in the headers, so we have to take
                    901: dnl care of that, too.
                    902: AC_CHECK_FUNCS(filename_completion_function,
                    903:     AC_EGREP_HEADER(filename_completion_function, readline.h,
                    904:         AC_DEFINE(HAVE_FILENAME_COMPLETION_FUNCTION_DECL),
                    905:         [AC_EGREP_HEADER(filename_completion_function, readline/readline.h,
                    906:             AC_DEFINE(HAVE_FILENAME_COMPLETION_FUNCTION_DECL))])
                    907: )
                    908: AC_SUBST(HAVE_FILENAME_COMPLETION_FUNCTION)
                    909: AC_SUBST(HAVE_FILENAME_COMPLETION_FUNCTION_DECL)
                    910: 
                    911: dnl Check for GNU style long options support (getopt_long)
                    912: AC_CHECK_FUNCS(getopt_long)
                    913: 
                    914: dnl Cannot use AC_CHECK_FUNC because finite may be a macro
                    915: AC_MSG_CHECKING(for finite)
                    916: AC_TRY_LINK([#include <math.h>],
                    917:        [int dummy=finite(1.0);],
                    918:        [AC_DEFINE(HAVE_FINITE) AC_MSG_RESULT(yes)],
                    919:        AC_MSG_RESULT(no))
                    920: 
                    921: dnl Cannot use AC_CHECK_FUNC because sigsetjmp may be a macro
                    922: dnl (especially on GNU libc)
                    923: dnl See also comments in config.h.
                    924: AC_MSG_CHECKING(for sigsetjmp)
                    925: AC_TRY_LINK([#include <setjmp.h>],
                    926:        [sigjmp_buf x; sigsetjmp(x, 1);],
                    927:        [AC_DEFINE(HAVE_SIGSETJMP) AC_MSG_RESULT(yes)],
                    928:        AC_MSG_RESULT(no))
                    929: 
                    930: AC_ARG_ENABLE(syslog, [  --enable-syslog         enable logging to syslog],
                    931:     [case $enableval in y|ye|yes)
                    932:        AC_CHECK_FUNC(syslog, [AC_DEFINE(ENABLE_SYSLOG)], [AC_MSG_ERROR([no syslog interface found])])
                    933:         ;;
                    934:      esac]
                    935: )
                    936: 
                    937: dnl Check to see if we have a working 64-bit integer type.
                    938: dnl This breaks down into two steps:
                    939: dnl (1) figure out if the compiler has a 64-bit int type with working
                    940: dnl arithmetic, and if so
                    941: dnl (2) see whether snprintf() can format the type correctly.  (Currently,
                    942: dnl snprintf is the only library routine we really need for int8 support.)
                    943: dnl It's entirely possible to have a compiler that handles a 64-bit type
                    944: dnl when the C library doesn't; this is fairly likely when using gcc on
                    945: dnl an older platform, for example.
                    946: dnl If there is no native snprintf() or it does not handle the 64-bit type,
                    947: dnl we force our own version of snprintf() to be used instead.
                    948: dnl Note this test must be run after our initial check for snprintf/vsnprintf.
                    949: 
1.6       petere    950: PGAC_TYPE_64BIT_INT([long int])
1.1       petere    951: 
1.6       petere    952: if test x"$HAVE_LONG_INT_64" = x"no" ; then
                    953:   PGAC_TYPE_64BIT_INT([long long int])
                    954: fi
1.1       petere    955: 
                    956: 
                    957: dnl If we found "long int" is 64 bits, assume snprintf handles it.
                    958: dnl If we found we need to use "long long int", better check.
                    959: dnl We cope with snprintfs that use either %lld or %qd as the format.
                    960: dnl If neither works, fall back to our own snprintf emulation (which we
                    961: dnl know uses %lld).
                    962: 
1.7       petere    963: if [[ x"$HAVE_LONG_LONG_INT_64" = xyes ]] ; then
1.1       petere    964:   if [[ x$SNPRINTF = x ]] ; then
                    965:     AC_MSG_CHECKING(whether snprintf handles 'long long int' as %lld)
                    966:     AC_TRY_RUN([#include <stdio.h>
                    967: typedef long long int int64;
                    968: #define INT64_FORMAT "%lld"
                    969: 
                    970: int64 a = 20000001;
                    971: int64 b = 40000005;
                    972: 
                    973: int does_int64_snprintf_work()
                    974: {
                    975:   int64 c;
                    976:   char buf[100];
                    977: 
                    978:   if (sizeof(int64) != 8)
                    979:     return 0;                  /* doesn't look like the right size */
                    980: 
                    981:   c = a * b;
                    982:   snprintf(buf, 100, INT64_FORMAT, c);
                    983:   if (strcmp(buf, "800000140000005") != 0)
                    984:     return 0;                  /* either multiply or snprintf is busted */
                    985:   return 1;
                    986: }
                    987: main() {
                    988:   exit(! does_int64_snprintf_work());
                    989: }],
                    990:        [ AC_MSG_RESULT(yes)
                    991:          INT64_FORMAT='"%lld"'
                    992:        ],
                    993:   [ AC_MSG_RESULT(no)
                    994:     AC_MSG_CHECKING(whether snprintf handles 'long long int' as %qd) 
                    995:     AC_TRY_RUN([#include <stdio.h>
                    996: typedef long long int int64;
                    997: #define INT64_FORMAT "%qd"
                    998:    
                    999: int64 a = 20000001;
                   1000: int64 b = 40000005;
                   1001:    
                   1002: int does_int64_snprintf_work()
                   1003: {  
                   1004:   int64 c;
                   1005:   char buf[100];
                   1006: 
                   1007:   if (sizeof(int64) != 8)
                   1008:     return 0;     /* doesn't look like the right size */
                   1009: 
                   1010:   c = a * b;
                   1011:   snprintf(buf, 100, INT64_FORMAT, c);
                   1012:   if (strcmp(buf, "800000140000005") != 0)
                   1013:     return 0;     /* either multiply or snprintf is busted */
                   1014:   return 1;
                   1015: }
                   1016: main() {
                   1017:   exit(! does_int64_snprintf_work());
                   1018: }],
                   1019:   [ AC_MSG_RESULT(yes)
                   1020:     INT64_FORMAT='"%qd"'
                   1021:   ],
                   1022:   [ AC_MSG_RESULT(no)
                   1023:        # Force usage of our own snprintf, since system snprintf is broken
                   1024:        SNPRINTF='snprintf.o'
                   1025:        INT64_FORMAT='"%lld"'
                   1026:   ],
                   1027:   [ AC_MSG_RESULT(assuming not on target machine)
                   1028:        # Force usage of our own snprintf, since we cannot test foreign snprintf
                   1029:        SNPRINTF='snprintf.o'
                   1030:        INT64_FORMAT='"%lld"'
                   1031:   ]) ],
                   1032:   [ AC_MSG_RESULT(assuming not on target machine)
                   1033:        # Force usage of our own snprintf, since we cannot test foreign snprintf
                   1034:        SNPRINTF='snprintf.o'
                   1035:        INT64_FORMAT='"%lld"'
                   1036:   ])
                   1037:   else
                   1038:     # here if we previously decided we needed to use our own snprintf
                   1039:     INT64_FORMAT='"%lld"'
                   1040:   fi
                   1041: else
                   1042:   # Here if we are not using 'long long int' at all
                   1043:   INT64_FORMAT='"%ld"'
                   1044: fi
                   1045: 
                   1046: AC_DEFINE_UNQUOTED(INT64_FORMAT, $INT64_FORMAT)
                   1047: 
                   1048: 
                   1049: dnl Determine memory alignment requirements for the basic C datatypes.
                   1050: 
1.6       petere   1051: PGAC_CHECK_ALIGNOF(short)
                   1052: PGAC_CHECK_ALIGNOF(int)
                   1053: PGAC_CHECK_ALIGNOF(long)
1.7       petere   1054: if [[ x"$HAVE_LONG_LONG_INT_64" = xyes ]] ; then
1.6       petere   1055:   PGAC_CHECK_ALIGNOF(long long int)
1.1       petere   1056: fi
1.6       petere   1057: PGAC_CHECK_ALIGNOF(double)
1.1       petere   1058: 
                   1059: dnl Compute maximum alignment of any basic type.
                   1060: dnl We assume long's alignment is at least as strong as char, short, or int;
                   1061: dnl but we must check long long (if it exists) and double.
                   1062: 
1.6       petere   1063: if test $pgac_cv_alignof_double != 'sizeof(double)' ; then
                   1064:   MAX_ALIGNOF=$pgac_cv_alignof_long
                   1065:   if test $MAX_ALIGNOF -lt $pgac_cv_alignof_double ; then
                   1066:     MAX_ALIGNOF=$pgac_cv_alignof_double
1.1       petere   1067:   fi
1.7       petere   1068:   if test x"$HAVE_LONG_LONG_INT_64" = xyes && test $MAX_ALIGNOF -lt $pgac_cv_alignof_long_long_int ; then
1.6       petere   1069:     MAX_ALIGNOF="$pgac_cv_alignof_long_long_int"
1.1       petere   1070:   fi
                   1071: else
                   1072:   dnl cross-compiling: assume that double's alignment is worst case
1.6       petere   1073:   MAX_ALIGNOF="$pgac_cv_alignof_double"
1.1       petere   1074: fi
1.6       petere   1075: AC_DEFINE_UNQUOTED(MAXIMUM_ALIGNOF, $MAX_ALIGNOF, [Define as the maximum alignment requirement of any type])
1.1       petere   1076: 
1.6       petere   1077: PGAC_FUNC_POSIX_SIGNALS
1.1       petere   1078: 
                   1079: 
                   1080: dnl Check for Tcl configuration script tclConfig.sh
                   1081: 
                   1082: dnl If --with-tclconfig was given, don't check for tclsh, tcl
                   1083: if test -z "$TCL_DIRS"
                   1084: then
                   1085:        AC_PATH_PROG(TCLSH, tclsh)
                   1086:        if test -z "$TCLSH"
                   1087:        then
                   1088:                AC_PATH_PROG(TCLSH, tcl)
                   1089:                if test -z "$TCLSH"
                   1090:                then
                   1091:                        AC_MSG_WARN(TCL/TK support disabled; tcl shell is not in your path)
                   1092:                        USE_TCL=
                   1093:                fi
                   1094:        fi
                   1095: fi
                   1096:        
                   1097: if test "$USE_TCL" = true
                   1098: then
                   1099:        AC_MSG_CHECKING(for tclConfig.sh)
                   1100:        TCL_CONFIG_SH=
                   1101:        library_dirs=
                   1102:        if test -z "$TCL_DIRS"
                   1103:        then
                   1104:                library_dirs=`echo 'puts $auto_path' | $TCLSH`
                   1105:        fi
                   1106:        library_dirs="$TCL_DIRS $TK_DIRS $library_dirs"
                   1107:        for dir in $library_dirs; do
                   1108:                if test -d "$dir" -a -r "$dir/tclConfig.sh"; then
                   1109:                        TCL_CONFIG_SH=$dir/tclConfig.sh
                   1110:                        break
                   1111:                fi
                   1112:        done
                   1113:        if test -z "$TCL_CONFIG_SH"; then
                   1114:                AC_MSG_RESULT(no)
                   1115:                AC_MSG_WARN(TCL/TK support disabled; Tcl configuration script missing)
                   1116:                USE_TCL=
                   1117:        else
                   1118:                AC_MSG_RESULT($TCL_CONFIG_SH)
                   1119:                AC_SUBST(TCL_CONFIG_SH)
                   1120:        fi
                   1121: fi
                   1122: 
                   1123: USE_TK=$USE_TCL                # If TCL is disabled, disable TK
                   1124: 
                   1125: dnl Check for Tk configuration script tkConfig.sh
                   1126: if test "$USE_TK" = true
                   1127: then
                   1128:        AC_MSG_CHECKING(for tkConfig.sh)
                   1129:        TK_CONFIG_SH=
                   1130:        # library_dirs are set in the check for TCL
                   1131:        for dir in $library_dirs
                   1132:        do
                   1133:                if test -d "$dir" -a -r "$dir/tkConfig.sh"
                   1134:                then
                   1135:                        TK_CONFIG_SH=$dir/tkConfig.sh
                   1136:                        break
                   1137:                fi
                   1138:        done
                   1139:        if test -z "$TK_CONFIG_SH"
                   1140:        then
                   1141:                AC_MSG_RESULT(no)
                   1142:                AC_MSG_WARN(TK support disabled; Tk configuration script missing)
                   1143:                USE_TK=
                   1144:        else
                   1145:                AC_MSG_RESULT($TK_CONFIG_SH)
                   1146:                AC_SUBST(TK_CONFIG_SH)
                   1147:                AC_PATH_PROG(WISH, wish)
                   1148:        fi
                   1149: fi
                   1150: 
                   1151: USE_X=$USE_TK
                   1152: 
                   1153: dnl Check for X libraries
                   1154: 
                   1155: if test "$USE_X" = true; then
                   1156: 
                   1157:        ice_save_LIBS="$LIBS"
                   1158:        ice_save_CFLAGS="$CFLAGS"
                   1159:        ice_save_CPPFLAGS="$CPPFLAGS"
                   1160:        ice_save_LDFLAGS="$LDFLAGS"
                   1161: 
                   1162:        AC_PATH_XTRA
                   1163: 
                   1164:        LIBS="$LIBS $X_EXTRA_LIBS"
                   1165:        CFLAGS="$CFLAGS $X_CFLAGS"
                   1166:        CPPFLAGS="$CPPFLAGS $X_CFLAGS"
                   1167:        LDFLAGS="$LDFLAGS $X_LIBS"
                   1168: 
                   1169:        dnl Check for X library
                   1170: 
                   1171:        X11_LIBS=""
                   1172:        AC_CHECK_LIB(X11, XOpenDisplay, X11_LIBS="-lX11",,${X_PRE_LIBS})
                   1173:        if test "$X11_LIBS" = ""; then
                   1174:                dnl Not having X is bad news for pgtksh. Let the user fix this.
                   1175:                AC_MSG_WARN([The X11 library '-lX11' could not be found,
                   1176: so TK support will be disabled.  To enable TK support,
                   1177: please use the configure options '--x-includes=DIR'
                   1178: and '--x-libraries=DIR' to specify the X location.
                   1179: See the file 'config.log' for further diagnostics.])
                   1180:                USE_TK=
                   1181:        fi
                   1182:        AC_SUBST(X_LIBS)
                   1183:        AC_SUBST(X11_LIBS)
                   1184:        AC_SUBST(X_PRE_LIBS)
                   1185: 
                   1186:        LIBS="$ice_save_LIBS"
                   1187:        CFLAGS="$ice_save_CFLAGS"
                   1188:        CPPFLAGS="$ice_save_CPPFLAGS"
                   1189:        LDFLAGS="$ice_save_LDFLAGS"
                   1190: fi
                   1191: 
                   1192: 
                   1193: dnl Finally ready to produce output files ...
                   1194: 
                   1195: AC_OUTPUT(
                   1196:        GNUmakefile
                   1197:        src/GNUmakefile
                   1198:        src/Makefile.global
                   1199:        src/backend/port/Makefile
                   1200:        src/backend/catalog/genbki.sh
                   1201:        src/backend/utils/Gen_fmgrtab.sh
                   1202:        src/bin/pgtclsh/mkMakefile.tcldefs.sh
                   1203:        src/bin/pgtclsh/mkMakefile.tkdefs.sh
                   1204:        src/include/version.h
                   1205:        src/pl/tcl/mkMakefile.tcldefs.sh
                   1206:        src/test/regress/GNUmakefile
                   1207: )

PostgreSQL CVSweb <[email protected]>