Annotation of pgsql/configure.in, revision 1.11

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

PostgreSQL CVSweb <[email protected]>