Annotation of pgsql/configure.in, revision 1.26

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

PostgreSQL CVSweb <[email protected]>