Annotation of pgsql/configure.in, revision 1.162
1.1 petere 1: dnl Process this file with autoconf to produce a configure script.
1.28 petere 2:
3: dnl Developers, please strive to achieve this order:
4: dnl
5: dnl 0. Initialization and options processing
6: dnl 1. Programs
7: dnl 2. Libraries
8: dnl 3. Header files
9: dnl 4. Types
10: dnl 5. Structures
11: dnl 6. Compiler characteristics
12: dnl 7. Functions, global variables
13: dnl 8. System services
14: dnl
15: dnl Read the Autoconf manual for details.
16:
1.32 petere 17: dnl The GNU folks apparently haven't heard that some people don't use
18: dnl Texinfo. Use this sorcery to use "docdir" instead of "infodir".
19: define([info], [doc])
20: define([infodir], [docdir])
1.1 petere 21: AC_INIT(src/backend/access/common/heaptuple.c)
1.32 petere 22: undefine([infodir])
23: undefine([info])
24:
1.1 petere 25: AC_PREFIX_DEFAULT(/usr/local/pgsql)
1.133 petere 26: AC_CONFIG_HEADER(src/include/pg_config.h)
1.1 petere 27:
28: AC_PREREQ(2.13)
1.28 petere 29: AC_CONFIG_AUX_DIR(config)
1.5 petere 30:
1.161 pgsql 31: VERSION='7.2rc1'
1.24 petere 32: AC_SUBST(VERSION)
33: AC_DEFINE_UNQUOTED(PG_VERSION, "$VERSION")
34:
1.80 petere 35: unset CDPATH
1.61 petere 36:
1.1 petere 37: AC_CANONICAL_HOST
1.45 petere 38: AC_SUBST(host)
39: AC_SUBST(host_cpu)
40: AC_SUBST(host_os)
1.1 petere 41:
1.30 petere 42: template=
43: AC_MSG_CHECKING([which template to use])
44:
1.42 petere 45: PGAC_ARG_REQ(with, template, [],
46: [
47: case $withval in
1.30 petere 48: list) echo; ls "$srcdir/src/template"; exit;;
49: *) if test -f "$srcdir/src/template/$with_template" ; then
1.42 petere 50: template=$withval
1.30 petere 51: else
1.80 petere 52: AC_MSG_ERROR(['$withval' is not a valid template name. Use 'list' for a list.])
1.30 petere 53: fi;;
54: esac
1.42 petere 55: ],
56: [
57: # --with-template not given
1.30 petere 58:
59: case $host_os in
60: aix*) template=aix ;;
1.54 momjian 61: beos*) template=beos ;;
1.30 petere 62: bsdi*) template=bsdi ;;
63: cygwin*) template=win ;;
1.72 petere 64: darwin*) template=darwin ;;
1.30 petere 65: dgux*) template=dgux ;;
66: freebsd*) template=freebsd ;;
67: hpux*) template=hpux ;;
68: irix*) template=irix5 ;;
69: linux*) template=linux ;;
70: netbsd*) template=netbsd ;;
71: nextstep*) template=nextstep ;;
72: openbsd*) template=openbsd ;;
73: osf*) template=osf ;;
74: qnx*) template=qnx4 ;;
75: sco*) template=sco ;;
1.58 petere 76: solaris*) template=solaris ;;
1.30 petere 77: sunos*) template=sunos4 ;;
1.1 petere 78: sysv4.2*)
1.30 petere 79: case $host_vendor in
80: univel) template=univel ;;
81: esac ;;
82: sysv4*) template=svr4 ;;
1.133 petere 83: sysv5*) template=unixware ;;
1.30 petere 84: ultrix*) template=ultrix4 ;;
1.1 petere 85: esac
86:
1.30 petere 87: if test x"$template" = x"" ; then
1.80 petere 88: AC_MSG_ERROR([[
1.30 petere 89: *******************************************************************
90: PostgreSQL has apparently not been ported to your platform yet.
1.32 petere 91: To try a manual configuration, look into the src/template directory
1.80 petere 92: for a similar platform and use the '--with-template=' option.
1.30 petere 93:
94: Please also contact <[email protected]> to see about
1.80 petere 95: rectifying this. Include the above 'checking host system type...'
1.30 petere 96: line.
97: *******************************************************************
1.80 petere 98: ]])
1.30 petere 99: fi
100:
1.42 petere 101: ])
1.1 petere 102:
1.30 petere 103: AC_MSG_RESULT([$template])
1.1 petere 104:
1.30 petere 105: PORTNAME=$template
106: AC_SUBST(PORTNAME)
1.1 petere 107:
1.30 petere 108: AC_LINK_FILES([src/backend/port/dynloader/${template}.c], [src/backend/port/dynloader.c])
109: AC_LINK_FILES([src/backend/port/dynloader/${template}.h], [src/include/dynloader.h])
1.133 petere 110: AC_LINK_FILES([src/include/port/${template}.h], [src/include/pg_config_os.h])
1.30 petere 111: AC_LINK_FILES([src/makefiles/Makefile.${template}], [src/Makefile.port])
112:
1.58 petere 113: # Pick right test-and-set (TAS) code. Most platforms have inline
114: # assembler code in src/include/storage/s_lock.h, so we just use
115: # a dummy file here.
116: case $host in
117: *-*-hpux*) need_tas=yes; tas_file=hpux.s ;;
118: sparc-*-solaris*) need_tas=yes; tas_file=solaris_sparc.s ;;
1.147 momjian 119: i?86-*-solaris*) need_tas=yes; tas_file=solaris_i386.s ;;
1.63 petere 120: *) need_tas=no; tas_file=dummy.s ;;
1.30 petere 121: esac
1.63 petere 122: AC_LINK_FILES([src/backend/port/tas/${tas_file}], [src/backend/port/tas.s])
1.1 petere 123:
1.30 petere 124: if test "$need_tas" = yes ; then
125: TAS=tas.o
1.1 petere 126: fi
1.30 petere 127: AC_SUBST(TAS)
1.1 petere 128:
129:
130:
1.30 petere 131: ##
132: ## Command line options
133: ##
1.13 petere 134:
1.1 petere 135:
1.30 petere 136: #
137: # Add non-standard directories to the include path
138: #
1.42 petere 139: PGAC_ARG_REQ(with, includes, [ --with-includes=DIRS look for additional header files in DIRS])
1.1 petere 140:
141:
1.30 petere 142: #
143: # Add non-standard directories to the library search path
144: #
1.42 petere 145: PGAC_ARG_REQ(with, libraries, [ --with-libraries=DIRS look for additional libraries in DIRS],
146: [LIBRARY_DIRS=$withval])
1.1 petere 147:
1.42 petere 148: PGAC_ARG_REQ(with, libs, [ --with-libs=DIRS alternative spelling of --with-libraries],
149: [LIBRARY_DIRS=$withval])
1.29 petere 150:
151:
152: #
153: # Locale (--enable-locale)
154: #
155: AC_MSG_CHECKING([whether to build with locale support])
1.42 petere 156: PGAC_ARG_BOOL(enable, locale, no, [ --enable-locale enable locale support],
157: [AC_DEFINE([USE_LOCALE], 1,
158: [Set to 1 if you want LOCALE support (--enable-locale)])])
1.29 petere 159: AC_MSG_RESULT([$enable_locale])
1.2 petere 160:
1.1 petere 161:
1.29 petere 162: #
1.42 petere 163: # Character set recode (--enable-recode)
1.29 petere 164: #
1.42 petere 165: AC_MSG_CHECKING([whether to build with recode support])
166: PGAC_ARG_BOOL(enable, recode, no, [ --enable-recode enable character set recode support],
167: [AC_DEFINE([CYR_RECODE], 1,
168: [Set to 1 if you want cyrillic recode support (--enable-recode)])])
1.29 petere 169: AC_MSG_RESULT([$enable_recode])
1.1 petere 170:
171:
1.29 petere 172: #
173: # Multibyte support
174: #
175: MULTIBYTE=
176: AC_MSG_CHECKING([whether to build with multibyte character support])
1.42 petere 177:
178: PGAC_ARG_OPTARG(enable, multibyte, [ --enable-multibyte enable multibyte character support],
179: [MULTIBYTE=SQL_ASCII],
1.29 petere 180: [
181: case $enableval in
1.146 ishii 182: SQL_ASCII|EUC_JP|EUC_CN|EUC_KR|EUC_TW|UNICODE|MULE_INTERNAL|LATIN1|LATIN2|LATIN3|LATIN4|LATIN5|LATIN6|LATIN7|LATIN8|LATIN9|LATIN10|KOI8|WIN|ALT|ISO_8859_5|ISO_8859_6|ISO_8859_7|ISO_8859_8)
1.42 petere 183: MULTIBYTE=$enableval;;
184: *)
185: AC_MSG_ERROR(
1.29 petere 186: [argument to --enable-multibyte must be one of:
1.1 petere 187: SQL_ASCII, EUC_JP, EUC_CN, EUC_KR, EUC_TW,
188: UNICODE, MULE_INTERNAL,
189: LATIN1, LATIN2, LATIN3, LATIN4, LATIN5,
1.146 ishii 190: LATIN6, LATIN7, LATIN8, LATIN9, LATIN10,
1.144 ishii 191: KOI8, WIN, ALT,
1.146 ishii 192: ISO_8859_5, ISO_8859_6, ISO_8859_7, ISO_8859_8
1.42 petere 193: Or do not specify an argument to the option to use the default.]);;
1.29 petere 194: esac
195: ],
1.42 petere 196: [
197: AC_DEFINE(MULTIBYTE, 1, [Set to 1 if you want to use multibyte characters (--enable-multibyte)])
198: AC_MSG_RESULT([yes, default $MULTIBYTE])
199: ],
200: [AC_MSG_RESULT(no)])
1.29 petere 201:
202: AC_SUBST(MULTIBYTE)
1.1 petere 203:
1.70 ishii 204: #
1.128 petere 205: # NLS
206: #
207: AC_MSG_CHECKING([whether NLS is wanted])
208: PGAC_ARG_OPTARG(enable, nls,
1.158 petere 209: [ --enable-nls[=LANGUAGES] enable Native Language Support],
1.128 petere 210: [],
211: [WANTED_LANGUAGES=$enableval],
212: [AC_DEFINE(ENABLE_NLS)])
213: AC_MSG_RESULT([$enable_nls])
214: AC_SUBST(enable_nls)
215: AC_SUBST(WANTED_LANGUAGES)
216:
217: #
1.29 petere 218: # Default port number (--with-pgport), default 5432
219: #
220: AC_MSG_CHECKING([for default port number])
1.42 petere 221: PGAC_ARG_REQ(with, pgport, [ --with-pgport=PORTNUM change default port number [5432]],
222: [default_port=$withval],
223: [default_port=5432])
1.97 tgl 224: AC_MSG_RESULT([$default_port])
225: # Need both of these because some places want an integer and some a string
1.1 petere 226: AC_DEFINE_UNQUOTED(DEF_PGPORT, ${default_port})
227: AC_DEFINE_UNQUOTED(DEF_PGPORT_STR, "${default_port}")
1.97 tgl 228: AC_SUBST(default_port)
1.1 petere 229:
1.29 petere 230: #
231: # Maximum number of allowed connections (--with-maxbackends), default 32
232: #
233: AC_MSG_CHECKING([for default soft limit on number of connections])
1.42 petere 234: PGAC_ARG_REQ(with, maxbackends, [ --with-maxbackends=N set default maximum number of connections [32]],
235: [],
236: [with_maxbackends=32])
1.29 petere 237: AC_MSG_RESULT([$with_maxbackends])
1.42 petere 238: AC_DEFINE_UNQUOTED([DEF_MAXBACKENDS], [$with_maxbackends],
239: [The default soft limit on the number of concurrent connections, i.e., the default for the postmaster -N switch (--with-maxbackends)])
1.29 petere 240:
1.1 petere 241:
1.29 petere 242: #
1.65 petere 243: # Option to disable shared libraries
244: #
245: PGAC_ARG_BOOL(enable, shared, yes,
1.68 petere 246: [ --disable-shared do not build shared libraries])
1.65 petere 247: AC_SUBST(enable_shared)
248:
1.69 petere 249: #
250: # '-rpath'-like feature can be disabled
251: #
252: PGAC_ARG_BOOL(enable, rpath, yes,
253: [ --disable-rpath do not embed shared library search path in executables])
254: AC_SUBST(enable_rpath)
255:
1.65 petere 256:
257: #
1.74 petere 258: # --enable-debug adds -g to compiler flags
259: #
260: PGAC_ARG_BOOL(enable, debug, no,
261: [ --enable-debug build with debugging symbols (-g)])
262:
263:
264: #
1.30 petere 265: # C compiler
266: #
267:
1.29 petere 268: # For historical reasons you can also use --with-CC to specify the C compiler
269: # to use, although the standard way to do this is to set the CC environment
270: # variable.
1.42 petere 271: PGAC_ARG_REQ(with, CC, [], [CC=$with_CC])
1.4 tgl 272:
1.30 petere 273: # On AIX, default compiler to xlc.
274: if test "$template" = aix && test -z "$CC" ; then CC=xlc; fi
1.4 tgl 275:
1.74 petere 276: # Save CFLAGS from the environment
277: has_environ_CFLAGS="${CFLAGS+yes}"
278: save_CFLAGS=$CFLAGS
279:
1.4 tgl 280: AC_PROG_CC
1.30 petere 281: # Read the template
282: . "$srcdir/src/template/$template" || exit
1.74 petere 283:
284: if test "$has_environ_CFLAGS" = yes; then
285: CFLAGS=$save_CFLAGS
286: fi
287: if test "$enable_debug" = yes && test "$ac_cv_prog_cc_g" = yes; then
288: CFLAGS="$CFLAGS -g"
289: fi
1.30 petere 290: echo "using CFLAGS=$CFLAGS"
291: # Check if the compiler still works with the template settings
292: AC_PROG_CC_WORKS
1.44 petere 293: AC_EXEEXT
1.4 tgl 294: AC_PROG_CPP
295: AC_PROG_GCC_TRADITIONAL
1.6 petere 296: AC_SUBST(GCC)
1.4 tgl 297:
1.29 petere 298: # Create compiler version string
1.24 petere 299: if test x"$GCC" = x"yes" ; then
1.162 ! tgl 300: cc_string="GCC `${CC} --version | head -1`"
1.4 tgl 301: else
1.24 petere 302: cc_string=$CC
1.4 tgl 303: fi
1.24 petere 304: 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])
305:
1.4 tgl 306:
1.31 petere 307: #
308: # Automatic dependency tracking
309: #
1.42 petere 310: PGAC_ARG_BOOL(enable, depend, no, [ --enable-depend turn on automatic dependency tracking],
311: [autodepend=yes])
1.31 petere 312: AC_SUBST(autodepend)
313:
314:
1.42 petere 315: #
316: # Enable assert checks
317: #
318: PGAC_ARG_BOOL(enable, cassert, no, [ --enable-cassert enable assertion checks (for debugging)],
319: [AC_DEFINE([USE_ASSERT_CHECKING], 1,
320: [Define to 1 to build with assertion checks])])
1.30 petere 321:
322:
323: #
324: # Include directories
325: #
326: ac_save_IFS=$IFS
1.80 petere 327: IFS="${IFS}:"
1.30 petere 328: # SRCH_INC comes from the template file
329: for dir in $with_includes $SRCH_INC; do
330: if test -d "$dir"; then
331: INCLUDES="$INCLUDES -I$dir"
332: else
333: AC_MSG_WARN([*** Include directory $dir does not exist.])
334: fi
335: done
336: IFS=$ac_save_IFS
337: AC_SUBST(INCLUDES)
338:
339:
340: #
341: # Library directories
342: #
343: ac_save_IFS=$IFS
1.80 petere 344: IFS="${IFS}:"
1.30 petere 345: # LIBRARY_DIRS comes from command line, SRCH_LIB from template file.
346: for dir in $LIBRARY_DIRS $SRCH_LIB; do
347: if test -d "$dir"; then
1.68 petere 348: LIBDIRS="$LIBDIRS -L$dir"
1.30 petere 349: else
350: AC_MSG_WARN([*** Library directory $dir does not exist.])
351: fi
352: done
353: IFS=$ac_save_IFS
354:
355:
1.43 petere 356: #
357: # Tcl/Tk
358: #
359: AC_MSG_CHECKING([whether to build with Tcl])
360: PGAC_ARG_BOOL(with, tcl, no, [ --with-tcl build Tcl and Tk interfaces])
361: AC_MSG_RESULT([$with_tcl])
362: AC_SUBST([with_tcl])
363:
364: # If Tcl is enabled (above) then Tk is also, unless the user disables it using --without-tk
365: AC_MSG_CHECKING([whether to build with Tk])
366: if test "$with_tcl" = yes; then
367: PGAC_ARG_BOOL(with, tk, yes, [ --without-tk do not build Tk interfaces if Tcl is enabled])
368: else
369: with_tk=no
370: fi
371: AC_MSG_RESULT([$with_tk])
372: AC_SUBST([with_tk])
1.1 petere 373:
374:
1.42 petere 375: # We see if the path to the TCL/TK configuration scripts is specified.
376: # This will override the use of tclsh to find the paths to search.
377:
1.43 petere 378: PGAC_ARG_REQ(with, tclconfig, [ --with-tclconfig=DIR tclConfig.sh and tkConfig.sh are in DIR])
1.1 petere 379:
1.42 petere 380: # We see if the path to the TK configuration scripts is specified.
381: # This will override the use of tclsh to find the paths to search.
1.1 petere 382:
1.43 petere 383: PGAC_ARG_REQ(with, tkconfig, [ --with-tkconfig=DIR tkConfig.sh is in DIR])
1.125 petere 384:
1.42 petere 385: #
386: # Optionally build Perl modules (Pg.pm and PL/Perl)
387: #
388: AC_MSG_CHECKING([whether to build Perl modules])
389: PGAC_ARG_BOOL(with, perl, no, [ --with-perl build Perl interface and PL/Perl])
390: AC_MSG_RESULT([$with_perl])
1.5 petere 391: AC_SUBST(with_perl)
392:
1.42 petere 393: #
394: # Optionally build Python interface module
395: #
396: AC_MSG_CHECKING([whether to build Python modules])
1.126 petere 397: PGAC_ARG_BOOL(with, python, no, [ --with-python build Python interface module])
398: AC_MSG_RESULT([$with_python])
1.5 petere 399: AC_SUBST(with_python)
1.1 petere 400:
1.105 peter 401: #
402: # Optionally build the Java/JDBC tools
403: #
404: AC_MSG_CHECKING([whether to build Java/JDBC tools])
1.108 petere 405: PGAC_ARG_BOOL(with, java, no, [ --with-java build JDBC interface and Java tools],
1.105 peter 406: [AC_MSG_RESULT(yes)
1.108 petere 407: PGAC_PATH_ANT
408: if test -z "$ANT"; then
409: AC_MSG_ERROR([Ant is required to build Java components])
410: fi],
1.105 peter 411: [AC_MSG_RESULT(no)])
412: AC_SUBST(with_java)
1.13 petere 413:
1.28 petere 414: dnl A note on the Kerberos and OpenSSL options:
1.13 petere 415: dnl
1.28 petere 416: dnl The user can give an argument to the option in order the specify
417: dnl the base path of the respective installation (what he specified
418: dnl perhaps as --prefix). If no argument is given ($withval is "yes")
419: dnl then we take the path where the package installs by default. This
420: dnl way the user doesn't have to use redundant --with-includes and
421: dnl --with-libraries options, but he can still use them if the layout
422: dnl is non-standard.
423:
424: #
425: # Kerberos 4
426: #
1.42 petere 427: PGAC_ARG_OPTARG(with, krb4, [ --with-krb4[=DIR] build with Kerberos 4 support [/usr/athena]],
428: [krb4_prefix=/usr/athena],
429: [krb4_prefix=$withval],
430: [
1.28 petere 431: AC_MSG_RESULT([building with Kerberos 4 support])
1.42 petere 432: AC_DEFINE(KRB4, 1, [Define if you are building with Kerberos 4 support.])
1.28 petere 433:
1.68 petere 434: if test -d "$krb4_prefix/include"; then
435: INCLUDES="$INCLUDES -I$krb4_prefix/include"
436: fi
437: if test -d "$krb4_prefix/lib"; then
438: LIBDIRS="$LIBDIRS -L$krb4_prefix/lib"
1.13 petere 439: fi
1.37 petere 440:
1.42 petere 441: krb_srvtab="/etc/srvtab"
442: ])
443:
444: AC_SUBST(with_krb4)
1.13 petere 445:
446:
1.28 petere 447: #
448: # Kerberos 5
449: #
1.42 petere 450: PGAC_ARG_OPTARG(with, krb5, [ --with-krb5[=DIR] build with Kerberos 5 support [/usr/athena]],
451: [krb5_prefix=/usr/athena],
452: [krb5_prefix=$withval],
453: [
1.28 petere 454: AC_MSG_RESULT([building with Kerberos 5 support])
1.42 petere 455: AC_DEFINE(KRB5, 1, [Define if you are building with Kerberos 5 support.])
1.28 petere 456:
1.68 petere 457: if test -d "$krb5_prefix/include"; then
458: INCLUDES="$INCLUDES -I$krb5_prefix/include"
459: fi
460: if test -d "$krb5_prefix/lib"; then
461: LIBDIRS="$LIBDIRS -L$krb5_prefix/lib"
1.13 petere 462: fi
1.28 petere 463:
1.42 petere 464: krb_srvtab="FILE:\$(sysconfdir)/krb5.keytab"
465: ])
466:
467: AC_SUBST(with_krb5)
1.28 petere 468:
469:
470: # Using both Kerberos 4 and Kerberos 5 at the same time isn't going to work.
471: if test "$with_krb4" = yes && test "$with_krb5" = yes ; then
472: AC_MSG_ERROR([Kerberos 4 and Kerberos 5 support cannot be combined])
473: fi
1.13 petere 474:
1.37 petere 475: AC_SUBST(krb_srvtab)
1.13 petere 476:
477:
1.28 petere 478: #
479: # Kerberos configuration parameters
480: #
1.42 petere 481: PGAC_ARG_REQ(with, krb-srvnam,
1.68 petere 482: [ --with-krb-srvnam=NAME name of the service principal in Kerberos [postgres]],
1.42 petere 483: [],
484: [with_krb_srvnam="postgres"])
485: AC_DEFINE_UNQUOTED([PG_KRB_SRVNAM], ["$with_krb_srvnam"],
486: [The name of the PostgreSQL service principal in Kerberos])
1.13 petere 487:
1.28 petere 488:
1.136 momjian 489: #
490: # PAM
491: #
492: AC_MSG_CHECKING([whether to build with PAM support])
1.158 petere 493: PGAC_ARG_BOOL(with, pam, no,
494: [ --with-pam build with PAM support],
495: [AC_DEFINE([USE_PAM], 1, [Define to build with PAM support])])
496: AC_MSG_RESULT([$with_pam])
1.136 momjian 497: AC_SUBST(with_pam)
498:
1.28 petere 499:
500: #
501: # OpenSSL
502: #
1.42 petere 503: PGAC_ARG_OPTARG(with, openssl,
504: [ --with-openssl[=DIR] build with OpenSSL support [/usr/local/ssl]],
505: [openssl_prefix=/usr/local/ssl],
506: [openssl_prefix=$withval],
507: [
1.28 petere 508: AC_MSG_RESULT([building with OpenSSL support])
1.42 petere 509: AC_DEFINE([USE_SSL], 1, [Define to build with (Open)SSL support])
1.28 petere 510:
511: if test -d "${openssl_prefix}/include" ; then
512: INCLUDES="$INCLUDES -I${openssl_prefix}/include"
513: fi
514: if test -d "${openssl_prefix}/lib" ; then
1.68 petere 515: LIBDIRS="$LIBDIRS -L${openssl_prefix}/lib"
1.28 petere 516: fi
1.42 petere 517: ])
518:
519: AC_SUBST(with_openssl)
1.28 petere 520:
1.13 petere 521:
522:
1.42 petere 523: #
524: # Optionally enable the building of the ODBC driver
525: #
1.15 petere 526:
1.42 petere 527: # Old option name
528: if test "${with_odbc+set}" = set && test "${enable_odbc+set}" != set; then
1.15 petere 529: enable_odbc=$with_odbc
530: fi
531:
1.42 petere 532: AC_MSG_CHECKING([whether to build the ODBC driver])
533: PGAC_ARG_BOOL(enable, odbc, no, [ --enable-odbc build the ODBC driver package])
1.142 petere 534: PGAC_ARG_BOOL(with, unixodbc, no, [ --with-unixodbc build ODBC driver for unixODBC])
535: PGAC_ARG_BOOL(with, iodbc, no, [ --with-iodbc build ODBC driver for iODBC])
536: if test "$with_unixodbc" = yes && test "$with_iodbc" = yes; then
537: AC_MSG_ERROR([ODBC driver cannot be built for both unixODBC and iODBC])
538: fi
539: if test "$with_unixodbc" = yes || test "$with_iodbc" = yes; then
540: enable_odbc=yes
541: fi
542: case $enable_odbc:$with_unixodbc:$with_iodbc in
543: yes:no:no) AC_MSG_RESULT([yes (stand-alone)]);;
544: yes:yes:no) AC_MSG_RESULT([yes (unixODBC)]); AC_DEFINE(WITH_UNIXODBC);;
545: yes:no:yes) AC_MSG_RESULT([yes (iODBC)]); AC_DEFINE(WITH_IODBC);;
546: no:*) AC_MSG_RESULT(no);;
547: esac
1.42 petere 548: AC_SUBST([enable_odbc])
1.142 petere 549: AC_SUBST([with_unixodbc])
550: AC_SUBST([with_iodbc])
1.8 momjian 551:
1.1 petere 552:
1.42 petere 553: # Allow for overriding the default location of the odbcinst.ini
554: # file which is normally ${sysconfdir} (i.e., ${prefix}/etc).
555: PGAC_ARG_REQ(with, odbcinst,
556: [ --with-odbcinst=DIR default directory for odbcinst.ini [sysconfdir]],
557: [odbcinst_ini_dir=$withval],
558: [odbcinst_ini_dir="\${sysconfdir}"])
559: AC_SUBST([odbcinst_ini_dir])
1.3 momjian 560:
561:
562:
1.30 petere 563: # Assume system is ELF if it predefines __ELF__ as 1,
564: # otherwise believe host_os based default.
565: case $host_os in
1.127 momjian 566: freebsd1*|freebsd2*) elf=no;;
567: freebsd3*|freebsd4*) elf=yes;;
1.30 petere 568: esac
1.1 petere 569:
570: AC_EGREP_CPP(yes,
571: [#if __ELF__
572: yes
573: #endif
574: ],
1.30 petere 575: [ELF_SYS=true],
576: [if test "X$elf" = "Xyes" ; then
577: ELF_SYS=true
1.1 petere 578: else
1.30 petere 579: ELF_SYS=
580: fi])
581: AC_SUBST(ELF_SYS)
1.1 petere 582:
583:
584:
1.42 petere 585: #
586: # Optionally build C++ code (i.e., libpq++)
587: #
1.36 petere 588: AC_MSG_CHECKING([whether to build C++ modules])
1.42 petere 589: PGAC_ARG_OPTARG(with, CXX, [ --with-CXX build C++ modules (libpq++)],
590: [],
591: [CXX=$withval],
592: [
593: AC_MSG_RESULT(yes)
1.71 petere 594:
595: # If the user has specified CXXFLAGS in the environment, leave it
596: # alone, else use a default.
597:
1.74 petere 598: has_environ_CXXFLAGS="${CXXFLAGS+yes}"
1.6 petere 599: AC_PROG_CXX
1.74 petere 600: if test "$has_environ_CXXFLAGS" != yes; then
1.71 petere 601: if test "$GXX" = yes; then
602: CXXFLAGS=-O2
603: else
604: case $template in
605: osf) CXXFLAGS='-O4 -Olimit 2000' ;;
606: unixware) CXXFLAGS='-O' ;;
607: *) CXXFLAGS= ;;
608: esac
609: fi
610: fi
611: if test "$enable_debug" = yes && test "$ac_cv_prog_cxx_g" = yes; then
612: CXXFLAGS="$CXXFLAGS -g"
613: fi
614: echo "using CXXFLAGS=$CXXFLAGS"
615:
1.6 petere 616: AC_PROG_CXXCPP
1.61 petere 617: AC_SUBST(GXX)
1.6 petere 618: PGAC_CLASS_STRING
619: PGAC_CXX_NAMESPACE_STD
1.42 petere 620: ],
621: [AC_MSG_RESULT(no)])
622: AC_SUBST(with_CXX)
1.1 petere 623:
1.30 petere 624: CPPFLAGS="$CPPFLAGS $INCLUDES"
1.68 petere 625: LDFLAGS="$LDFLAGS $LIBDIRS"
1.30 petere 626:
627: echo "using CPPFLAGS=$CPPFLAGS"
628: echo "using LDFLAGS=$LDFLAGS"
629:
630:
1.2 petere 631: AC_PROG_AWK
1.39 petere 632: PGAC_PATH_FLEX
1.1 petere 633: AC_PROG_LN_S
1.62 petere 634: AC_PROG_LD
1.67 petere 635: AC_SUBST(LD)
636: AC_SUBST(with_gnu_ld)
1.130 momjian 637: case $host_os in sysv5*)
1.77 petere 638: AC_CACHE_CHECK([whether ld -R works], [pgac_cv_prog_ld_R],
639: [
640: pgac_save_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS -Wl,-R/usr/lib"
641: AC_TRY_LINK([], [], [pgac_cv_prog_ld_R=yes], [pgac_cv_prog_ld_R=no])
642: LDFLAGS=$pgac_save_LDFLAGS
643: ])
644: ld_R_works=$pgac_cv_prog_ld_R
645: AC_SUBST(ld_R_works)
646: esac
1.1 petere 647: AC_PROG_RANLIB
1.58 petere 648: AC_CHECK_PROGS(LORDER, lorder)
1.56 petere 649: AC_PATH_PROG(TAR, tar)
1.98 petere 650:
651: AC_CHECK_PROGS(YACC, ['bison -y'])
652: if test -z "$YACC"; then
653: AC_MSG_WARN([
654: *** Without Bison you will not be able to build PostgreSQL from CVS or
655: *** change any of the parser definition files. You can obtain Bison from
656: *** a GNU mirror site. (If you are using the official distribution of
657: *** PostgreSQL then you do not need to worry about this because the Bison
658: *** output is pre-generated.) To use a different yacc program (possible,
659: *** but not recommended), set the environment variable YACC before running
660: *** 'configure'.])
661: fi
1.6 petere 662: AC_SUBST(YFLAGS)
1.98 petere 663:
1.43 petere 664: if test "$with_tk" = yes; then
665: AC_PATH_PROG(WISH, wish)
1.80 petere 666: test -z "$WISH" && AC_MSG_ERROR(['wish' is required for Tk support])
1.134 petere 667: fi
668:
669: PGAC_PATH_PERL
670: if test "$with_perl" = yes; then
671: PGAC_CHECK_PERL_DIRS
1.126 petere 672: fi
673:
674: if test "$with_python" = yes; then
675: PGAC_PATH_PYTHON
676: PGAC_CHECK_PYTHON_MODULE_SETUP
677: PGAC_CHECK_PYTHON_EMBED_SETUP
1.43 petere 678: fi
1.1 petere 679:
680:
1.29 petere 681: ##
682: ## Libraries
683: ##
684:
1.96 petere 685: PGAC_CHECK_READLINE
1.52 petere 686: AC_SEARCH_LIBS(using_history, history, [AC_DEFINE(HAVE_HISTORY_FUNCTIONS)])
1.1 petere 687:
688: if test "$PORTNAME" != "aix" -a "$PORTNAME" != "alpha"
689: then
690: AC_CHECK_LIB(bsd, main)
691: fi
1.21 petere 692: AC_CHECK_LIB(util, setproctitle)
1.1 petere 693: AC_CHECK_LIB(m, main)
694: AC_CHECK_LIB(dl, main)
695: AC_CHECK_LIB(socket, main)
696: AC_CHECK_LIB(nsl, main)
697: AC_CHECK_LIB(ipc, main)
698: AC_CHECK_LIB(IPC, main)
699: AC_CHECK_LIB(lc, main)
700: AC_CHECK_LIB(dld, main)
701: AC_CHECK_LIB(ld, main)
702: AC_CHECK_LIB(compat, main)
703: AC_CHECK_LIB(BSD, main)
704: AC_CHECK_LIB(gen, main)
705: AC_CHECK_LIB(PW, main)
1.95 petere 706: AC_CHECK_LIB(resolv, main)
1.139 petere 707: # QNX:
1.104 petere 708: AC_CHECK_LIB([[unix]], main)
1.21 petere 709: AC_SEARCH_LIBS(crypt, crypt)
1.139 petere 710: # BeOS:
1.86 tgl 711: AC_CHECK_LIB(bind, __inet_ntoa)
1.139 petere 712: # Only consider libz to be present if we find <zlib.h> as well;
713: # furthermore, check that <zlib.h> defines z_streamp (versions before
714: # about 1.0.4 did not). While we could work around the lack of z_streamp,
715: # it seems unwise to encourage people to use such old zlib versions...
1.119 tgl 716: AC_EGREP_HEADER(z_streamp, zlib.h, [
1.28 petere 717: AC_CHECK_LIB(z, inflate)
1.86 tgl 718: ])
1.139 petere 719: # Solaris:
1.140 petere 720: AC_SEARCH_LIBS(fdatasync, [rt posix4])
1.28 petere 721:
722: if test "$with_krb4" = yes ; then
1.80 petere 723: AC_CHECK_LIB(des, [des_encrypt], [], [AC_MSG_ERROR([library 'des' is required for Kerberos 4])])
724: AC_CHECK_LIB(krb, [krb_sendauth], [], [AC_MSG_ERROR([library 'krb' is required for Kerberos 4])])
1.28 petere 725: fi
726:
727: if test "$with_krb5" = yes ; then
1.80 petere 728: AC_CHECK_LIB(com_err, [com_err], [], [AC_MSG_ERROR([library 'com_err' is required for Kerberos 5])])
1.68 petere 729: AC_CHECK_LIB(crypto, [krb5_encrypt], [],
1.80 petere 730: [AC_CHECK_LIB(k5crypto, [krb5_encrypt], [], [AC_MSG_ERROR([library 'crypto' or 'k5crypto' is required for Kerberos 5])])])
731: AC_CHECK_LIB(krb5, [krb5_sendauth], [], [AC_MSG_ERROR([library 'krb5' is required for Kerberos 5])])
1.28 petere 732: fi
733:
734: if test "$with_openssl" = yes ; then
735: dnl Order matters!
1.80 petere 736: AC_CHECK_LIB(crypto, [CRYPTO_new_ex_data], [], [AC_MSG_ERROR([library 'crypto' is required for OpenSSL])])
737: AC_CHECK_LIB(ssl, [SSL_library_init], [], [AC_MSG_ERROR([library 'ssl' is required for OpenSSL])])
1.128 petere 738: fi
739:
1.136 momjian 740: if test "$with_pam" = yes ; then
741: AC_CHECK_LIB(pam, [pam_start], [], [AC_MSG_ERROR([library 'pam' is required for PAM])])
742: fi
743:
1.128 petere 744: if test "$enable_nls" = yes ; then
745: PGAC_CHECK_GETTEXT
1.28 petere 746: fi
1.1 petere 747:
1.29 petere 748: ##
749: ## Header files
750: ##
751: dnl sys/socket.h and sys/types.h are required by AC_FUNC_ACCEPT_ARGTYPES
1.66 tgl 752: AC_CHECK_HEADERS([crypt.h dld.h endian.h fp_class.h getopt.h ieeefp.h pwd.h sys/ipc.h sys/pstat.h sys/select.h sys/sem.h sys/socket.h sys/shm.h sys/types.h sys/un.h termios.h kernel/OS.h kernel/image.h SupportDefs.h])
753:
754: dnl At least on IRIX, cpp test for netinet/tcp.h will fail unless netinet/in.h
755: dnl is included first. So can't just use AC_CHECK_HEADERS; do it this way:
756: AC_CHECK_HEADERS([netinet/in.h])
757: AC_MSG_CHECKING([for netinet/tcp.h])
758: AC_TRY_CPP([
759: #ifdef HAVE_NETINET_IN_H
760: #include <netinet/in.h>
761: #endif
762: #include <netinet/tcp.h>
763: ], [AC_DEFINE(HAVE_NETINET_TCP_H) AC_MSG_RESULT(yes)],
764: [AC_MSG_RESULT(no)])
1.29 petere 765:
1.73 petere 766: PGAC_HEADER_STRING
767:
1.28 petere 768: AC_CHECK_HEADERS([readline/readline.h readline.h], [break])
769: AC_CHECK_HEADERS([readline/history.h history.h], [break])
1.15 petere 770:
1.28 petere 771: if test "$with_krb4" = yes ; then
772: AC_CHECK_HEADER(krb.h, [], [AC_MSG_ERROR([header file <krb.h> is required for Kerberos 4])])
773: fi
774:
775: if test "$with_krb5" = yes ; then
776: AC_CHECK_HEADER(krb5.h, [], [AC_MSG_ERROR([header file <krb5.h> is required for Kerberos 5])])
777: AC_CHECK_HEADER(com_err.h, [], [AC_MSG_ERROR([header file <com_err.h> is required for Kerberos 5])])
778: fi
779:
780: if test "$with_openssl" = yes ; then
781: AC_CHECK_HEADER([openssl/ssl.h], [], [AC_MSG_ERROR([header file <openssl/ssl.h> is required for OpenSSL])])
782: AC_CHECK_HEADER([openssl/err.h], [], [AC_MSG_ERROR([header file <openssl/err.h> is required for OpenSSL])])
1.136 momjian 783: fi
784:
785: if test "$with_pam" = yes ; then
786: AC_CHECK_HEADER([security/pam_appl.h], [], [AC_MSG_ERROR([header file <security/pam_appl.h> is required for PAM])])
1.28 petere 787: fi
788:
1.1 petere 789:
1.29 petere 790: ##
791: ## Types, structures, compiler characteristics
792: ##
1.1 petere 793: AC_C_CONST
794: AC_C_INLINE
795: AC_C_STRINGIZE
1.40 petere 796: PGAC_C_SIGNED
797: PGAC_C_VOLATILE
1.29 petere 798: AC_STRUCT_TIMEZONE
799: PGAC_UNION_SEMUN
1.137 momjian 800: PGAC_STRUCT_CMSGCRED
801: PGAC_STRUCT_FCRED
802: PGAC_STRUCT_SOCKCRED
1.44 petere 803: PGAC_STRUCT_SOCKADDR_UN
1.1 petere 804:
1.29 petere 805: ##
806: ## Functions, global variables
807: ##
1.6 petere 808: PGAC_VAR_INT_TIMEZONE
1.29 petere 809: AC_FUNC_ACCEPT_ARGTYPES
1.6 petere 810: PGAC_FUNC_GETTIMEOFDAY_1ARG
1.1 petere 811:
1.159 momjian 812: # SunOS doesn't handle negative byte comparisons properly with +/- return
813: PGAC_FUNC_MEMCMP
814:
1.99 tgl 815: AC_CHECK_FUNCS([fcvt getopt_long memmove pstat setproctitle setsid sigprocmask sysconf waitpid dlopen fdatasync])
816:
817: dnl Check whether <unistd.h> declares fdatasync().
818: AC_EGREP_HEADER(fdatasync, unistd.h, AC_DEFINE(HAVE_FDATASYNC_DECL))
1.1 petere 819:
1.28 petere 820: AC_CACHE_CHECK([for PS_STRINGS], [pgac_cv_var_PS_STRINGS],
821: [AC_TRY_LINK(
822: [#include <machine/vmparam.h>
823: #include <sys/exec.h>
824: ],
1.1 petere 825: [PS_STRINGS->ps_nargvstr = 1;
826: PS_STRINGS->ps_argvstr = "foo";],
1.28 petere 827: [pgac_cv_var_PS_STRINGS=yes],
828: [pgac_cv_var_PS_STRINGS=no])])
829: if test "$pgac_cv_var_PS_STRINGS" = yes ; then
830: AC_DEFINE([HAVE_PS_STRINGS], [], [Define if the PS_STRINGS thing exists.])
831: fi
1.1 petere 832:
833: dnl We use our snprintf.c emulation if either snprintf() or vsnprintf()
834: dnl is missing. Yes, there are machines that have only one.
835: dnl We may also decide to use snprintf.c if snprintf() is present but does
836: dnl not have working "long long int" support -- see below.
837: SNPRINTF=''
838: AC_CHECK_FUNC(snprintf,
839: AC_DEFINE(HAVE_SNPRINTF),
840: SNPRINTF='snprintf.o')
841: AC_CHECK_FUNC(vsnprintf,
842: AC_DEFINE(HAVE_VSNPRINTF),
843: SNPRINTF='snprintf.o')
844: AC_SUBST(SNPRINTF)
845: dnl Check whether <stdio.h> declares snprintf() and vsnprintf(); if not,
846: dnl include/c.h will provide declarations. Note this is a separate test
847: dnl from whether the functions exist in the C library --- there are systems
848: dnl that have the functions but don't bother to declare them :-(
849: dnl Note: simple-minded pattern here will do wrong thing if stdio.h
850: dnl declares vsnprintf() but not snprintf(). Hopefully there are no
851: dnl systems that are *that* brain-damaged...
852: AC_EGREP_HEADER(snprintf, stdio.h, AC_DEFINE(HAVE_SNPRINTF_DECL))
853: AC_EGREP_HEADER(vsnprintf, stdio.h, AC_DEFINE(HAVE_VSNPRINTF_DECL))
1.29 petere 854:
855: # do this one the hard way in case isinf() is a macro
856: AC_CACHE_CHECK([for isinf], ac_cv_func_isinf,
1.1 petere 857: [AC_TRY_LINK(
1.29 petere 858: [#include <math.h>
859: ],
1.1 petere 860: [double x = 0.0; int res = isinf(x);],
1.29 petere 861: [ac_cv_func_isinf=yes],
862: [ac_cv_func_isinf=no])])
863:
864: if test $ac_cv_func_isinf = yes ; then
1.1 petere 865: AC_DEFINE(HAVE_ISINF)
1.29 petere 866: ISINF=
1.1 petere 867: else
868: ISINF='isinf.o'
1.29 petere 869: # Look for a way to implement a substitute for isinf()
870: AC_CHECK_FUNCS([fpclass fp_class fp_class_d class], [break])
1.1 petere 871: fi
872: AC_SUBST(ISINF)
1.29 petere 873:
1.1 petere 874: AC_CHECK_FUNC(getrusage,
875: AC_DEFINE(HAVE_GETRUSAGE),
876: GETRUSAGE='getrusage.o')
877: AC_SUBST(GETRUSAGE)
878: AC_CHECK_FUNC(srandom,
879: AC_DEFINE(HAVE_SRANDOM),
880: SRANDOM='srandom.o')
881: AC_SUBST(SRANDOM)
882: AC_CHECK_FUNC(gethostname,
883: AC_DEFINE(HAVE_GETHOSTNAME),
884: GETHOSTNAME='gethostname.o')
885: AC_SUBST(GETHOSTNAME)
886: AC_CHECK_FUNC(random,
887: AC_DEFINE(HAVE_RANDOM),
888: MISSING_RANDOM='random.o')
889: AC_SUBST(MISSING_RANDOM)
890: AC_CHECK_FUNC(inet_aton,
891: AC_DEFINE(HAVE_INET_ATON),
892: INET_ATON='inet_aton.o')
893: AC_SUBST(INET_ATON)
894: AC_CHECK_FUNC(strerror,
895: AC_DEFINE(HAVE_STRERROR),
1.92 tgl 896: STRERROR='strerror.o')
1.1 petere 897: AC_SUBST(STRERROR)
898: AC_CHECK_FUNC(strdup,
899: AC_DEFINE(HAVE_STRDUP),
900: STRDUP='../../utils/strdup.o')
901: AC_SUBST(STRDUP)
902: AC_CHECK_FUNC(strtol,
903: AC_DEFINE(HAVE_STRTOL),
904: STRTOL='strtol.o')
905: AC_SUBST(STRTOL)
906: AC_CHECK_FUNC(strtoul,
907: AC_DEFINE(HAVE_STRTOUL),
1.100 ishii 908: STRTOUL='strtoul.o')
1.1 petere 909: AC_SUBST(STRTOUL)
910: AC_CHECK_FUNC(strcasecmp,
911: AC_DEFINE(HAVE_STRCASECMP),
912: STRCASECMP='strcasecmp.o')
913: AC_SUBST(STRCASECMP)
914: AC_CHECK_FUNC(cbrt,
915: AC_DEFINE(HAVE_CBRT),
916: AC_CHECK_LIB(m, cbrt, AC_DEFINE(HAVE_CBRT)))
917:
918: # On HPUX 9, rint() is not in regular libm.a but in /lib/pa1.1/libm.a;
919: # this hackery with HPUXMATHLIB allows us to cope.
920: HPUXMATHLIB=""
1.30 petere 921: case $host_cpu in
1.1 petere 922: hppa1.1)
923: if [[ -r /lib/pa1.1/libm.a ]] ; then
924: HPUXMATHLIB="-L /lib/pa1.1 -lm"
925: fi ;;
926: esac
927: AC_SUBST(HPUXMATHLIB)
928:
929: AC_CHECK_FUNC(rint,
930: AC_DEFINE(HAVE_RINT),
931: AC_CHECK_LIB(m, rint, AC_DEFINE(HAVE_RINT), , $HPUXMATHLIB))
932:
1.52 petere 933:
934: # Readline versions < 2.1 don't have rl_completion_append_character
935: AC_MSG_CHECKING([for rl_completion_append_character])
936: AC_TRY_LINK([#include <stdio.h>
1.117 petere 937: #ifdef HAVE_READLINE_READLINE_H
938: # include <readline/readline.h>
939: #elif defined(HAVE_READLINE_H)
1.52 petere 940: # include <readline.h>
941: #endif
1.117 petere 942: ],
1.52 petere 943: [rl_completion_append_character = 'x';],
944: [AC_MSG_RESULT(yes)
945: AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER)],
946: [AC_MSG_RESULT(no)])
947:
1.129 momjian 948: AC_CHECK_FUNCS([rl_completion_matches rl_filename_completion_function])
1.1 petere 949:
950:
951: dnl Cannot use AC_CHECK_FUNC because finite may be a macro
952: AC_MSG_CHECKING(for finite)
953: AC_TRY_LINK([#include <math.h>],
954: [int dummy=finite(1.0);],
955: [AC_DEFINE(HAVE_FINITE) AC_MSG_RESULT(yes)],
956: AC_MSG_RESULT(no))
957:
958: dnl Cannot use AC_CHECK_FUNC because sigsetjmp may be a macro
959: dnl (especially on GNU libc)
1.133 petere 960: dnl See also comments in pg_config.h.
1.1 petere 961: AC_MSG_CHECKING(for sigsetjmp)
962: AC_TRY_LINK([#include <setjmp.h>],
963: [sigjmp_buf x; sigsetjmp(x, 1);],
964: [AC_DEFINE(HAVE_SIGSETJMP) AC_MSG_RESULT(yes)],
965: AC_MSG_RESULT(no))
966:
1.42 petere 967:
968: PGAC_ARG_BOOL(enable, syslog, no, [ --enable-syslog enable logging to syslog],
969: [AC_CHECK_FUNC(syslog,
970: [AC_DEFINE([ENABLE_SYSLOG], 1,
971: [Define to 1 if to enable the syslogging code])],
972: [AC_MSG_ERROR([no syslog interface found])])])
973:
1.1 petere 974:
1.76 petere 975: AC_CACHE_CHECK([for optreset], pgac_cv_var_int_optreset,
976: [AC_TRY_LINK([#include <unistd.h>],
977: [extern int optreset; optreset = 1;],
978: [pgac_cv_var_int_optreset=yes],
979: [pgac_cv_var_int_optreset=no])])
980: if test x"$pgac_cv_var_int_optreset" = x"yes"; then
981: AC_DEFINE(HAVE_INT_OPTRESET, 1)
982: fi
983:
1.109 petere 984:
985: # This test makes sure that run tests work at all. Sometimes a shared
986: # library is found by the linker, but the runtime linker can't find it.
987: # This check should come after all modifications of compiler or linker
988: # variables, and before any other run tests.
989: AC_MSG_CHECKING([test program])
990: AC_TRY_RUN([int main() { return 0; }],
991: [AC_MSG_RESULT(ok)],
992: [AC_MSG_RESULT(failed)
993: AC_MSG_ERROR([[
994: *** Could not execute a simple test program. This may be a problem
995: *** related to locating shared libraries. Check the file 'config.log'
996: *** for the exact reason.]])],
997: [AC_MSG_RESULT([cross-compiling])])
998:
999:
1.1 petere 1000: dnl Check to see if we have a working 64-bit integer type.
1001: dnl This breaks down into two steps:
1002: dnl (1) figure out if the compiler has a 64-bit int type with working
1003: dnl arithmetic, and if so
1004: dnl (2) see whether snprintf() can format the type correctly. (Currently,
1005: dnl snprintf is the only library routine we really need for int8 support.)
1006: dnl It's entirely possible to have a compiler that handles a 64-bit type
1007: dnl when the C library doesn't; this is fairly likely when using gcc on
1008: dnl an older platform, for example.
1009: dnl If there is no native snprintf() or it does not handle the 64-bit type,
1010: dnl we force our own version of snprintf() to be used instead.
1011: dnl Note this test must be run after our initial check for snprintf/vsnprintf.
1012:
1.6 petere 1013: PGAC_TYPE_64BIT_INT([long int])
1.1 petere 1014:
1.6 petere 1015: if test x"$HAVE_LONG_INT_64" = x"no" ; then
1016: PGAC_TYPE_64BIT_INT([long long int])
1017: fi
1.1 petere 1018:
1019:
1.112 tgl 1020: dnl If we need to use "long long int", figure out whether nnnLL notation works.
1021:
1022: if [[ x"$HAVE_LONG_LONG_INT_64" = xyes ]] ; then
1023: AC_TRY_COMPILE([
1024: #define INT64CONST(x) x##LL
1025: long long int foo = INT64CONST(0x1234567890123456);
1026: ],
1027: [],
1028: [AC_DEFINE(HAVE_LL_CONSTANTS)],
1029: [])
1030: fi
1031:
1032:
1.1 petere 1033: dnl If we found "long int" is 64 bits, assume snprintf handles it.
1034: dnl If we found we need to use "long long int", better check.
1035: dnl We cope with snprintfs that use either %lld or %qd as the format.
1036: dnl If neither works, fall back to our own snprintf emulation (which we
1037: dnl know uses %lld).
1038:
1.7 petere 1039: if [[ x"$HAVE_LONG_LONG_INT_64" = xyes ]] ; then
1.1 petere 1040: if [[ x$SNPRINTF = x ]] ; then
1041: AC_MSG_CHECKING(whether snprintf handles 'long long int' as %lld)
1042: AC_TRY_RUN([#include <stdio.h>
1043: typedef long long int int64;
1044: #define INT64_FORMAT "%lld"
1045:
1046: int64 a = 20000001;
1047: int64 b = 40000005;
1048:
1049: int does_int64_snprintf_work()
1050: {
1051: int64 c;
1052: char buf[100];
1053:
1054: if (sizeof(int64) != 8)
1055: return 0; /* doesn't look like the right size */
1056:
1057: c = a * b;
1058: snprintf(buf, 100, INT64_FORMAT, c);
1059: if (strcmp(buf, "800000140000005") != 0)
1060: return 0; /* either multiply or snprintf is busted */
1061: return 1;
1062: }
1063: main() {
1064: exit(! does_int64_snprintf_work());
1065: }],
1066: [ AC_MSG_RESULT(yes)
1067: INT64_FORMAT='"%lld"'
1068: ],
1069: [ AC_MSG_RESULT(no)
1070: AC_MSG_CHECKING(whether snprintf handles 'long long int' as %qd)
1071: AC_TRY_RUN([#include <stdio.h>
1072: typedef long long int int64;
1073: #define INT64_FORMAT "%qd"
1074:
1075: int64 a = 20000001;
1076: int64 b = 40000005;
1077:
1078: int does_int64_snprintf_work()
1079: {
1080: int64 c;
1081: char buf[100];
1082:
1083: if (sizeof(int64) != 8)
1084: return 0; /* doesn't look like the right size */
1085:
1086: c = a * b;
1087: snprintf(buf, 100, INT64_FORMAT, c);
1088: if (strcmp(buf, "800000140000005") != 0)
1089: return 0; /* either multiply or snprintf is busted */
1090: return 1;
1091: }
1092: main() {
1093: exit(! does_int64_snprintf_work());
1094: }],
1095: [ AC_MSG_RESULT(yes)
1096: INT64_FORMAT='"%qd"'
1097: ],
1098: [ AC_MSG_RESULT(no)
1099: # Force usage of our own snprintf, since system snprintf is broken
1100: SNPRINTF='snprintf.o'
1101: INT64_FORMAT='"%lld"'
1102: ],
1103: [ AC_MSG_RESULT(assuming not on target machine)
1104: # Force usage of our own snprintf, since we cannot test foreign snprintf
1105: SNPRINTF='snprintf.o'
1106: INT64_FORMAT='"%lld"'
1107: ]) ],
1108: [ AC_MSG_RESULT(assuming not on target machine)
1109: # Force usage of our own snprintf, since we cannot test foreign snprintf
1110: SNPRINTF='snprintf.o'
1111: INT64_FORMAT='"%lld"'
1112: ])
1113: else
1114: # here if we previously decided we needed to use our own snprintf
1115: INT64_FORMAT='"%lld"'
1116: fi
1117: else
1118: # Here if we are not using 'long long int' at all
1119: INT64_FORMAT='"%ld"'
1120: fi
1121:
1122: AC_DEFINE_UNQUOTED(INT64_FORMAT, $INT64_FORMAT)
1123:
1124:
1.78 petere 1125: AC_CHECK_FUNCS([strtoll strtoq], [break])
1126: AC_CHECK_FUNCS([strtoull strtouq], [break])
1127:
1.102 ishii 1128: dnl psql needs atexit() or on_exit()
1129: AC_CHECK_FUNC(atexit,
1130: [AC_DEFINE(HAVE_ATEXIT)],
1131: [AC_CHECK_FUNCS(on_exit,
1132: [AC_DEFINE(HAVE_ON_EXIT)],
1.140 petere 1133: [AC_MSG_ERROR([neither atexit() nor on_exit() found])])])
1.78 petere 1134:
1.84 tgl 1135: dnl Need a #define for the size of Datum (unsigned long)
1136:
1137: AC_CHECK_SIZEOF(unsigned long, 4)
1138: AC_DEFINE_UNQUOTED(SIZEOF_DATUM, $ac_cv_sizeof_unsigned_long)
1139:
1.1 petere 1140: dnl Determine memory alignment requirements for the basic C datatypes.
1141:
1.6 petere 1142: PGAC_CHECK_ALIGNOF(short)
1143: PGAC_CHECK_ALIGNOF(int)
1144: PGAC_CHECK_ALIGNOF(long)
1.7 petere 1145: if [[ x"$HAVE_LONG_LONG_INT_64" = xyes ]] ; then
1.6 petere 1146: PGAC_CHECK_ALIGNOF(long long int)
1.1 petere 1147: fi
1.6 petere 1148: PGAC_CHECK_ALIGNOF(double)
1.1 petere 1149:
1150: dnl Compute maximum alignment of any basic type.
1151: dnl We assume long's alignment is at least as strong as char, short, or int;
1152: dnl but we must check long long (if it exists) and double.
1153:
1.6 petere 1154: if test $pgac_cv_alignof_double != 'sizeof(double)' ; then
1155: MAX_ALIGNOF=$pgac_cv_alignof_long
1156: if test $MAX_ALIGNOF -lt $pgac_cv_alignof_double ; then
1157: MAX_ALIGNOF=$pgac_cv_alignof_double
1.1 petere 1158: fi
1.7 petere 1159: if test x"$HAVE_LONG_LONG_INT_64" = xyes && test $MAX_ALIGNOF -lt $pgac_cv_alignof_long_long_int ; then
1.6 petere 1160: MAX_ALIGNOF="$pgac_cv_alignof_long_long_int"
1.1 petere 1161: fi
1162: else
1163: dnl cross-compiling: assume that double's alignment is worst case
1.6 petere 1164: MAX_ALIGNOF="$pgac_cv_alignof_double"
1.1 petere 1165: fi
1.6 petere 1166: AC_DEFINE_UNQUOTED(MAXIMUM_ALIGNOF, $MAX_ALIGNOF, [Define as the maximum alignment requirement of any type])
1.1 petere 1167:
1.155 petere 1168:
1.152 momjian 1169: # Some platforms predefine the types int8, int16, etc. Only check
1.156 tgl 1170: # a (hopefully) representative subset. We also check for sig_atomic_t,
1171: # which *should* be defined per ANSI C, but is missing on some old platforms.
1.155 petere 1172:
1173: pgac_type_includes="\
1174: #include <stdio.h>
1.156 tgl 1175: #include <signal.h>
1.155 petere 1176: #ifdef HAVE_SUPPORTDEFS_H
1177: #include <SupportDefs.h>
1178: #endif"
1179:
1180: PGAC_CHECK_TYPE(int8, [], [], [$pgac_type_includes])
1181: PGAC_CHECK_TYPE(uint8, [], [], [$pgac_type_includes])
1182: PGAC_CHECK_TYPE(int64, [], [], [$pgac_type_includes])
1183: PGAC_CHECK_TYPE(uint64, [], [], [$pgac_type_includes])
1.156 tgl 1184: PGAC_CHECK_TYPE(sig_atomic_t, [], [], [$pgac_type_includes])
1.155 petere 1185:
1.152 momjian 1186:
1.6 petere 1187: PGAC_FUNC_POSIX_SIGNALS
1.1 petere 1188:
1189:
1.43 petere 1190: # Check for Tcl configuration script tclConfig.sh
1191: if test "$with_tcl" = yes; then
1192: PGAC_PATH_TCLCONFIGSH([$with_tclconfig])
1193: fi
1.1 petere 1194:
1.43 petere 1195: # Check for Tk configuration script tkConfig.sh
1196: if test "$with_tk" = yes; then
1197: PGAC_PATH_TKCONFIGSH([$with_tkconfig $with_tclconfig])
1.1 petere 1198: fi
1199:
1200:
1.75 petere 1201: #
1202: # Check for DocBook and tools
1203: #
1204: PGAC_PROG_NSGMLS
1205: # If you don't have nsgmls you won't get very far, so save the cycles.
1206: if test -n "$NSGMLS"; then
1207: PGAC_PROG_JADE
1208: PGAC_CHECK_DOCBOOK([3.1])
1209: PGAC_PATH_DOCBOOK_STYLESHEETS
1210: AC_CHECK_PROGS(SGMLSPL, sgmlspl)
1211: fi
1212:
1.104 petere 1213: abs_top_srcdir=
1214: AC_SUBST(abs_top_srcdir)
1.61 petere 1215:
1.104 petere 1216: # prepare build tree if outside source tree
1.138 petere 1217: # Note 1: test -ef might not exist, but it's more reliable than `pwd`.
1218: # Note 2: /bin/pwd might be better than shell's built-in at getting
1219: # a symlink-free name.
1220: if ( test "$srcdir" -ef . ) >/dev/null 2>&1 || test "`cd $srcdir && /bin/pwd`" = "`/bin/pwd`"; then
1221: :
1222: else
1.104 petere 1223: abs_top_srcdir=`cd $srcdir && pwd`
1224: echo $ac_n "preparing build tree... $ac_c" 1>&6
1225: /bin/sh "$srcdir/config/prep_buildtree" "$abs_top_srcdir" "." \
1226: || AC_MSG_ERROR(failed)
1227: AC_MSG_RESULT(done)
1.61 petere 1228: fi
1.1 petere 1229:
1230: AC_OUTPUT(
1.33 petere 1231: [
1232: GNUmakefile
1233: src/GNUmakefile
1234: src/Makefile.global
1235: src/backend/port/Makefile
1.85 tgl 1236: ],
1237: [
1.133 petere 1238: # Update timestamp for pg_config.h (see Makefile.global)
1.87 petere 1239: test x"$CONFIG_HEADERS" != x"" && echo >src/include/stamp-h
1.83 petere 1240: ])
PostgreSQL CVSweb <[email protected]>