Annotation of pgsql/configure.in, revision 1.259
1.1 petere 1: dnl Process this file with autoconf to produce a configure script.
1.259 ! momjian 2: dnl $Header: /cvsroot/pgsql-server/configure.in,v 1.258 2003/06/11 06:56:06 momjian Exp $
1.185 petere 3: dnl
1.28 petere 4: dnl Developers, please strive to achieve this order:
5: dnl
6: dnl 0. Initialization and options processing
7: dnl 1. Programs
8: dnl 2. Libraries
9: dnl 3. Header files
10: dnl 4. Types
11: dnl 5. Structures
12: dnl 6. Compiler characteristics
13: dnl 7. Functions, global variables
14: dnl 8. System services
15: dnl
16: dnl Read the Autoconf manual for details.
1.185 petere 17: dnl
18: m4_pattern_forbid(^PGAC_)dnl to catch undefined macros
19: dnl
1.32 petere 20: dnl The GNU folks apparently haven't heard that some people don't use
21: dnl Texinfo. Use this sorcery to use "docdir" instead of "infodir".
1.171 petere 22: m4_define([info], [doc])
23: m4_define([infodir], [docdir])
1.218 tgl 24: AC_INIT([PostgreSQL], [7.4devel], [[email protected]])
1.171 petere 25: m4_undefine([infodir])
26: m4_undefine([info])
27: AC_SUBST(docdir)
28:
29: AC_PREREQ(2.53)
30: AC_COPYRIGHT([Copyright 2002 PostgreSQL Global Development Group])
31: AC_CONFIG_SRCDIR([src/backend/access/common/heaptuple.c])
32: AC_CONFIG_AUX_DIR(config)
1.1 petere 33: AC_PREFIX_DEFAULT(/usr/local/pgsql)
1.171 petere 34: AC_SUBST(configure_args, [$ac_configure_args])
1.5 petere 35:
1.171 petere 36: AC_DEFINE_UNQUOTED(PG_VERSION, "$PACKAGE_VERSION", [PostgreSQL version])
1.61 petere 37:
1.1 petere 38: AC_CANONICAL_HOST
39:
1.30 petere 40: template=
41: AC_MSG_CHECKING([which template to use])
42:
1.42 petere 43: PGAC_ARG_REQ(with, template, [],
44: [
45: case $withval in
1.30 petere 46: list) echo; ls "$srcdir/src/template"; exit;;
47: *) if test -f "$srcdir/src/template/$with_template" ; then
1.42 petere 48: template=$withval
1.30 petere 49: else
1.80 petere 50: AC_MSG_ERROR(['$withval' is not a valid template name. Use 'list' for a list.])
1.30 petere 51: fi;;
52: esac
1.42 petere 53: ],
54: [
55: # --with-template not given
1.30 petere 56:
57: case $host_os in
58: aix*) template=aix ;;
1.54 momjian 59: beos*) template=beos ;;
1.30 petere 60: bsdi*) template=bsdi ;;
1.239 petere 61: cygwin*) template=cygwin ;;
1.72 petere 62: darwin*) template=darwin ;;
1.30 petere 63: dgux*) template=dgux ;;
64: freebsd*) template=freebsd ;;
65: hpux*) template=hpux ;;
66: irix*) template=irix5 ;;
67: linux*) template=linux ;;
1.250 momjian 68: mingw*) template=win32 ;;
1.30 petere 69: netbsd*) template=netbsd ;;
70: nextstep*) template=nextstep ;;
71: openbsd*) template=openbsd ;;
72: osf*) template=osf ;;
73: qnx*) template=qnx4 ;;
74: sco*) template=sco ;;
1.58 petere 75: solaris*) template=solaris ;;
1.30 petere 76: sunos*) template=sunos4 ;;
1.1 petere 77: sysv4.2*)
1.30 petere 78: case $host_vendor in
79: univel) template=univel ;;
80: esac ;;
81: sysv4*) template=svr4 ;;
1.133 petere 82: sysv5*) template=unixware ;;
1.30 petere 83: ultrix*) template=ultrix4 ;;
1.1 petere 84: esac
85:
1.30 petere 86: if test x"$template" = x"" ; then
1.80 petere 87: AC_MSG_ERROR([[
1.30 petere 88: *******************************************************************
89: PostgreSQL has apparently not been ported to your platform yet.
1.32 petere 90: To try a manual configuration, look into the src/template directory
1.80 petere 91: for a similar platform and use the '--with-template=' option.
1.30 petere 92:
93: Please also contact <[email protected]> to see about
1.80 petere 94: rectifying this. Include the above 'checking host system type...'
1.30 petere 95: line.
96: *******************************************************************
1.80 petere 97: ]])
1.30 petere 98: fi
99:
1.42 petere 100: ])
1.1 petere 101:
1.30 petere 102: AC_MSG_RESULT([$template])
1.1 petere 103:
1.30 petere 104: PORTNAME=$template
105: AC_SUBST(PORTNAME)
1.1 petere 106:
1.58 petere 107: # Pick right test-and-set (TAS) code. Most platforms have inline
108: # assembler code in src/include/storage/s_lock.h, so we just use
109: # a dummy file here.
110: case $host in
111: *-*-hpux*) need_tas=yes; tas_file=hpux.s ;;
112: sparc-*-solaris*) need_tas=yes; tas_file=solaris_sparc.s ;;
1.147 momjian 113: i?86-*-solaris*) need_tas=yes; tas_file=solaris_i386.s ;;
1.63 petere 114: *) need_tas=no; tas_file=dummy.s ;;
1.30 petere 115: esac
1.171 petere 116: AC_CONFIG_LINKS([src/backend/port/tas.s:src/backend/port/tas/${tas_file}])
1.1 petere 117:
1.30 petere 118: if test "$need_tas" = yes ; then
119: TAS=tas.o
1.1 petere 120: fi
1.30 petere 121: AC_SUBST(TAS)
1.1 petere 122:
123:
124:
1.30 petere 125: ##
126: ## Command line options
127: ##
1.13 petere 128:
1.1 petere 129:
1.30 petere 130: #
131: # Add non-standard directories to the include path
132: #
1.42 petere 133: PGAC_ARG_REQ(with, includes, [ --with-includes=DIRS look for additional header files in DIRS])
1.1 petere 134:
135:
1.30 petere 136: #
137: # Add non-standard directories to the library search path
138: #
1.42 petere 139: PGAC_ARG_REQ(with, libraries, [ --with-libraries=DIRS look for additional libraries in DIRS],
140: [LIBRARY_DIRS=$withval])
1.1 petere 141:
1.42 petere 142: PGAC_ARG_REQ(with, libs, [ --with-libs=DIRS alternative spelling of --with-libraries],
143: [LIBRARY_DIRS=$withval])
1.2 petere 144:
1.1 petere 145:
1.29 petere 146: #
1.180 thomas 147: # 64-bit integer date/time storage (--enable-integer-datetimes)
148: #
149: AC_MSG_CHECKING([whether to build with 64-bit integer date/time support])
150: PGAC_ARG_BOOL(enable, integer-datetimes, no, [ --enable-integer-datetimes enable 64-bit integer date/time support],
151: [AC_DEFINE([USE_INTEGER_DATETIMES], 1,
1.242 petere 152: [Define to 1 if you want 64-bit integer timestamp and interval support. (--enable-integer-datetimes)])])
1.180 thomas 153: AC_MSG_RESULT([$enable_integer_datetimes])
154:
155:
1.42 petere 156: # Character set recode (--enable-recode)
1.29 petere 157: #
1.42 petere 158: AC_MSG_CHECKING([whether to build with recode support])
1.205 petere 159: PGAC_ARG_BOOL(enable, recode, no, [ --enable-recode enable single-byte recode support],
1.42 petere 160: [AC_DEFINE([CYR_RECODE], 1,
1.242 petere 161: [Define to 1 if you want single-byte recode support. (--enable-recode)])])
1.29 petere 162: AC_MSG_RESULT([$enable_recode])
1.1 petere 163:
164:
1.70 ishii 165: #
1.128 petere 166: # NLS
167: #
168: AC_MSG_CHECKING([whether NLS is wanted])
169: PGAC_ARG_OPTARG(enable, nls,
1.171 petere 170: [[ --enable-nls[=LANGUAGES] enable Native Language Support]],
1.128 petere 171: [],
172: [WANTED_LANGUAGES=$enableval],
1.171 petere 173: [AC_DEFINE(ENABLE_NLS, 1,
1.242 petere 174: [Define to 1 if you want National Language Support. (--enable-nls)])])
1.128 petere 175: AC_MSG_RESULT([$enable_nls])
176: AC_SUBST(enable_nls)
177: AC_SUBST(WANTED_LANGUAGES)
178:
179: #
1.29 petere 180: # Default port number (--with-pgport), default 5432
181: #
182: AC_MSG_CHECKING([for default port number])
1.42 petere 183: PGAC_ARG_REQ(with, pgport, [ --with-pgport=PORTNUM change default port number [5432]],
184: [default_port=$withval],
185: [default_port=5432])
1.97 tgl 186: AC_MSG_RESULT([$default_port])
187: # Need both of these because some places want an integer and some a string
1.171 petere 188: AC_DEFINE_UNQUOTED(DEF_PGPORT, ${default_port},
1.242 petere 189: [Define to the default TCP port number on which the server listens and
190: to which clients will try to connect to. This can be overridden at
191: run-time, but it's convenient if your clients have the right default
192: compiled in. (--with-pgport=PORTNUM)])
1.171 petere 193: AC_DEFINE_UNQUOTED(DEF_PGPORT_STR, "${default_port}",
1.242 petere 194: [Define to the default TCP port number as string constant.])
1.97 tgl 195: AC_SUBST(default_port)
1.1 petere 196:
1.29 petere 197: #
1.65 petere 198: # Option to disable shared libraries
199: #
200: PGAC_ARG_BOOL(enable, shared, yes,
1.68 petere 201: [ --disable-shared do not build shared libraries])
1.65 petere 202: AC_SUBST(enable_shared)
203:
1.69 petere 204: #
205: # '-rpath'-like feature can be disabled
206: #
207: PGAC_ARG_BOOL(enable, rpath, yes,
208: [ --disable-rpath do not embed shared library search path in executables])
209: AC_SUBST(enable_rpath)
210:
1.65 petere 211:
212: #
1.74 petere 213: # --enable-debug adds -g to compiler flags
214: #
215: PGAC_ARG_BOOL(enable, debug, no,
216: [ --enable-debug build with debugging symbols (-g)])
1.168 momjian 217: AC_SUBST(enable_debug)
1.74 petere 218:
219: #
1.30 petere 220: # C compiler
221: #
222:
1.29 petere 223: # For historical reasons you can also use --with-CC to specify the C compiler
224: # to use, although the standard way to do this is to set the CC environment
225: # variable.
1.42 petere 226: PGAC_ARG_REQ(with, CC, [], [CC=$with_CC])
1.4 tgl 227:
1.171 petere 228: case $template in
229: aix) pgac_cc_list="gcc xlc";;
230: irix) pgac_cc_list="cc";; # no gcc
231: *) pgac_cc_list="gcc cc";;
232: esac
1.4 tgl 233:
1.171 petere 234: AC_PROG_CC([$pgac_cc_list])
1.30 petere 235: # Read the template
236: . "$srcdir/src/template/$template" || exit
1.74 petere 237:
1.171 petere 238: if test "$ac_env_CFLAGS_set" = set; then
239: CFLAGS=$ac_env_CFLAGS_value
1.74 petere 240: fi
241: if test "$enable_debug" = yes && test "$ac_cv_prog_cc_g" = yes; then
242: CFLAGS="$CFLAGS -g"
243: fi
1.171 petere 244: AC_MSG_NOTICE([using CFLAGS=$CFLAGS])
1.210 petere 245:
1.30 petere 246: # Check if the compiler still works with the template settings
1.171 petere 247: AC_MSG_CHECKING([whether the C compiler still works])
248: AC_TRY_LINK([], [return 0;],
249: [AC_MSG_RESULT(yes)],
250: [AC_MSG_RESULT(no)
251: AC_MSG_ERROR([cannot proceed])])
1.210 petere 252:
253: # Defend against gcc -ffastmath
254: if test "$GCC" = yes; then
255: AC_TRY_COMPILE([], [@%:@ifdef __FAST_MATH__
256: choke me
257: @%:@endif], [], [AC_MSG_ERROR([do not put -ffast-math in CFLAGS])])
258: fi
259:
1.4 tgl 260: AC_PROG_CPP
1.6 petere 261: AC_SUBST(GCC)
1.4 tgl 262:
1.29 petere 263: # Create compiler version string
1.24 petere 264: if test x"$GCC" = x"yes" ; then
1.169 momjian 265: cc_string="GCC `${CC} --version | sed q`"
1.4 tgl 266: else
1.24 petere 267: cc_string=$CC
1.4 tgl 268: fi
1.242 petere 269: AC_DEFINE_UNQUOTED(PG_VERSION_STR,
270: ["PostgreSQL $PACKAGE_VERSION on $host, compiled by $cc_string"],
271: [A string containing the version number, platform, and C compiler])
1.24 petere 272:
1.4 tgl 273:
1.31 petere 274: #
275: # Automatic dependency tracking
276: #
1.42 petere 277: PGAC_ARG_BOOL(enable, depend, no, [ --enable-depend turn on automatic dependency tracking],
278: [autodepend=yes])
1.31 petere 279: AC_SUBST(autodepend)
280:
281:
1.42 petere 282: #
283: # Enable assert checks
284: #
285: PGAC_ARG_BOOL(enable, cassert, no, [ --enable-cassert enable assertion checks (for debugging)],
286: [AC_DEFINE([USE_ASSERT_CHECKING], 1,
1.242 petere 287: [Define to 1 to build with assertion checks. (--enable-cassert)])])
1.30 petere 288:
289:
290: #
291: # Include directories
292: #
293: ac_save_IFS=$IFS
1.80 petere 294: IFS="${IFS}:"
1.30 petere 295: # SRCH_INC comes from the template file
296: for dir in $with_includes $SRCH_INC; do
297: if test -d "$dir"; then
298: INCLUDES="$INCLUDES -I$dir"
299: else
300: AC_MSG_WARN([*** Include directory $dir does not exist.])
301: fi
302: done
303: IFS=$ac_save_IFS
304: AC_SUBST(INCLUDES)
305:
306:
307: #
308: # Library directories
309: #
310: ac_save_IFS=$IFS
1.80 petere 311: IFS="${IFS}:"
1.30 petere 312: # LIBRARY_DIRS comes from command line, SRCH_LIB from template file.
313: for dir in $LIBRARY_DIRS $SRCH_LIB; do
314: if test -d "$dir"; then
1.68 petere 315: LIBDIRS="$LIBDIRS -L$dir"
1.30 petere 316: else
317: AC_MSG_WARN([*** Library directory $dir does not exist.])
318: fi
319: done
320: IFS=$ac_save_IFS
321:
1.43 petere 322: #
323: # Tcl/Tk
324: #
325: AC_MSG_CHECKING([whether to build with Tcl])
326: PGAC_ARG_BOOL(with, tcl, no, [ --with-tcl build Tcl and Tk interfaces])
327: AC_MSG_RESULT([$with_tcl])
328: AC_SUBST([with_tcl])
329:
330: # If Tcl is enabled (above) then Tk is also, unless the user disables it using --without-tk
331: AC_MSG_CHECKING([whether to build with Tk])
332: if test "$with_tcl" = yes; then
333: PGAC_ARG_BOOL(with, tk, yes, [ --without-tk do not build Tk interfaces if Tcl is enabled])
334: else
335: with_tk=no
336: fi
337: AC_MSG_RESULT([$with_tk])
338: AC_SUBST([with_tk])
1.1 petere 339:
340:
1.171 petere 341: # We see if the path to the Tcl/Tk configuration scripts is specified.
1.42 petere 342: # This will override the use of tclsh to find the paths to search.
343:
1.43 petere 344: PGAC_ARG_REQ(with, tclconfig, [ --with-tclconfig=DIR tclConfig.sh and tkConfig.sh are in DIR])
1.1 petere 345:
1.171 petere 346: # We see if the path to the Tk configuration scripts is specified.
1.42 petere 347: # This will override the use of tclsh to find the paths to search.
1.1 petere 348:
1.43 petere 349: PGAC_ARG_REQ(with, tkconfig, [ --with-tkconfig=DIR tkConfig.sh is in DIR])
1.125 petere 350:
1.42 petere 351: #
1.205 petere 352: # Optionally build Perl modules (PL/Perl)
1.199 momjian 353: #
354: AC_MSG_CHECKING([whether to build Perl modules])
1.205 petere 355: PGAC_ARG_BOOL(with, perl, no, [ --with-perl build Perl modules (PL/Perl)])
1.199 momjian 356: AC_MSG_RESULT([$with_perl])
357: AC_SUBST(with_perl)
358:
359: #
1.42 petere 360: # Optionally build Python interface module
361: #
362: AC_MSG_CHECKING([whether to build Python modules])
1.126 petere 363: PGAC_ARG_BOOL(with, python, no, [ --with-python build Python interface module])
364: AC_MSG_RESULT([$with_python])
1.5 petere 365: AC_SUBST(with_python)
1.1 petere 366:
1.105 peter 367: #
368: # Optionally build the Java/JDBC tools
369: #
370: AC_MSG_CHECKING([whether to build Java/JDBC tools])
1.108 petere 371: PGAC_ARG_BOOL(with, java, no, [ --with-java build JDBC interface and Java tools],
1.105 peter 372: [AC_MSG_RESULT(yes)
1.108 petere 373: PGAC_PATH_ANT
374: if test -z "$ANT"; then
1.208 momjian 375: AC_MSG_ERROR([Ant is required to build Java components
376: If you have Ant already installed, see config.log for details on the failure.])
1.201 momjian 377: fi
378: if "$ANT" -version | sed q | egrep -v ' 1\.[[5-9]]| [[2-9]]\.' >/dev/null ; then
379: AC_MSG_ERROR([Ant version >= 1.5 is required to build Java components])
1.108 petere 380: fi],
1.105 peter 381: [AC_MSG_RESULT(no)])
382: AC_SUBST(with_java)
1.13 petere 383:
1.28 petere 384: dnl A note on the Kerberos and OpenSSL options:
1.13 petere 385: dnl
1.28 petere 386: dnl The user can give an argument to the option in order the specify
387: dnl the base path of the respective installation (what he specified
388: dnl perhaps as --prefix). If no argument is given ($withval is "yes")
389: dnl then we take the path where the package installs by default. This
390: dnl way the user doesn't have to use redundant --with-includes and
391: dnl --with-libraries options, but he can still use them if the layout
392: dnl is non-standard.
393:
394: #
395: # Kerberos 4
396: #
1.171 petere 397: AC_MSG_CHECKING([whether to build with Kerberos 4 support])
398: PGAC_ARG_OPTARG(with, krb4, [[ --with-krb4[=DIR] build with Kerberos 4 support [/usr/athena]]],
1.42 petere 399: [krb4_prefix=/usr/athena],
400: [krb4_prefix=$withval],
401: [
1.171 petere 402: AC_MSG_RESULT(yes)
1.242 petere 403: AC_DEFINE(KRB4, 1, [Define to build with Kerberos 4 support. (--with-krb4)])
1.28 petere 404:
1.68 petere 405: if test -d "$krb4_prefix/include"; then
406: INCLUDES="$INCLUDES -I$krb4_prefix/include"
407: fi
408: if test -d "$krb4_prefix/lib"; then
409: LIBDIRS="$LIBDIRS -L$krb4_prefix/lib"
1.13 petere 410: fi
1.37 petere 411:
1.42 petere 412: krb_srvtab="/etc/srvtab"
1.171 petere 413: ],
414: [AC_MSG_RESULT(no)])
1.42 petere 415:
416: AC_SUBST(with_krb4)
1.13 petere 417:
418:
1.28 petere 419: #
420: # Kerberos 5
421: #
1.171 petere 422: AC_MSG_CHECKING([whether to build with Kerberos 5 support])
423: PGAC_ARG_OPTARG(with, krb5, [[ --with-krb5[=DIR] build with Kerberos 5 support [/usr/athena]]],
1.42 petere 424: [krb5_prefix=/usr/athena],
425: [krb5_prefix=$withval],
426: [
1.171 petere 427: AC_MSG_RESULT([yes])
1.242 petere 428: AC_DEFINE(KRB5, 1, [Define to build with Kerberos 5 support. (--with-krb5)])
1.28 petere 429:
1.68 petere 430: if test -d "$krb5_prefix/include"; then
431: INCLUDES="$INCLUDES -I$krb5_prefix/include"
432: fi
433: if test -d "$krb5_prefix/lib"; then
434: LIBDIRS="$LIBDIRS -L$krb5_prefix/lib"
1.13 petere 435: fi
1.28 petere 436:
1.42 petere 437: krb_srvtab="FILE:\$(sysconfdir)/krb5.keytab"
1.171 petere 438: ],
439: [AC_MSG_RESULT(no)])
1.42 petere 440:
441: AC_SUBST(with_krb5)
1.28 petere 442:
443:
444: # Using both Kerberos 4 and Kerberos 5 at the same time isn't going to work.
445: if test "$with_krb4" = yes && test "$with_krb5" = yes ; then
446: AC_MSG_ERROR([Kerberos 4 and Kerberos 5 support cannot be combined])
447: fi
1.13 petere 448:
1.37 petere 449: AC_SUBST(krb_srvtab)
1.13 petere 450:
451:
1.28 petere 452: #
453: # Kerberos configuration parameters
454: #
1.42 petere 455: PGAC_ARG_REQ(with, krb-srvnam,
1.68 petere 456: [ --with-krb-srvnam=NAME name of the service principal in Kerberos [postgres]],
1.42 petere 457: [],
458: [with_krb_srvnam="postgres"])
459: AC_DEFINE_UNQUOTED([PG_KRB_SRVNAM], ["$with_krb_srvnam"],
1.242 petere 460: [Define to the name of the PostgreSQL service principal in Kerberos. (--with-krb-srvnam=NAME)])
1.13 petere 461:
1.28 petere 462:
1.136 momjian 463: #
464: # PAM
465: #
466: AC_MSG_CHECKING([whether to build with PAM support])
1.158 petere 467: PGAC_ARG_BOOL(with, pam, no,
468: [ --with-pam build with PAM support],
1.242 petere 469: [AC_DEFINE([USE_PAM], 1, [Define to 1 to build with PAM support. (--with-pam)])])
1.158 petere 470: AC_MSG_RESULT([$with_pam])
1.136 momjian 471: AC_SUBST(with_pam)
472:
1.28 petere 473:
474: #
1.258 momjian 475: # Rendezvous
476: #
477: AC_MSG_CHECKING([whether to build with Rendezvous support])
478: PGAC_ARG_BOOL(with, rendezvous, no,
479: [ --with-rendezvous build with Rendezvous support],
480: [AC_DEFINE([USE_RENDEZVOUS], 1, [Define to 1 to build with Rendezvous support. (--with-rendezvous)])])
481: AC_MSG_RESULT([$with_rendezvous])
482: AC_SUBST(with_rendezvous)
483:
484:
485: #
1.28 petere 486: # OpenSSL
487: #
1.42 petere 488: PGAC_ARG_OPTARG(with, openssl,
1.171 petere 489: [[ --with-openssl[=DIR] build with OpenSSL support [/usr/local/ssl]]],
1.42 petere 490: [openssl_prefix=/usr/local/ssl],
491: [openssl_prefix=$withval],
492: [
1.28 petere 493: AC_MSG_RESULT([building with OpenSSL support])
1.242 petere 494: AC_DEFINE([USE_SSL], 1, [Define to build with (Open)SSL support. (--with-openssl)])
1.28 petere 495:
496: if test -d "${openssl_prefix}/include" ; then
497: INCLUDES="$INCLUDES -I${openssl_prefix}/include"
498: fi
499: if test -d "${openssl_prefix}/lib" ; then
1.68 petere 500: LIBDIRS="$LIBDIRS -L${openssl_prefix}/lib"
1.28 petere 501: fi
1.42 petere 502: ])
503:
504: AC_SUBST(with_openssl)
1.28 petere 505:
1.13 petere 506:
1.177 petere 507: #
508: # Readline
509: #
510: PGAC_ARG_BOOL(with, readline, yes,
511: [ --without-readline do not use Readline])
512:
513: #
514: # Zlib
515: #
516: PGAC_ARG_BOOL(with, zlib, yes,
517: [ --without-zlib do not use Zlib])
1.3 momjian 518:
519:
1.254 momjian 520: #
521: # Elf
522: #
1.3 momjian 523:
1.30 petere 524: # Assume system is ELF if it predefines __ELF__ as 1,
525: # otherwise believe host_os based default.
526: case $host_os in
1.127 momjian 527: freebsd1*|freebsd2*) elf=no;;
528: freebsd3*|freebsd4*) elf=yes;;
1.30 petere 529: esac
1.1 petere 530:
531: AC_EGREP_CPP(yes,
532: [#if __ELF__
533: yes
534: #endif
535: ],
1.30 petere 536: [ELF_SYS=true],
537: [if test "X$elf" = "Xyes" ; then
538: ELF_SYS=true
1.1 petere 539: else
1.30 petere 540: ELF_SYS=
541: fi])
542: AC_SUBST(ELF_SYS)
1.1 petere 543:
1.254 momjian 544: #
545: # Pthreads
546: #
547:
548: AC_CHECK_HEADER(pthread.h,
549: [AC_DEFINE(HAVE_THREADS, 1, [Define to 1 if you have the threads interface.])])
550: if test ! -z "$HAVE_THREADS"
551: then
552: case $host_os in
553: # BSD/OS and NetBSD require no special libraries or flags
554: netbsd*|bsdi*) ;;
555: freebsd2*|freebsd3*|freebsd4*) THREAD_CFLAGS="-pthread" ;;
556: freebsd*) THREAD_LIBS="-lc_r" ;;
557: linux*) THREAD_LIBS="-lpthread"
558: THREAD_CFLAGS="-D_REENTRANT" ;;
559: # other operating systems might fail because they have pthread.h but need
560: # special libs we don't know about yet.
561: esac
562: fi
563: AC_SUBST(THREAD_LIBS)
564: AC_SUBST(THREAD_CFLAGS)
1.1 petere 565:
1.254 momjian 566: #
567: # Assignments
568: #
1.1 petere 569:
1.30 petere 570: CPPFLAGS="$CPPFLAGS $INCLUDES"
1.68 petere 571: LDFLAGS="$LDFLAGS $LIBDIRS"
1.30 petere 572:
1.171 petere 573: AC_MSG_NOTICE([using CPPFLAGS=$CPPFLAGS])
574: AC_MSG_NOTICE([using LDFLAGS=$LDFLAGS])
1.30 petere 575:
576:
1.2 petere 577: AC_PROG_AWK
1.39 petere 578: PGAC_PATH_FLEX
1.1 petere 579: AC_PROG_LN_S
1.62 petere 580: AC_PROG_LD
1.67 petere 581: AC_SUBST(LD)
582: AC_SUBST(with_gnu_ld)
1.130 momjian 583: case $host_os in sysv5*)
1.77 petere 584: AC_CACHE_CHECK([whether ld -R works], [pgac_cv_prog_ld_R],
585: [
586: pgac_save_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS -Wl,-R/usr/lib"
587: AC_TRY_LINK([], [], [pgac_cv_prog_ld_R=yes], [pgac_cv_prog_ld_R=no])
588: LDFLAGS=$pgac_save_LDFLAGS
589: ])
590: ld_R_works=$pgac_cv_prog_ld_R
591: AC_SUBST(ld_R_works)
592: esac
1.1 petere 593: AC_PROG_RANLIB
1.58 petere 594: AC_CHECK_PROGS(LORDER, lorder)
1.56 petere 595: AC_PATH_PROG(TAR, tar)
1.176 petere 596: PGAC_CHECK_STRIP
1.98 petere 597:
598: AC_CHECK_PROGS(YACC, ['bison -y'])
1.255 momjian 599:
600: if test "$YACC"; then
1.257 tgl 601: if $YACC --version | sed q | $AWK '{ if ($4 < 1.875) exit 0; else exit 1;}'; then
1.255 momjian 602: AC_MSG_WARN([
603: *** The installed version of Bison is too old. PostgreSQL needs
604: *** Bison version 1.875 or later.])
605: fi
606: fi
607:
1.98 petere 608: if test -z "$YACC"; then
609: AC_MSG_WARN([
610: *** Without Bison you will not be able to build PostgreSQL from CVS or
611: *** change any of the parser definition files. You can obtain Bison from
612: *** a GNU mirror site. (If you are using the official distribution of
613: *** PostgreSQL then you do not need to worry about this because the Bison
614: *** output is pre-generated.) To use a different yacc program (possible,
615: *** but not recommended), set the environment variable YACC before running
616: *** 'configure'.])
617: fi
1.6 petere 618: AC_SUBST(YFLAGS)
1.98 petere 619:
1.199 momjian 620: PGAC_PATH_PERL
621: if test "$with_perl" = yes; then
1.205 petere 622: PGAC_CHECK_PERL_CONFIGS([archlibexp,privlibexp,useshrplib])
1.199 momjian 623: PGAC_CHECK_PERL_EMBED_LDFLAGS
1.126 petere 624: fi
625:
626: if test "$with_python" = yes; then
627: PGAC_PATH_PYTHON
628: PGAC_CHECK_PYTHON_MODULE_SETUP
629: PGAC_CHECK_PYTHON_EMBED_SETUP
1.43 petere 630: fi
1.1 petere 631:
632:
1.183 tgl 633: ##
1.29 petere 634: ## Libraries
635: ##
636:
1.1 petere 637: if test "$PORTNAME" != "aix" -a "$PORTNAME" != "alpha"
638: then
639: AC_CHECK_LIB(bsd, main)
640: fi
1.21 petere 641: AC_CHECK_LIB(util, setproctitle)
1.1 petere 642: AC_CHECK_LIB(m, main)
643: AC_CHECK_LIB(dl, main)
1.181 momjian 644: AC_CHECK_LIB(nsl, main)
1.1 petere 645: AC_CHECK_LIB(socket, main)
646: AC_CHECK_LIB(ipc, main)
647: AC_CHECK_LIB(IPC, main)
648: AC_CHECK_LIB(lc, main)
649: AC_CHECK_LIB(dld, main)
650: AC_CHECK_LIB(ld, main)
651: AC_CHECK_LIB(compat, main)
652: AC_CHECK_LIB(BSD, main)
653: AC_CHECK_LIB(gen, main)
654: AC_CHECK_LIB(PW, main)
1.95 petere 655: AC_CHECK_LIB(resolv, main)
1.250 momjian 656: AC_CHECK_LIB(wsock32, main)
1.209 momjian 657: AC_SEARCH_LIBS(getopt_long, [getopt gnugetopt])
1.139 petere 658: # QNX:
1.223 momjian 659: AC_CHECK_LIB(unix, main)
1.21 petere 660: AC_SEARCH_LIBS(crypt, crypt)
1.139 petere 661: # BeOS:
1.223 momjian 662: AC_CHECK_LIB(bind, __inet_ntoa)
1.139 petere 663: # Solaris:
1.140 petere 664: AC_SEARCH_LIBS(fdatasync, [rt posix4])
1.206 petere 665: # Cygwin:
666: AC_CHECK_LIB(cygipc, shmget)
1.28 petere 667:
1.177 petere 668: if test "$with_readline" = yes; then
669: PGAC_CHECK_READLINE
670: if test x"$pgac_cv_check_readline" = x"no"; then
671: AC_MSG_ERROR([readline library not found
1.208 momjian 672: If you have readline already installed, see config.log for details on the
673: failure. It is possible the compiler isn't looking in the proper directory.
1.177 petere 674: Use --without-readline to disable readline support.])
675: fi
676: fi
677:
678: if test "$with_zlib" = yes; then
679: AC_CHECK_LIB(z, inflate, [],
680: [AC_MSG_ERROR([zlib library not found
1.208 momjian 681: If you have zlib already installed, see config.log for details on the
682: failure. It is possible the compiler isn't looking in the proper directory.
1.177 petere 683: Use --without-zlib to disable zlib support.])])
684: fi
685:
1.28 petere 686: if test "$with_krb4" = yes ; then
1.223 momjian 687: AC_CHECK_LIB(des, des_encrypt, [], [AC_MSG_ERROR([library 'des' is required for Kerberos 4])])
688: AC_CHECK_LIB(krb, krb_sendauth, [], [AC_MSG_ERROR([library 'krb' is required for Kerberos 4])])
1.250 momjian 689: AC_REPLACE_FUNCS([gethostname])
1.28 petere 690: fi
691:
692: if test "$with_krb5" = yes ; then
1.166 petere 693: AC_SEARCH_LIBS(com_err, [krb5 'krb5 -ldes -lasn1 -lroken' com_err], [],
694: [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
695: AC_SEARCH_LIBS(krb5_encrypt, [krb5 'krb5 -ldes -lasn1 -lroken' crypto k5crypto], [],
696: [AC_MSG_ERROR([could not find function 'krb5_encrypt' required for Kerberos 5])])
697: AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -ldes -lasn1 -lroken'], [],
698: [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
1.28 petere 699: fi
700:
701: if test "$with_openssl" = yes ; then
702: dnl Order matters!
1.223 momjian 703: AC_CHECK_LIB(crypto, CRYPTO_new_ex_data, [], [AC_MSG_ERROR([library 'crypto' is required for OpenSSL])])
704: AC_CHECK_LIB(ssl, SSL_library_init, [], [AC_MSG_ERROR([library 'ssl' is required for OpenSSL])])
1.128 petere 705: fi
706:
1.136 momjian 707: if test "$with_pam" = yes ; then
1.223 momjian 708: AC_CHECK_LIB(pam, pam_start, [], [AC_MSG_ERROR([library 'pam' is required for PAM])])
1.136 momjian 709: fi
710:
1.171 petere 711:
1.29 petere 712: ##
713: ## Header files
714: ##
1.194 petere 715:
1.171 petere 716: dnl sys/socket.h is required by AC_FUNC_ACCEPT_ARGTYPES
1.238 tgl 717: AC_CHECK_HEADERS([crypt.h dld.h endian.h fp_class.h getopt.h ieeefp.h poll.h pwd.h sys/ipc.h sys/poll.h sys/pstat.h sys/select.h sys/sem.h sys/socket.h sys/shm.h sys/un.h termios.h utime.h kernel/OS.h kernel/image.h SupportDefs.h])
1.66 tgl 718:
1.171 petere 719: # At least on IRIX, cpp test for netinet/tcp.h will fail unless
720: # netinet/in.h is included first.
1.223 momjian 721: AC_CHECK_HEADERS(netinet/in.h)
722: AC_CHECK_HEADERS(netinet/tcp.h, [], [],
1.173 petere 723: [AC_INCLUDES_DEFAULT
724: #ifdef HAVE_NETINET_IN_H
1.66 tgl 725: #include <netinet/in.h>
726: #endif
1.171 petere 727: ])
1.73 petere 728:
1.177 petere 729: if test "$with_readline" = yes; then
1.223 momjian 730: AC_CHECK_HEADERS(readline/readline.h, [],
1.237 momjian 731: [AC_CHECK_HEADERS(editline/readline.h, [],
732: [AC_CHECK_HEADERS(readline.h, [],
1.177 petere 733: [AC_MSG_ERROR([readline header not found
1.208 momjian 734: If you have readline already installed, see config.log for details on the
735: failure. It is possible the compiler isn't looking in the proper directory.
1.237 momjian 736: Use --without-readline to disable readline support.])])])])
1.223 momjian 737: AC_CHECK_HEADERS(readline/history.h, [],
1.237 momjian 738: [AC_CHECK_HEADERS(editline/history.h, [],
739: [AC_CHECK_HEADERS(history.h, [],
1.177 petere 740: [AC_MSG_ERROR([history header not found
1.208 momjian 741: If you have readline already installed, see config.log for details on the
742: failure. It is possible the compiler isn't looking in the proper directory.
1.237 momjian 743: Use --without-readline to disable readline support.])])])])
1.177 petere 744: fi
745:
746: if test "$with_zlib" = yes; then
747: AC_CHECK_HEADER(zlib.h, [], [AC_MSG_ERROR([zlib header not found
1.232 momjian 748: If you have zlib already installed, see config.log for details on the
1.208 momjian 749: failure. It is possible the compiler isn't looking in the proper directory.
1.177 petere 750: Use --without-zlib to disable zlib support.])])
751: fi
1.15 petere 752:
1.28 petere 753: if test "$with_krb4" = yes ; then
754: AC_CHECK_HEADER(krb.h, [], [AC_MSG_ERROR([header file <krb.h> is required for Kerberos 4])])
755: fi
756:
757: if test "$with_krb5" = yes ; then
758: AC_CHECK_HEADER(krb5.h, [], [AC_MSG_ERROR([header file <krb5.h> is required for Kerberos 5])])
759: AC_CHECK_HEADER(com_err.h, [], [AC_MSG_ERROR([header file <com_err.h> is required for Kerberos 5])])
760: fi
761:
762: if test "$with_openssl" = yes ; then
1.223 momjian 763: AC_CHECK_HEADER(openssl/ssl.h, [], [AC_MSG_ERROR([header file <openssl/ssl.h> is required for OpenSSL])])
764: AC_CHECK_HEADER(openssl/err.h, [], [AC_MSG_ERROR([header file <openssl/err.h> is required for OpenSSL])])
1.136 momjian 765: fi
766:
767: if test "$with_pam" = yes ; then
1.236 momjian 768: AC_CHECK_HEADERS(security/pam_appl.h, [],
769: [AC_CHECK_HEADERS(pam/pam_appl.h, [],
770: [AC_MSG_ERROR([header file <security/pam_appl.h> or <pam/pam_appl.h> is required for PAM.])])])
1.258 momjian 771: fi
772:
773: if test "$with_rendezvous" = yes ; then
774: AC_CHECK_HEADER(DNSServiceDiscovery/DNSServiceDiscovery.h, [], [AC_MSG_ERROR([header file <DNSServiceDiscovery/DNSServiceDiscovery.h> is required for Rendezvous])])
1.28 petere 775: fi
776:
1.1 petere 777:
1.29 petere 778: ##
779: ## Types, structures, compiler characteristics
780: ##
1.194 petere 781:
1.171 petere 782: m4_defun([AC_PROG_CC_STDC], []) dnl We don't want that.
1.1 petere 783: AC_C_CONST
784: AC_C_INLINE
785: AC_C_STRINGIZE
1.40 petere 786: PGAC_C_SIGNED
1.171 petere 787: AC_C_VOLATILE
1.244 tgl 788: PGAC_C_FUNCNAME_SUPPORT
1.253 tgl 789: PGAC_STRUCT_TIMEZONE
1.29 petere 790: PGAC_UNION_SEMUN
1.44 petere 791: PGAC_STRUCT_SOCKADDR_UN
1.259 ! momjian 792: PGAC_STRUCT_SOCKADDR_STORAGE
1.241 tgl 793: PGAC_STRUCT_ADDRINFO
1.166 petere 794:
1.171 petere 795: AC_CHECK_TYPES([struct cmsgcred, struct fcred, struct sockcred], [], [],
796: [#include <sys/param.h>
797: #include <sys/socket.h>
798: #include <sys/ucred.h>])
799:
1.177 petere 800: if test "$with_zlib" = yes; then
801: # Check that <zlib.h> defines z_streamp (versions before about 1.0.4
802: # did not). While we could work around the lack of z_streamp, it
803: # seems unwise to encourage people to use such old zlib versions...
804: AC_CHECK_TYPE(z_streamp, [], [AC_MSG_ERROR([zlib version is too old
805: Use --without-zlib to disable zlib support.])],
806: [#include <zlib.h>])
807: fi
808:
1.166 petere 809: if test "$with_krb5" = yes; then
810: # Check for differences between MIT and Heimdal (KTH) releases
1.223 momjian 811: AC_CHECK_MEMBERS(krb5_ticket.enc_part2, [],
1.229 momjian 812: [AC_CHECK_MEMBERS(krb5_ticket.client, [],
1.171 petere 813: [AC_MSG_ERROR([could not determine how to get client name from Kerberos 5 ticket])],
814: [#include <krb5.h>])],
815: [#include <krb5.h>])
1.223 momjian 816: AC_CHECK_MEMBERS(krb5_error.text.data, [],
817: [AC_CHECK_MEMBERS(krb5_error.e_data, [],
1.205 petere 818: [AC_MSG_ERROR([could not determine how to extract Kerberos 5 error messages])],
819: [#include <krb5.h>])],
1.171 petere 820: [#include <krb5.h>])
1.166 petere 821: fi
822:
1.1 petere 823:
1.29 petere 824: ##
825: ## Functions, global variables
826: ##
1.194 petere 827:
1.6 petere 828: PGAC_VAR_INT_TIMEZONE
1.29 petere 829: AC_FUNC_ACCEPT_ARGTYPES
1.6 petere 830: PGAC_FUNC_GETTIMEOFDAY_1ARG
1.1 petere 831:
1.159 momjian 832: # SunOS doesn't handle negative byte comparisons properly with +/- return
1.194 petere 833: AC_FUNC_MEMCMP
1.159 momjian 834:
1.245 momjian 835: AC_CHECK_FUNCS([cbrt dlopen fcvt fdatasync getpeereid memmove poll pstat setproctitle setsid sigprocmask symlink sysconf utime utimes waitpid])
1.99 tgl 836:
1.171 petere 837: AC_CHECK_DECLS(fdatasync, [], [], [#include <unistd.h>])
1.226 momjian 838:
1.240 petere 839: AC_CHECK_TYPE([struct sockaddr_in6],
840: [AC_CHECK_FUNC(inet_ntop,
1.242 petere 841: [AC_DEFINE(HAVE_IPV6, 1, [Define to 1 if you have support for IPv6.])])],
1.240 petere 842: [],
1.231 petere 843: [$ac_includes_default
1.240 petere 844: #include <netinet/in.h>])
1.1 petere 845:
1.28 petere 846: AC_CACHE_CHECK([for PS_STRINGS], [pgac_cv_var_PS_STRINGS],
847: [AC_TRY_LINK(
848: [#include <machine/vmparam.h>
849: #include <sys/exec.h>
850: ],
1.1 petere 851: [PS_STRINGS->ps_nargvstr = 1;
852: PS_STRINGS->ps_argvstr = "foo";],
1.28 petere 853: [pgac_cv_var_PS_STRINGS=yes],
854: [pgac_cv_var_PS_STRINGS=no])])
855: if test "$pgac_cv_var_PS_STRINGS" = yes ; then
1.242 petere 856: AC_DEFINE([HAVE_PS_STRINGS], [], [Define to 1 if the PS_STRINGS thing exists.])
1.28 petere 857: fi
1.1 petere 858:
1.171 petere 859:
860: # We use our snprintf.c emulation if either snprintf() or vsnprintf()
861: # is missing. Yes, there are machines that have only one. We may
862: # also decide to use snprintf.c if snprintf() is present but does not
863: # have working "long long int" support -- see below.
864:
1.194 petere 865: pgac_need_repl_snprintf=no
866: AC_CHECK_FUNCS(snprintf, [], pgac_need_repl_snprintf=yes)
867: AC_CHECK_FUNCS(vsnprintf, [], pgac_need_repl_snprintf=yes)
1.171 petere 868:
869:
870: # Check whether <stdio.h> declares snprintf() and vsnprintf(); if not,
871: # include/c.h will provide declarations. Note this is a separate test
872: # from whether the functions exist in the C library --- there are
873: # systems that have the functions but don't bother to declare them :-(
874:
875: AC_CHECK_DECLS([snprintf, vsnprintf])
876:
1.29 petere 877:
878: # do this one the hard way in case isinf() is a macro
879: AC_CACHE_CHECK([for isinf], ac_cv_func_isinf,
1.1 petere 880: [AC_TRY_LINK(
1.29 petere 881: [#include <math.h>
882: ],
1.1 petere 883: [double x = 0.0; int res = isinf(x);],
1.29 petere 884: [ac_cv_func_isinf=yes],
885: [ac_cv_func_isinf=no])])
886:
887: if test $ac_cv_func_isinf = yes ; then
1.242 petere 888: AC_DEFINE(HAVE_ISINF, 1, [Define to 1 if you have isinf().])
1.1 petere 889: else
1.194 petere 890: AC_LIBOBJ(isinf)
1.29 petere 891: # Look for a way to implement a substitute for isinf()
892: AC_CHECK_FUNCS([fpclass fp_class fp_class_d class], [break])
1.1 petere 893: fi
1.171 petere 894:
1.250 momjian 895: AC_REPLACE_FUNCS([crypt fseeko getopt getopt_long getrusage inet_aton random rint srandom strcasecmp strdup strerror strtol strtoul])
1.241 tgl 896:
897: # system's version of getaddrinfo(), if any, may be used only if we found
898: # a definition for struct addrinfo; see notes in src/include/getaddrinfo.h
899: if test x"$ac_cv_type_struct_addrinfo" = xyes ; then
900: AC_REPLACE_FUNCS([getaddrinfo])
901: else
902: AC_LIBOBJ(getaddrinfo)
903: fi
1.193 momjian 904:
1.216 momjian 905: # BSD/OS & NetBSD use a custom fseeko/ftello built on fsetpos/fgetpos
1.214 momjian 906: # We override the previous test that said fseeko/ftello didn't exist
1.216 momjian 907: # OS tests are also done in include/c.h and port/fseeko.c
908: case $host_os in bsdi*|netbsd*)
1.214 momjian 909: ac_cv_func_fseeko=yes
910: esac
911:
1.222 momjian 912: # Solaris has a very slow qsort in certain cases, so we replace it.
1.243 momjian 913: case $host_os in solaris*)
914: AC_LIBOBJ(qsort) ;;
915: esac
916:
917: # Win32 can't to rename or unlink on an open file
1.251 momjian 918: case $host_os in mingw*)
919: AC_LIBOBJ(dirmod)
1.252 momjian 920: AC_LIBOBJ(copydir)
921: AC_LIBOBJ(gettimeofday) ;;
1.193 momjian 922: esac
1.52 petere 923:
1.177 petere 924: if test "$with_readline" = yes; then
925: PGAC_VAR_RL_COMPLETION_APPEND_CHARACTER
926: AC_CHECK_FUNCS([rl_completion_matches rl_filename_completion_function])
1.237 momjian 927: AC_CHECK_FUNCS([replace_history_entry])
1.177 petere 928: fi
1.1 petere 929:
930:
931: dnl Cannot use AC_CHECK_FUNC because finite may be a macro
932: AC_MSG_CHECKING(for finite)
933: AC_TRY_LINK([#include <math.h>],
1.171 petere 934: [int dummy=finite(1.0);],
1.242 petere 935: [AC_DEFINE(HAVE_FINITE, 1, [Define to 1 if you have finite().])
1.171 petere 936: AC_MSG_RESULT(yes)],
937: [AC_MSG_RESULT(no)])
1.1 petere 938:
939: dnl Cannot use AC_CHECK_FUNC because sigsetjmp may be a macro
940: dnl (especially on GNU libc)
1.242 petere 941: dnl See also comments in c.h.
1.1 petere 942: AC_MSG_CHECKING(for sigsetjmp)
943: AC_TRY_LINK([#include <setjmp.h>],
1.171 petere 944: [sigjmp_buf x; sigsetjmp(x, 1);],
1.242 petere 945: [AC_DEFINE(HAVE_SIGSETJMP, 1, [Define to 1 if you have sigsetjmp().])
1.171 petere 946: AC_MSG_RESULT(yes)],
947: [AC_MSG_RESULT(no)])
1.1 petere 948:
1.222 momjian 949: AC_CHECK_FUNC(syslog,
1.242 petere 950: [AC_CHECK_HEADER(syslog.h,
951: [AC_DEFINE(HAVE_SYSLOG, 1, [Define to 1 if you have the syslog interface.])])])
1.1 petere 952:
1.76 petere 953: AC_CACHE_CHECK([for optreset], pgac_cv_var_int_optreset,
954: [AC_TRY_LINK([#include <unistd.h>],
955: [extern int optreset; optreset = 1;],
956: [pgac_cv_var_int_optreset=yes],
957: [pgac_cv_var_int_optreset=no])])
958: if test x"$pgac_cv_var_int_optreset" = x"yes"; then
1.242 petere 959: AC_DEFINE(HAVE_INT_OPTRESET, 1, [Define to 1 if you have the global variable 'int optreset'.])
1.76 petere 960: fi
961:
1.194 petere 962: AC_CHECK_FUNCS([strtoll strtoq], [break])
963: AC_CHECK_FUNCS([strtoull strtouq], [break])
964:
965: # Check for one of atexit() or on_exit()
966: AC_CHECK_FUNCS(atexit, [],
967: [AC_CHECK_FUNCS(on_exit, [],
1.225 momjian 968: [AC_MSG_ERROR([neither atexit() nor on_exit() found])])])
1.213 momjian 969:
1.195 petere 970: AC_FUNC_FSEEKO
971:
1.109 petere 972:
973: # This test makes sure that run tests work at all. Sometimes a shared
974: # library is found by the linker, but the runtime linker can't find it.
975: # This check should come after all modifications of compiler or linker
976: # variables, and before any other run tests.
977: AC_MSG_CHECKING([test program])
978: AC_TRY_RUN([int main() { return 0; }],
979: [AC_MSG_RESULT(ok)],
980: [AC_MSG_RESULT(failed)
981: AC_MSG_ERROR([[
982: *** Could not execute a simple test program. This may be a problem
983: *** related to locating shared libraries. Check the file 'config.log'
984: *** for the exact reason.]])],
985: [AC_MSG_RESULT([cross-compiling])])
986:
987:
1.1 petere 988: dnl Check to see if we have a working 64-bit integer type.
989: dnl This breaks down into two steps:
990: dnl (1) figure out if the compiler has a 64-bit int type with working
991: dnl arithmetic, and if so
992: dnl (2) see whether snprintf() can format the type correctly. (Currently,
993: dnl snprintf is the only library routine we really need for int8 support.)
994: dnl It's entirely possible to have a compiler that handles a 64-bit type
995: dnl when the C library doesn't; this is fairly likely when using gcc on
996: dnl an older platform, for example.
997: dnl If there is no native snprintf() or it does not handle the 64-bit type,
998: dnl we force our own version of snprintf() to be used instead.
999: dnl Note this test must be run after our initial check for snprintf/vsnprintf.
1000:
1.6 petere 1001: PGAC_TYPE_64BIT_INT([long int])
1.1 petere 1002:
1.6 petere 1003: if test x"$HAVE_LONG_INT_64" = x"no" ; then
1004: PGAC_TYPE_64BIT_INT([long long int])
1005: fi
1.1 petere 1006:
1007:
1.112 tgl 1008: dnl If we need to use "long long int", figure out whether nnnLL notation works.
1009:
1.201 momjian 1010: if test x"$HAVE_LONG_LONG_INT_64" = xyes ; then
1.112 tgl 1011: AC_TRY_COMPILE([
1012: #define INT64CONST(x) x##LL
1013: long long int foo = INT64CONST(0x1234567890123456);
1014: ],
1015: [],
1.242 petere 1016: [AC_DEFINE(HAVE_LL_CONSTANTS, 1, [Define to 1 if constants of type 'long long int' should have the suffix LL.])],
1.112 tgl 1017: [])
1018: fi
1019:
1020:
1.234 petere 1021: # If we found "long int" is 64 bits, assume snprintf handles it. If
1022: # we found we need to use "long long int", better check. We cope with
1023: # snprintfs that use either %lld, %qd, or %I64d as the format. If
1024: # neither works, fall back to our own snprintf emulation (which we
1025: # know uses %lld).
1.1 petere 1026:
1.234 petere 1027: if test "$HAVE_LONG_LONG_INT_64" = yes ; then
1.194 petere 1028: if test $pgac_need_repl_snprintf = no; then
1.234 petere 1029: PGAC_FUNC_SNPRINTF_LONG_LONG_INT_FORMAT
1030: if test "$LONG_LONG_INT_FORMAT" = ""; then
1031: # Force usage of our own snprintf, since system snprintf is broken
1032: pgac_need_repl_snprintf=yes
1033: LONG_LONG_INT_FORMAT='%lld'
1034: fi
1.1 petere 1035: else
1.234 petere 1036: # Here if we previously decided we needed to use our own snprintf
1037: LONG_LONG_INT_FORMAT='%lld'
1.1 petere 1038: fi
1.234 petere 1039: INT64_FORMAT="\"$LONG_LONG_INT_FORMAT\""
1.1 petere 1040: else
1041: # Here if we are not using 'long long int' at all
1042: INT64_FORMAT='"%ld"'
1043: fi
1044:
1.171 petere 1045: AC_DEFINE_UNQUOTED(INT64_FORMAT, $INT64_FORMAT,
1.242 petere 1046: [Define to the appropriate snprintf format for 64-bit ints, if any.])
1.1 petere 1047:
1.194 petere 1048: if test $pgac_need_repl_snprintf = yes; then
1049: AC_LIBOBJ(snprintf)
1050: fi
1.78 petere 1051:
1.242 petere 1052: # Need a #define for the size of Datum (unsigned long)
1.171 petere 1053: AC_CHECK_SIZEOF([unsigned long])
1.84 tgl 1054:
1.171 petere 1055: # Determine memory alignment requirements for the basic C data types.
1.1 petere 1056:
1.6 petere 1057: PGAC_CHECK_ALIGNOF(short)
1058: PGAC_CHECK_ALIGNOF(int)
1059: PGAC_CHECK_ALIGNOF(long)
1.171 petere 1060: if test x"$HAVE_LONG_LONG_INT_64" = x"yes" ; then
1.6 petere 1061: PGAC_CHECK_ALIGNOF(long long int)
1.1 petere 1062: fi
1.6 petere 1063: PGAC_CHECK_ALIGNOF(double)
1.1 petere 1064:
1.171 petere 1065: # Compute maximum alignment of any basic type.
1066: # We assume long's alignment is at least as strong as char, short, or int;
1067: # but we must check long long (if it exists) and double.
1068:
1069: MAX_ALIGNOF=$pgac_cv_alignof_long
1070: if test $MAX_ALIGNOF -lt $pgac_cv_alignof_double ; then
1071: MAX_ALIGNOF=$pgac_cv_alignof_double
1072: fi
1073: if test x"$HAVE_LONG_LONG_INT_64" = xyes && test $MAX_ALIGNOF -lt $pgac_cv_alignof_long_long_int ; then
1074: MAX_ALIGNOF="$pgac_cv_alignof_long_long_int"
1.1 petere 1075: fi
1.242 petere 1076: AC_DEFINE_UNQUOTED(MAXIMUM_ALIGNOF, $MAX_ALIGNOF, [Define as the maximum alignment requirement of any C data type.])
1.1 petere 1077:
1.155 petere 1078:
1.152 momjian 1079: # Some platforms predefine the types int8, int16, etc. Only check
1.171 petere 1080: # a (hopefully) representative subset.
1081: AC_CHECK_TYPES([int8, uint8, int64, uint64], [], [],
1082: [#include <stdio.h>
1.155 petere 1083: #ifdef HAVE_SUPPORTDEFS_H
1084: #include <SupportDefs.h>
1.171 petere 1085: #endif])
1.155 petere 1086:
1.171 petere 1087: # We also check for sig_atomic_t, which *should* be defined per ANSI
1088: # C, but is missing on some old platforms.
1.223 momjian 1089: AC_CHECK_TYPES(sig_atomic_t, [], [], [#include <signal.h>])
1.155 petere 1090:
1.152 momjian 1091:
1.6 petere 1092: PGAC_FUNC_POSIX_SIGNALS
1.195 petere 1093: if test $ac_cv_func_fseeko = yes; then
1094: AC_SYS_LARGEFILE
1095: fi
1.172 petere 1096:
1097:
1.184 tgl 1098: # Select semaphore implementation type.
1099: if test x"$USE_NAMED_POSIX_SEMAPHORES" = x"1" ; then
1.242 petere 1100: AC_DEFINE(USE_NAMED_POSIX_SEMAPHORES, 1, [Define to select named POSIX semaphores.])
1.184 tgl 1101: SEMA_IMPLEMENTATION="src/backend/port/posix_sema.c"
1102: else
1103: if test x"$USE_UNNAMED_POSIX_SEMAPHORES" = x"1" ; then
1.242 petere 1104: AC_DEFINE(USE_UNNAMED_POSIX_SEMAPHORES, 1, [Define to select unnamed POSIX semaphores.])
1.184 tgl 1105: SEMA_IMPLEMENTATION="src/backend/port/posix_sema.c"
1106: else
1.242 petere 1107: AC_DEFINE(USE_SYSV_SEMAPHORES, 1, [Define to select SysV-style semaphores.])
1.184 tgl 1108: SEMA_IMPLEMENTATION="src/backend/port/sysv_sema.c"
1109: fi
1110: fi
1111:
1112:
1113: # Select shared-memory implementation type.
1.242 petere 1114: AC_DEFINE(USE_SYSV_SHARED_MEMORY, 1, [Define to select SysV-style shared memory.])
1.184 tgl 1115: SHMEM_IMPLEMENTATION="src/backend/port/sysv_shmem.c"
1116:
1117:
1.172 petere 1118: if test "$enable_nls" = yes ; then
1119: PGAC_CHECK_GETTEXT
1120: fi
1.1 petere 1121:
1.43 petere 1122: # Check for Tcl configuration script tclConfig.sh
1123: if test "$with_tcl" = yes; then
1124: PGAC_PATH_TCLCONFIGSH([$with_tclconfig])
1.185 petere 1125: PGAC_EVAL_TCLCONFIGSH([$TCL_CONFIG_SH],
1.235 petere 1126: [TCL_INCLUDE_SPEC,TCL_LIB_FILE,TCL_LIBS,TCL_LIB_SPEC,TCL_SHARED_BUILD])
1.185 petere 1127: AC_SUBST(TCL_SHLIB_LD_LIBS)dnl don't want to double-evaluate that one
1.43 petere 1128: fi
1.1 petere 1129:
1.43 petere 1130: # Check for Tk configuration script tkConfig.sh
1131: if test "$with_tk" = yes; then
1132: PGAC_PATH_TKCONFIGSH([$with_tkconfig $with_tclconfig])
1.185 petere 1133: PGAC_EVAL_TCLCONFIGSH([$TK_CONFIG_SH], [TK_LIBS,TK_LIB_SPEC,TK_XINCLUDES])
1.1 petere 1134: fi
1135:
1136:
1.75 petere 1137: #
1138: # Check for DocBook and tools
1139: #
1140: PGAC_PROG_NSGMLS
1.178 petere 1141: PGAC_PROG_JADE
1.223 momjian 1142: PGAC_CHECK_DOCBOOK(3.1)
1.178 petere 1143: PGAC_PATH_DOCBOOK_STYLESHEETS
1144: PGAC_PATH_COLLATEINDEX
1145: AC_CHECK_PROGS(SGMLSPL, sgmlspl)
1.75 petere 1146:
1.61 petere 1147:
1.104 petere 1148: # prepare build tree if outside source tree
1.138 petere 1149: # Note 1: test -ef might not exist, but it's more reliable than `pwd`.
1150: # Note 2: /bin/pwd might be better than shell's built-in at getting
1151: # a symlink-free name.
1.171 petere 1152: if test "$no_create" != yes; then
1153: if ( test "$srcdir" -ef . ) >/dev/null 2>&1 || test "`cd $srcdir && /bin/pwd`" = "`/bin/pwd`"; then
1.138 petere 1154: :
1.171 petere 1155: else
1156: AC_SUBST(vpath_build, yes)
1157: _AS_ECHO_N([preparing build tree... ])
1158: pgac_abs_top_srcdir=`cd "$srcdir" && pwd`
1159: $SHELL "$ac_aux_dir/prep_buildtree" "$pgac_abs_top_srcdir" "." \
1.104 petere 1160: || AC_MSG_ERROR(failed)
1161: AC_MSG_RESULT(done)
1.171 petere 1162: fi
1.61 petere 1163: fi
1.1 petere 1164:
1.171 petere 1165:
1166: AC_CONFIG_FILES([GNUmakefile src/Makefile.global])
1167:
1168: AC_CONFIG_LINKS([
1169: src/backend/port/dynloader.c:src/backend/port/dynloader/${template}.c
1.184 tgl 1170: src/backend/port/pg_sema.c:${SEMA_IMPLEMENTATION}
1171: src/backend/port/pg_shmem.c:${SHMEM_IMPLEMENTATION}
1.171 petere 1172: src/include/dynloader.h:src/backend/port/dynloader/${template}.h
1173: src/include/pg_config_os.h:src/include/port/${template}.h
1174: src/Makefile.port:src/makefiles/Makefile.${template}
1175: ])
1176:
1177: AC_CONFIG_HEADERS([src/include/pg_config.h],
1.85 tgl 1178: [
1.133 petere 1179: # Update timestamp for pg_config.h (see Makefile.global)
1.171 petere 1180: echo >src/include/stamp-h
1.83 petere 1181: ])
1.171 petere 1182:
1183: AC_OUTPUT
PostgreSQL CVSweb <[email protected]>