Annotation of pgsql/configure.in, revision 1.416
1.292 momjian 1: dnl Process this file with autoconf to produce a configure script.
1.416 ! tgl 2: dnl $PostgreSQL: pgsql/configure.in,v 1.415 2005/07/03 18:54:26 petere 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
1.356 tgl 9: dnl 3. Header files
1.28 petere 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
1.304 petere 19:
1.399 momjian 20: AC_INIT([PostgreSQL], [8.1devel], [[email protected]])
1.171 petere 21:
1.414 petere 22: AC_PREREQ(2.59)
1.395 tgl 23: AC_COPYRIGHT([Copyright (c) 1996-2005, PostgreSQL Global Development Group])
1.171 petere 24: AC_CONFIG_SRCDIR([src/backend/access/common/heaptuple.c])
25: AC_CONFIG_AUX_DIR(config)
1.1 petere 26: AC_PREFIX_DEFAULT(/usr/local/pgsql)
1.171 petere 27: AC_SUBST(configure_args, [$ac_configure_args])
1.5 petere 28:
1.171 petere 29: AC_DEFINE_UNQUOTED(PG_VERSION, "$PACKAGE_VERSION", [PostgreSQL version])
1.61 petere 30:
1.1 petere 31: AC_CANONICAL_HOST
32:
1.30 petere 33: template=
34: AC_MSG_CHECKING([which template to use])
35:
1.42 petere 36: PGAC_ARG_REQ(with, template, [],
37: [
38: case $withval in
1.30 petere 39: list) echo; ls "$srcdir/src/template"; exit;;
40: *) if test -f "$srcdir/src/template/$with_template" ; then
1.42 petere 41: template=$withval
1.30 petere 42: else
1.80 petere 43: AC_MSG_ERROR(['$withval' is not a valid template name. Use 'list' for a list.])
1.30 petere 44: fi;;
45: esac
1.42 petere 46: ],
47: [
1.280 tgl 48: # --with-template not given
1.30 petere 49:
50: case $host_os in
51: aix*) template=aix ;;
1.54 momjian 52: beos*) template=beos ;;
1.30 petere 53: bsdi*) template=bsdi ;;
1.239 petere 54: cygwin*) template=cygwin ;;
1.72 petere 55: darwin*) template=darwin ;;
1.30 petere 56: dgux*) template=dgux ;;
57: freebsd*) template=freebsd ;;
58: hpux*) template=hpux ;;
1.352 momjian 59: irix*) template=irix ;;
1.377 petere 60: linux*|gnu*|k*bsd*-gnu)
61: template=linux ;;
1.250 momjian 62: mingw*) template=win32 ;;
1.30 petere 63: netbsd*) template=netbsd ;;
64: nextstep*) template=nextstep ;;
65: openbsd*) template=openbsd ;;
66: osf*) template=osf ;;
67: qnx*) template=qnx4 ;;
68: sco*) template=sco ;;
1.58 petere 69: solaris*) template=solaris ;;
1.30 petere 70: sunos*) template=sunos4 ;;
1.1 petere 71: sysv4.2*)
1.30 petere 72: case $host_vendor in
73: univel) template=univel ;;
74: esac ;;
75: sysv4*) template=svr4 ;;
1.133 petere 76: sysv5*) template=unixware ;;
1.30 petere 77: ultrix*) template=ultrix4 ;;
1.1 petere 78: esac
79:
1.30 petere 80: if test x"$template" = x"" ; then
1.80 petere 81: AC_MSG_ERROR([[
1.30 petere 82: *******************************************************************
83: PostgreSQL has apparently not been ported to your platform yet.
1.32 petere 84: To try a manual configuration, look into the src/template directory
1.80 petere 85: for a similar platform and use the '--with-template=' option.
1.30 petere 86:
87: Please also contact <[email protected]> to see about
1.80 petere 88: rectifying this. Include the above 'checking host system type...'
1.30 petere 89: line.
90: *******************************************************************
1.80 petere 91: ]])
1.30 petere 92: fi
93:
1.42 petere 94: ])
1.1 petere 95:
1.30 petere 96: AC_MSG_RESULT([$template])
1.1 petere 97:
1.30 petere 98: PORTNAME=$template
99: AC_SUBST(PORTNAME)
1.1 petere 100:
1.309 tgl 101: # Initialize default assumption that we do not need separate assembly code
102: # for TAS (test-and-set). This can be overridden by the template file
103: # when it's executed.
104: need_tas=no
105: tas_file=dummy.s
1.1 petere 106:
107:
108:
1.30 petere 109: ##
110: ## Command line options
111: ##
1.13 petere 112:
1.304 petere 113: #
114: # Installation directory for documentation
115: #
116: PGAC_ARG(with, docdir, [ --with-docdir=DIR install the documentation in DIR [[PREFIX/doc]]
117: --without-docdir do not install the documentation],
118: [AC_MSG_ERROR([option --with-docdir requires an argument])],
119: [docdir=],
120: [docdir=$withval],
121: [docdir='${prefix}/doc'])
122: AC_SUBST(docdir)
123:
1.1 petere 124:
1.30 petere 125: #
126: # Add non-standard directories to the include path
127: #
1.42 petere 128: PGAC_ARG_REQ(with, includes, [ --with-includes=DIRS look for additional header files in DIRS])
1.1 petere 129:
130:
1.30 petere 131: #
132: # Add non-standard directories to the library search path
133: #
1.42 petere 134: PGAC_ARG_REQ(with, libraries, [ --with-libraries=DIRS look for additional libraries in DIRS],
135: [LIBRARY_DIRS=$withval])
1.1 petere 136:
1.42 petere 137: PGAC_ARG_REQ(with, libs, [ --with-libs=DIRS alternative spelling of --with-libraries],
138: [LIBRARY_DIRS=$withval])
1.2 petere 139:
1.1 petere 140:
1.29 petere 141: #
1.180 thomas 142: # 64-bit integer date/time storage (--enable-integer-datetimes)
143: #
144: AC_MSG_CHECKING([whether to build with 64-bit integer date/time support])
145: PGAC_ARG_BOOL(enable, integer-datetimes, no, [ --enable-integer-datetimes enable 64-bit integer date/time support],
146: [AC_DEFINE([USE_INTEGER_DATETIMES], 1,
1.242 petere 147: [Define to 1 if you want 64-bit integer timestamp and interval support. (--enable-integer-datetimes)])])
1.180 thomas 148: AC_MSG_RESULT([$enable_integer_datetimes])
1.1 petere 149:
150:
1.70 ishii 151: #
1.128 petere 152: # NLS
153: #
154: AC_MSG_CHECKING([whether NLS is wanted])
155: PGAC_ARG_OPTARG(enable, nls,
1.171 petere 156: [[ --enable-nls[=LANGUAGES] enable Native Language Support]],
1.128 petere 157: [],
158: [WANTED_LANGUAGES=$enableval],
1.171 petere 159: [AC_DEFINE(ENABLE_NLS, 1,
1.242 petere 160: [Define to 1 if you want National Language Support. (--enable-nls)])])
1.128 petere 161: AC_MSG_RESULT([$enable_nls])
162: AC_SUBST(enable_nls)
163: AC_SUBST(WANTED_LANGUAGES)
164:
165: #
1.29 petere 166: # Default port number (--with-pgport), default 5432
167: #
168: AC_MSG_CHECKING([for default port number])
1.42 petere 169: PGAC_ARG_REQ(with, pgport, [ --with-pgport=PORTNUM change default port number [5432]],
170: [default_port=$withval],
171: [default_port=5432])
1.97 tgl 172: AC_MSG_RESULT([$default_port])
173: # Need both of these because some places want an integer and some a string
1.171 petere 174: AC_DEFINE_UNQUOTED(DEF_PGPORT, ${default_port},
1.242 petere 175: [Define to the default TCP port number on which the server listens and
1.280 tgl 176: to which clients will try to connect. This can be overridden at run-time,
177: but it's convenient if your clients have the right default compiled in.
178: (--with-pgport=PORTNUM)])
1.171 petere 179: AC_DEFINE_UNQUOTED(DEF_PGPORT_STR, "${default_port}",
1.280 tgl 180: [Define to the default TCP port number as a string constant.])
1.97 tgl 181: AC_SUBST(default_port)
1.1 petere 182:
1.29 petere 183: #
1.65 petere 184: # Option to disable shared libraries
185: #
186: PGAC_ARG_BOOL(enable, shared, yes,
1.68 petere 187: [ --disable-shared do not build shared libraries])
1.65 petere 188: AC_SUBST(enable_shared)
189:
1.69 petere 190: #
191: # '-rpath'-like feature can be disabled
192: #
193: PGAC_ARG_BOOL(enable, rpath, yes,
194: [ --disable-rpath do not embed shared library search path in executables])
195: AC_SUBST(enable_rpath)
196:
1.289 momjian 197: #
198: # Spinlocks
199: #
200: PGAC_ARG_BOOL(enable, spinlocks, yes,
1.298 petere 201: [ --disable-spinlocks do not use spinlocks])
1.65 petere 202:
203: #
1.74 petere 204: # --enable-debug adds -g to compiler flags
205: #
206: PGAC_ARG_BOOL(enable, debug, no,
207: [ --enable-debug build with debugging symbols (-g)])
1.168 momjian 208: AC_SUBST(enable_debug)
1.74 petere 209:
210: #
1.30 petere 211: # C compiler
212: #
213:
1.29 petere 214: # For historical reasons you can also use --with-CC to specify the C compiler
215: # to use, although the standard way to do this is to set the CC environment
216: # variable.
1.42 petere 217: PGAC_ARG_REQ(with, CC, [], [CC=$with_CC])
1.4 tgl 218:
1.171 petere 219: case $template in
220: aix) pgac_cc_list="gcc xlc";;
221: irix) pgac_cc_list="cc";; # no gcc
222: *) pgac_cc_list="gcc cc";;
223: esac
1.4 tgl 224:
1.171 petere 225: AC_PROG_CC([$pgac_cc_list])
1.280 tgl 226:
1.300 petere 227: unset CFLAGS
1.298 petere 228:
1.280 tgl 229: #
1.30 petere 230: # Read the template
1.280 tgl 231: #
1.30 petere 232: . "$srcdir/src/template/$template" || exit
1.74 petere 233:
1.298 petere 234: # CFLAGS are selected so:
235: # If the user specifies something in the environment, that is used.
236: # else: If the template file set something, that is used.
237: # else: If the compiler is GCC, then we use -O2.
238: # else: If the compiler is something else, then we use -0.
239:
1.171 petere 240: if test "$ac_env_CFLAGS_set" = set; then
241: CFLAGS=$ac_env_CFLAGS_value
1.300 petere 242: elif test "${CFLAGS+set}" = set; then
1.298 petere 243: : # (keep what template set)
244: elif test "$GCC" = yes; then
245: CFLAGS="-O2"
1.296 tgl 246: else
1.300 petere 247: # if the user selected debug mode, don't use -O
248: if test "$enable_debug" != yes; then
249: CFLAGS="-O"
250: fi
1.294 momjian 251: fi
1.298 petere 252:
1.382 neilc 253: if test "$GCC" = yes; then
254: CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wpointer-arith"
255:
256: # Some versions of GCC support some additional useful warning flags.
257: # Check whether they are supported, and add them to CFLAGS if so.
258: PGAC_PROG_CC_CFLAGS_OPT([-Wdeclaration-after-statement])
259: PGAC_PROG_CC_CFLAGS_OPT([-Wold-style-definition])
260: PGAC_PROG_CC_CFLAGS_OPT([-Wendif-labels])
261:
262: # Disable strict-aliasing rules; needed for gcc 3.3+
263: PGAC_PROG_CC_CFLAGS_OPT([-fno-strict-aliasing])
264: fi
1.298 petere 265:
1.296 tgl 266: # supply -g if --enable-debug
1.300 petere 267: if test "$enable_debug" = yes && test "$ac_cv_prog_cc_g" = yes; then
1.74 petere 268: CFLAGS="$CFLAGS -g"
1.296 tgl 269: fi
1.298 petere 270:
1.171 petere 271: AC_MSG_NOTICE([using CFLAGS=$CFLAGS])
1.285 momjian 272:
273: # We already have this in Makefile.win32, but configure needs it too
1.298 petere 274: if test "$PORTNAME" = "win32"; then
1.312 momjian 275: CPPFLAGS="$CPPFLAGS -I$srcdir/src/include/port/win32 -DEXEC_BACKEND"
1.285 momjian 276: fi
1.210 petere 277:
1.30 petere 278: # Check if the compiler still works with the template settings
1.171 petere 279: AC_MSG_CHECKING([whether the C compiler still works])
280: AC_TRY_LINK([], [return 0;],
281: [AC_MSG_RESULT(yes)],
282: [AC_MSG_RESULT(no)
283: AC_MSG_ERROR([cannot proceed])])
1.210 petere 284:
1.296 tgl 285: # Defend against gcc -ffast-math
1.210 petere 286: if test "$GCC" = yes; then
287: AC_TRY_COMPILE([], [@%:@ifdef __FAST_MATH__
288: choke me
289: @%:@endif], [], [AC_MSG_ERROR([do not put -ffast-math in CFLAGS])])
290: fi
291:
1.4 tgl 292: AC_PROG_CPP
1.6 petere 293: AC_SUBST(GCC)
1.4 tgl 294:
1.29 petere 295: # Create compiler version string
1.24 petere 296: if test x"$GCC" = x"yes" ; then
1.169 momjian 297: cc_string="GCC `${CC} --version | sed q`"
1.4 tgl 298: else
1.24 petere 299: cc_string=$CC
1.4 tgl 300: fi
1.242 petere 301: AC_DEFINE_UNQUOTED(PG_VERSION_STR,
302: ["PostgreSQL $PACKAGE_VERSION on $host, compiled by $cc_string"],
303: [A string containing the version number, platform, and C compiler])
1.309 tgl 304:
305:
306: #
1.415 petere 307: # Native compiler
308: #
309:
310: if test -z "$CC_FOR_BUILD"; then
311: CC_FOR_BUILD=$CC
312: fi
313:
314: AC_SUBST(CC_FOR_BUILD)
315:
316:
317: #
1.309 tgl 318: # Set up TAS assembly code if needed; the template file has now had its
319: # chance to request this.
320: #
321: AC_CONFIG_LINKS([src/backend/port/tas.s:src/backend/port/tas/${tas_file}])
322:
323: if test "$need_tas" = yes ; then
324: TAS=tas.o
325: else
326: TAS=""
327: fi
328: AC_SUBST(TAS)
1.24 petere 329:
1.4 tgl 330:
1.31 petere 331: #
332: # Automatic dependency tracking
333: #
1.42 petere 334: PGAC_ARG_BOOL(enable, depend, no, [ --enable-depend turn on automatic dependency tracking],
335: [autodepend=yes])
1.31 petere 336: AC_SUBST(autodepend)
337:
338:
1.42 petere 339: #
340: # Enable assert checks
341: #
342: PGAC_ARG_BOOL(enable, cassert, no, [ --enable-cassert enable assertion checks (for debugging)],
343: [AC_DEFINE([USE_ASSERT_CHECKING], 1,
1.242 petere 344: [Define to 1 to build with assertion checks. (--enable-cassert)])])
1.30 petere 345:
346:
347: #
348: # Include directories
349: #
350: ac_save_IFS=$IFS
1.375 tgl 351: IFS="${IFS}${PATH_SEPARATOR}"
1.30 petere 352: # SRCH_INC comes from the template file
353: for dir in $with_includes $SRCH_INC; do
354: if test -d "$dir"; then
355: INCLUDES="$INCLUDES -I$dir"
356: else
357: AC_MSG_WARN([*** Include directory $dir does not exist.])
358: fi
359: done
360: IFS=$ac_save_IFS
361: AC_SUBST(INCLUDES)
362:
363:
364: #
365: # Library directories
366: #
367: ac_save_IFS=$IFS
1.375 tgl 368: IFS="${IFS}${PATH_SEPARATOR}"
1.30 petere 369: # LIBRARY_DIRS comes from command line, SRCH_LIB from template file.
370: for dir in $LIBRARY_DIRS $SRCH_LIB; do
371: if test -d "$dir"; then
1.68 petere 372: LIBDIRS="$LIBDIRS -L$dir"
1.30 petere 373: else
374: AC_MSG_WARN([*** Library directory $dir does not exist.])
375: fi
376: done
377: IFS=$ac_save_IFS
378:
1.43 petere 379: #
1.280 tgl 380: # Enable thread-safe client libraries
1.261 momjian 381: #
1.280 tgl 382: AC_MSG_CHECKING([allow thread-safe client libraries])
1.366 momjian 383: PGAC_ARG_BOOL(enable, thread-safety, no, [ --enable-thread-safety make client libraries thread-safe])
384: PGAC_ARG_BOOL(enable, thread-safety-force, no, [ --enable-thread-safety-force force thread-safety in spite of thread test failure])
1.369 momjian 385: if test "$enable_thread_safety" = yes -o \
386: "$enable_thread_safety_force" = yes; then
1.366 momjian 387: enable_thread_safety="yes" # for 'force'
388: AC_DEFINE([ENABLE_THREAD_SAFETY], 1,
389: [Define to 1 to build client libraries as thread-safe code. (--enable-thread-safety)])
390: fi
1.271 momjian 391: AC_MSG_RESULT([$enable_thread_safety])
392: AC_SUBST(enable_thread_safety)
1.261 momjian 393:
394: #
1.379 neilc 395: # Optionally build Tcl modules (PL/Tcl)
1.43 petere 396: #
397: AC_MSG_CHECKING([whether to build with Tcl])
1.379 neilc 398: PGAC_ARG_BOOL(with, tcl, no, [ --with-tcl build Tcl modules (PL/Tcl)])
1.43 petere 399: AC_MSG_RESULT([$with_tcl])
400: AC_SUBST([with_tcl])
401:
1.171 petere 402: # We see if the path to the Tcl/Tk configuration scripts is specified.
1.42 petere 403: # This will override the use of tclsh to find the paths to search.
404:
1.323 pgsql 405: PGAC_ARG_REQ(with, tclconfig, [ --with-tclconfig=DIR tclConfig.sh is in DIR])
1.125 petere 406:
1.42 petere 407: #
1.205 petere 408: # Optionally build Perl modules (PL/Perl)
1.199 momjian 409: #
410: AC_MSG_CHECKING([whether to build Perl modules])
1.205 petere 411: PGAC_ARG_BOOL(with, perl, no, [ --with-perl build Perl modules (PL/Perl)])
1.199 momjian 412: AC_MSG_RESULT([$with_perl])
413: AC_SUBST(with_perl)
414:
415: #
1.283 petere 416: # Optionally build Python modules (PL/Python)
1.42 petere 417: #
418: AC_MSG_CHECKING([whether to build Python modules])
1.283 petere 419: PGAC_ARG_BOOL(with, python, no, [ --with-python build Python modules (PL/Python)])
1.126 petere 420: AC_MSG_RESULT([$with_python])
1.5 petere 421: AC_SUBST(with_python)
1.13 petere 422:
1.28 petere 423: #
424: # Kerberos 5
425: #
1.171 petere 426: AC_MSG_CHECKING([whether to build with Kerberos 5 support])
1.307 petere 427: PGAC_ARG_BOOL(with, krb5, no, [ --with-krb5 build with Kerberos 5 support],
1.42 petere 428: [
1.242 petere 429: AC_DEFINE(KRB5, 1, [Define to build with Kerberos 5 support. (--with-krb5)])
1.42 petere 430: krb_srvtab="FILE:\$(sysconfdir)/krb5.keytab"
1.307 petere 431: ])
432: AC_MSG_RESULT([$with_krb5])
1.42 petere 433: AC_SUBST(with_krb5)
1.28 petere 434:
435:
1.37 petere 436: AC_SUBST(krb_srvtab)
1.13 petere 437:
438:
1.28 petere 439: #
440: # Kerberos configuration parameters
441: #
1.42 petere 442: PGAC_ARG_REQ(with, krb-srvnam,
1.412 momjian 443: [ --with-krb-srvnam=NAME name of the default service principal in Kerberos [[postgres]]],
1.42 petere 444: [],
445: [with_krb_srvnam="postgres"])
446: AC_DEFINE_UNQUOTED([PG_KRB_SRVNAM], ["$with_krb_srvnam"],
1.412 momjian 447: [Define to the name of the default PostgreSQL service principal in Kerberos. (--with-krb-srvnam=NAME)])
1.13 petere 448:
1.28 petere 449:
1.136 momjian 450: #
451: # PAM
452: #
453: AC_MSG_CHECKING([whether to build with PAM support])
1.158 petere 454: PGAC_ARG_BOOL(with, pam, no,
455: [ --with-pam build with PAM support],
1.242 petere 456: [AC_DEFINE([USE_PAM], 1, [Define to 1 to build with PAM support. (--with-pam)])])
1.158 petere 457: AC_MSG_RESULT([$with_pam])
1.136 momjian 458: AC_SUBST(with_pam)
459:
1.28 petere 460:
461: #
1.411 momjian 462: # Bonjour
1.258 momjian 463: #
1.411 momjian 464: AC_MSG_CHECKING([whether to build with Bonjour support])
465: PGAC_ARG_BOOL(with, bonjour, no,
466: [ --with-bonjour build with Bonjour support],
467: [AC_DEFINE([USE_BONJOUR], 1, [Define to 1 to build with Bonjour support. (--with-bonjour)])])
468: AC_MSG_RESULT([$with_bonjour])
469: AC_SUBST(with_bonjour)
1.258 momjian 470:
471:
472: #
1.28 petere 473: # OpenSSL
474: #
1.307 petere 475: AC_MSG_CHECKING([whether to build with OpenSSL support])
476: PGAC_ARG_BOOL(with, openssl, no, [ --with-openssl build with OpenSSL support],
477: [AC_DEFINE([USE_SSL], 1, [Define to build with (Open)SSL support. (--with-openssl)])])
478: AC_MSG_RESULT([$with_openssl])
1.42 petere 479: AC_SUBST(with_openssl)
1.28 petere 480:
1.13 petere 481:
1.177 petere 482: #
483: # Readline
484: #
485: PGAC_ARG_BOOL(with, readline, yes,
486: [ --without-readline do not use Readline])
1.369 momjian 487: # readline on MinGW has problems with backslashes in psql and other bugs.
488: # This is particularly a problem with non-US code pages.
489: # Therefore disable its use until we understand the cause. 2004-07-20
1.376 momjian 490: if test "$PORTNAME" = "win32"; then
1.369 momjian 491: if test "$with_readline" = yes; then
492: AC_MSG_WARN([*** Readline does not work on MinGW --- disabling])
493: with_readline=no
1.376 momjian 494: fi
495: fi
1.369 momjian 496:
1.177 petere 497:
498: #
499: # Zlib
500: #
501: PGAC_ARG_BOOL(with, zlib, yes,
502: [ --without-zlib do not use Zlib])
1.416 ! tgl 503: AC_SUBST(with_zlib)
1.3 momjian 504:
1.254 momjian 505: #
506: # Elf
507: #
1.3 momjian 508:
1.30 petere 509: # Assume system is ELF if it predefines __ELF__ as 1,
510: # otherwise believe host_os based default.
511: case $host_os in
1.127 momjian 512: freebsd1*|freebsd2*) elf=no;;
513: freebsd3*|freebsd4*) elf=yes;;
1.30 petere 514: esac
1.1 petere 515:
516: AC_EGREP_CPP(yes,
517: [#if __ELF__
518: yes
519: #endif
520: ],
1.30 petere 521: [ELF_SYS=true],
522: [if test "X$elf" = "Xyes" ; then
523: ELF_SYS=true
1.1 petere 524: else
1.30 petere 525: ELF_SYS=
526: fi])
527: AC_SUBST(ELF_SYS)
1.1 petere 528:
1.254 momjian 529: #
530: # Assignments
531: #
1.1 petere 532:
1.30 petere 533: CPPFLAGS="$CPPFLAGS $INCLUDES"
1.68 petere 534: LDFLAGS="$LDFLAGS $LIBDIRS"
1.30 petere 535:
1.410 neilc 536: AC_MSG_NOTICE([using CPPFLAGS=$CPPFLAGS])
537: AC_MSG_NOTICE([using LDFLAGS=$LDFLAGS])
538:
1.381 momjian 539: AC_ARG_VAR(LDFLAGS_SL)
1.30 petere 540:
1.2 petere 541: AC_PROG_AWK
1.39 petere 542: PGAC_PATH_FLEX
1.1 petere 543: AC_PROG_LN_S
1.368 petere 544: PGAC_PROG_LD
1.67 petere 545: AC_SUBST(LD)
546: AC_SUBST(with_gnu_ld)
1.130 momjian 547: case $host_os in sysv5*)
1.77 petere 548: AC_CACHE_CHECK([whether ld -R works], [pgac_cv_prog_ld_R],
549: [
550: pgac_save_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS -Wl,-R/usr/lib"
551: AC_TRY_LINK([], [], [pgac_cv_prog_ld_R=yes], [pgac_cv_prog_ld_R=no])
552: LDFLAGS=$pgac_save_LDFLAGS
553: ])
554: ld_R_works=$pgac_cv_prog_ld_R
555: AC_SUBST(ld_R_works)
556: esac
1.1 petere 557: AC_PROG_RANLIB
1.58 petere 558: AC_CHECK_PROGS(LORDER, lorder)
1.56 petere 559: AC_PATH_PROG(TAR, tar)
1.176 petere 560: PGAC_CHECK_STRIP
1.98 petere 561:
562: AC_CHECK_PROGS(YACC, ['bison -y'])
1.255 momjian 563:
564: if test "$YACC"; then
1.257 tgl 565: if $YACC --version | sed q | $AWK '{ if ($4 < 1.875) exit 0; else exit 1;}'; then
1.255 momjian 566: AC_MSG_WARN([
1.318 momjian 567: *** If you are going to modify the grammar files or build from CVS, the installed
1.317 momjian 568: *** version of Bison is too old. Bison version 1.875 or later is required.])
1.255 momjian 569: fi
570: fi
571:
1.98 petere 572: if test -z "$YACC"; then
573: AC_MSG_WARN([
574: *** Without Bison you will not be able to build PostgreSQL from CVS or
575: *** change any of the parser definition files. You can obtain Bison from
576: *** a GNU mirror site. (If you are using the official distribution of
577: *** PostgreSQL then you do not need to worry about this because the Bison
578: *** output is pre-generated.) To use a different yacc program (possible,
579: *** but not recommended), set the environment variable YACC before running
580: *** 'configure'.])
581: fi
1.6 petere 582: AC_SUBST(YFLAGS)
1.98 petere 583:
1.199 momjian 584: PGAC_PATH_PERL
585: if test "$with_perl" = yes; then
1.205 petere 586: PGAC_CHECK_PERL_CONFIGS([archlibexp,privlibexp,useshrplib])
1.199 momjian 587: PGAC_CHECK_PERL_EMBED_LDFLAGS
1.126 petere 588: fi
589:
590: if test "$with_python" = yes; then
591: PGAC_PATH_PYTHON
592: PGAC_CHECK_PYTHON_EMBED_SETUP
1.43 petere 593: fi
1.1 petere 594:
595:
1.183 tgl 596: ##
1.29 petere 597: ## Libraries
598: ##
599:
1.1 petere 600: if test "$PORTNAME" != "aix" -a "$PORTNAME" != "alpha"
601: then
602: AC_CHECK_LIB(bsd, main)
603: fi
1.21 petere 604: AC_CHECK_LIB(util, setproctitle)
1.1 petere 605: AC_CHECK_LIB(m, main)
606: AC_CHECK_LIB(dl, main)
1.354 momjian 607: AC_CHECK_LIB(nsl, main)
608: AC_CHECK_LIB(socket, main)
1.1 petere 609: AC_CHECK_LIB(ipc, main)
610: AC_CHECK_LIB(IPC, main)
611: AC_CHECK_LIB(lc, main)
612: AC_CHECK_LIB(dld, main)
613: AC_CHECK_LIB(ld, main)
614: AC_CHECK_LIB(compat, main)
615: AC_CHECK_LIB(BSD, main)
1.354 momjian 616: AC_CHECK_LIB(gen, main)
1.1 petere 617: AC_CHECK_LIB(PW, main)
1.95 petere 618: AC_CHECK_LIB(resolv, main)
1.209 momjian 619: AC_SEARCH_LIBS(getopt_long, [getopt gnugetopt])
1.139 petere 620: # QNX:
1.223 momjian 621: AC_CHECK_LIB(unix, main)
1.21 petere 622: AC_SEARCH_LIBS(crypt, crypt)
1.139 petere 623: # BeOS:
1.273 tgl 624: if test "$PORTNAME" = "beos"
625: then
626: AC_CHECK_LIB(bind, __inet_ntoa)
627: fi
1.139 petere 628: # Solaris:
1.140 petere 629: AC_SEARCH_LIBS(fdatasync, [rt posix4])
1.206 petere 630: # Cygwin:
631: AC_CHECK_LIB(cygipc, shmget)
1.280 tgl 632: # WIN32:
633: if test "$PORTNAME" = "win32"
634: then
635: AC_CHECK_LIB(wsock32, main)
636: fi
1.28 petere 637:
1.177 petere 638: if test "$with_readline" = yes; then
639: PGAC_CHECK_READLINE
640: if test x"$pgac_cv_check_readline" = x"no"; then
641: AC_MSG_ERROR([readline library not found
1.208 momjian 642: If you have readline already installed, see config.log for details on the
643: failure. It is possible the compiler isn't looking in the proper directory.
1.177 petere 644: Use --without-readline to disable readline support.])
645: fi
646: fi
647:
648: if test "$with_zlib" = yes; then
649: AC_CHECK_LIB(z, inflate, [],
650: [AC_MSG_ERROR([zlib library not found
1.208 momjian 651: If you have zlib already installed, see config.log for details on the
652: failure. It is possible the compiler isn't looking in the proper directory.
1.177 petere 653: Use --without-zlib to disable zlib support.])])
1.287 momjian 654: fi
655:
1.289 momjian 656: if test "$enable_spinlocks" = yes; then
1.287 momjian 657: AC_DEFINE(HAVE_SPINLOCKS, 1, [Define to 1 if you have spinlocks.])
658: else
659: AC_MSG_WARN([
660: *** Not using spinlocks will cause poor performance.])
1.177 petere 661: fi
662:
1.28 petere 663: if test "$with_krb5" = yes ; then
1.407 tgl 664: if test "$PORTNAME" != "win32"; then
665: AC_SEARCH_LIBS(com_err, [krb5 'krb5 -ldes -lasn1 -lroken' com_err], [],
666: [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
667: AC_SEARCH_LIBS(krb5_encrypt, [krb5 'krb5 -ldes -lasn1 -lroken' crypto k5crypto], [],
668: [AC_MSG_ERROR([could not find function 'krb5_encrypt' required for Kerberos 5])])
669: AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -ldes -lasn1 -lroken'], [],
670: [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
671: else
672: AC_SEARCH_LIBS(com_err, 'comerr32 -lkrb5_32', [],
673: [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
674: fi
1.28 petere 675: fi
676:
677: if test "$with_openssl" = yes ; then
678: dnl Order matters!
1.380 momjian 679: if test "$PORTNAME" != "win32"; then
680: AC_CHECK_LIB(crypto, CRYPTO_new_ex_data, [], [AC_MSG_ERROR([library 'crypto' is required for OpenSSL])])
681: AC_CHECK_LIB(ssl, SSL_library_init, [], [AC_MSG_ERROR([library 'ssl' is required for OpenSSL])])
682: else
683: AC_CHECK_LIB(eay32, CRYPTO_new_ex_data, [], [AC_MSG_ERROR([library 'eay32' is required for OpenSSL])])
684: AC_CHECK_LIB(ssleay32, SSL_library_init, [], [AC_MSG_ERROR([library 'ssleay32' is required for OpenSSL])])
685: fi
1.128 petere 686: fi
687:
1.136 momjian 688: if test "$with_pam" = yes ; then
1.223 momjian 689: AC_CHECK_LIB(pam, pam_start, [], [AC_MSG_ERROR([library 'pam' is required for PAM])])
1.136 momjian 690: fi
691:
1.171 petere 692:
1.29 petere 693: ##
694: ## Header files
695: ##
1.194 petere 696:
1.171 petere 697: dnl sys/socket.h is required by AC_FUNC_ACCEPT_ARGTYPES
1.367 petere 698: AC_CHECK_HEADERS([crypt.h dld.h endian.h fp_class.h getopt.h ieeefp.h langinfo.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/time.h sys/un.h termios.h utime.h wchar.h wctype.h kernel/OS.h kernel/image.h SupportDefs.h])
1.66 tgl 699:
1.171 petere 700: # At least on IRIX, cpp test for netinet/tcp.h will fail unless
701: # netinet/in.h is included first.
1.223 momjian 702: AC_CHECK_HEADERS(netinet/in.h)
703: AC_CHECK_HEADERS(netinet/tcp.h, [], [],
1.173 petere 704: [AC_INCLUDES_DEFAULT
705: #ifdef HAVE_NETINET_IN_H
1.66 tgl 706: #include <netinet/in.h>
707: #endif
1.171 petere 708: ])
1.73 petere 709:
1.387 tgl 710: if expr x"$pgac_cv_check_readline" : 'x-lreadline' >/dev/null ; then
1.223 momjian 711: AC_CHECK_HEADERS(readline/readline.h, [],
1.389 tgl 712: [AC_CHECK_HEADERS(readline.h, [],
713: [AC_MSG_ERROR([readline header not found
1.208 momjian 714: If you have readline already installed, see config.log for details on the
715: failure. It is possible the compiler isn't looking in the proper directory.
1.387 tgl 716: Use --without-readline to disable readline support.])])])
1.223 momjian 717: AC_CHECK_HEADERS(readline/history.h, [],
1.389 tgl 718: [AC_CHECK_HEADERS(history.h, [],
719: [AC_MSG_ERROR([history header not found
1.208 momjian 720: If you have readline already installed, see config.log for details on the
721: failure. It is possible the compiler isn't looking in the proper directory.
1.387 tgl 722: Use --without-readline to disable readline support.])])])
723: fi
724:
725: if expr x"$pgac_cv_check_readline" : 'x-ledit' >/dev/null ; then
1.389 tgl 726: # Some installations of libedit usurp /usr/include/readline/, which seems
727: # bad practice, since in combined installations readline will have its headers
728: # there. We might have to resort to AC_EGREP checks to make sure we found
729: # the proper header...
1.387 tgl 730: AC_CHECK_HEADERS(editline/readline.h, [],
1.389 tgl 731: [AC_CHECK_HEADERS(readline.h, [],
732: [AC_CHECK_HEADERS(readline/readline.h, [],
733: [AC_MSG_ERROR([readline header not found
1.387 tgl 734: If you have libedit already installed, see config.log for details on the
735: failure. It is possible the compiler isn't looking in the proper directory.
1.389 tgl 736: Use --without-readline to disable libedit support.])])])])
1.387 tgl 737: AC_CHECK_HEADERS(editline/history.h, [],
1.389 tgl 738: [AC_CHECK_HEADERS(history.h, [],
739: [AC_CHECK_HEADERS(readline/history.h, [],
740: [AC_MSG_ERROR([history header not found
1.387 tgl 741: If you have libedit already installed, see config.log for details on the
742: failure. It is possible the compiler isn't looking in the proper directory.
1.389 tgl 743: Use --without-readline to disable libedit 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_krb5" = yes ; then
754: AC_CHECK_HEADER(krb5.h, [], [AC_MSG_ERROR([header file <krb5.h> is required for Kerberos 5])])
755: fi
756:
757: if test "$with_openssl" = yes ; then
1.223 momjian 758: AC_CHECK_HEADER(openssl/ssl.h, [], [AC_MSG_ERROR([header file <openssl/ssl.h> is required for OpenSSL])])
759: AC_CHECK_HEADER(openssl/err.h, [], [AC_MSG_ERROR([header file <openssl/err.h> is required for OpenSSL])])
1.136 momjian 760: fi
761:
762: if test "$with_pam" = yes ; then
1.236 momjian 763: AC_CHECK_HEADERS(security/pam_appl.h, [],
764: [AC_CHECK_HEADERS(pam/pam_appl.h, [],
765: [AC_MSG_ERROR([header file <security/pam_appl.h> or <pam/pam_appl.h> is required for PAM.])])])
1.258 momjian 766: fi
767:
1.411 momjian 768: if test "$with_bonjour" = yes ; then
769: AC_CHECK_HEADER(DNSServiceDiscovery/DNSServiceDiscovery.h, [], [AC_MSG_ERROR([header file <DNSServiceDiscovery/DNSServiceDiscovery.h> is required for Bonjour])])
1.28 petere 770: fi
771:
1.1 petere 772:
1.29 petere 773: ##
774: ## Types, structures, compiler characteristics
775: ##
1.194 petere 776:
1.171 petere 777: m4_defun([AC_PROG_CC_STDC], []) dnl We don't want that.
1.1 petere 778: AC_C_CONST
779: AC_C_INLINE
780: AC_C_STRINGIZE
1.40 petere 781: PGAC_C_SIGNED
1.171 petere 782: AC_C_VOLATILE
1.244 tgl 783: PGAC_C_FUNCNAME_SUPPORT
1.253 tgl 784: PGAC_STRUCT_TIMEZONE
1.29 petere 785: PGAC_UNION_SEMUN
1.44 petere 786: PGAC_STRUCT_SOCKADDR_UN
1.259 momjian 787: PGAC_STRUCT_SOCKADDR_STORAGE
1.270 tgl 788: PGAC_STRUCT_SOCKADDR_STORAGE_MEMBERS
1.241 tgl 789: PGAC_STRUCT_ADDRINFO
1.166 petere 790:
1.171 petere 791: AC_CHECK_TYPES([struct cmsgcred, struct fcred, struct sockcred], [], [],
792: [#include <sys/param.h>
1.260 tgl 793: #include <sys/types.h>
1.171 petere 794: #include <sys/socket.h>
795: #include <sys/ucred.h>])
796:
1.278 tgl 797: AC_CHECK_TYPES([struct option], [], [],
798: [#ifdef HAVE_GETOPT_H
1.279 tgl 799: #include <getopt.h>
1.278 tgl 800: #endif])
801:
1.177 petere 802: if test "$with_zlib" = yes; then
803: # Check that <zlib.h> defines z_streamp (versions before about 1.0.4
804: # did not). While we could work around the lack of z_streamp, it
805: # seems unwise to encourage people to use such old zlib versions...
806: AC_CHECK_TYPE(z_streamp, [], [AC_MSG_ERROR([zlib version is too old
807: Use --without-zlib to disable zlib support.])],
808: [#include <zlib.h>])
809: fi
810:
1.166 petere 811: if test "$with_krb5" = yes; then
812: # Check for differences between MIT and Heimdal (KTH) releases
1.223 momjian 813: AC_CHECK_MEMBERS(krb5_ticket.enc_part2, [],
1.229 momjian 814: [AC_CHECK_MEMBERS(krb5_ticket.client, [],
1.171 petere 815: [AC_MSG_ERROR([could not determine how to get client name from Kerberos 5 ticket])],
816: [#include <krb5.h>])],
817: [#include <krb5.h>])
1.223 momjian 818: AC_CHECK_MEMBERS(krb5_error.text.data, [],
819: [AC_CHECK_MEMBERS(krb5_error.e_data, [],
1.205 petere 820: [AC_MSG_ERROR([could not determine how to extract Kerberos 5 error messages])],
821: [#include <krb5.h>])],
1.171 petere 822: [#include <krb5.h>])
1.166 petere 823: fi
824:
1.29 petere 825: ##
826: ## Functions, global variables
827: ##
1.194 petere 828:
1.6 petere 829: PGAC_VAR_INT_TIMEZONE
1.29 petere 830: AC_FUNC_ACCEPT_ARGTYPES
1.6 petere 831: PGAC_FUNC_GETTIMEOFDAY_1ARG
1.1 petere 832:
1.385 tgl 833: AC_CHECK_FUNCS([cbrt dlopen fcvt fdatasync getpeereid memmove poll pstat readlink setproctitle setsid sigprocmask symlink sysconf towlower utime utimes waitpid wcstombs])
1.99 tgl 834:
1.171 petere 835: AC_CHECK_DECLS(fdatasync, [], [], [#include <unistd.h>])
1.226 momjian 836:
1.284 tgl 837: HAVE_IPV6=no
1.240 petere 838: AC_CHECK_TYPE([struct sockaddr_in6],
839: [AC_CHECK_FUNC(inet_ntop,
1.284 tgl 840: [AC_DEFINE(HAVE_IPV6, 1, [Define to 1 if you have support for IPv6.])
841: HAVE_IPV6=yes])],
1.240 petere 842: [],
1.231 petere 843: [$ac_includes_default
1.240 petere 844: #include <netinet/in.h>])
1.284 tgl 845: AC_SUBST(HAVE_IPV6)
1.1 petere 846:
1.28 petere 847: AC_CACHE_CHECK([for PS_STRINGS], [pgac_cv_var_PS_STRINGS],
848: [AC_TRY_LINK(
849: [#include <machine/vmparam.h>
850: #include <sys/exec.h>
851: ],
1.1 petere 852: [PS_STRINGS->ps_nargvstr = 1;
853: PS_STRINGS->ps_argvstr = "foo";],
1.28 petere 854: [pgac_cv_var_PS_STRINGS=yes],
855: [pgac_cv_var_PS_STRINGS=no])])
856: if test "$pgac_cv_var_PS_STRINGS" = yes ; then
1.242 petere 857: AC_DEFINE([HAVE_PS_STRINGS], [], [Define to 1 if the PS_STRINGS thing exists.])
1.28 petere 858: fi
1.1 petere 859:
1.171 petere 860:
861: # We use our snprintf.c emulation if either snprintf() or vsnprintf()
862: # is missing. Yes, there are machines that have only one. We may
863: # also decide to use snprintf.c if snprintf() is present but does not
1.401 tgl 864: # have all the features we need --- see below.
1.171 petere 865:
1.194 petere 866: pgac_need_repl_snprintf=no
867: AC_CHECK_FUNCS(snprintf, [], pgac_need_repl_snprintf=yes)
868: AC_CHECK_FUNCS(vsnprintf, [], pgac_need_repl_snprintf=yes)
1.171 petere 869:
870:
871: # Check whether <stdio.h> declares snprintf() and vsnprintf(); if not,
872: # include/c.h will provide declarations. Note this is a separate test
873: # from whether the functions exist in the C library --- there are
874: # systems that have the functions but don't bother to declare them :-(
875:
876: AC_CHECK_DECLS([snprintf, vsnprintf])
877:
1.29 petere 878:
879: # do this one the hard way in case isinf() is a macro
880: AC_CACHE_CHECK([for isinf], ac_cv_func_isinf,
1.1 petere 881: [AC_TRY_LINK(
1.29 petere 882: [#include <math.h>
883: ],
1.1 petere 884: [double x = 0.0; int res = isinf(x);],
1.29 petere 885: [ac_cv_func_isinf=yes],
886: [ac_cv_func_isinf=no])])
887:
888: if test $ac_cv_func_isinf = yes ; then
1.242 petere 889: AC_DEFINE(HAVE_ISINF, 1, [Define to 1 if you have isinf().])
1.1 petere 890: else
1.194 petere 891: AC_LIBOBJ(isinf)
1.29 petere 892: # Look for a way to implement a substitute for isinf()
893: AC_CHECK_FUNCS([fpclass fp_class fp_class_d class], [break])
1.1 petere 894: fi
1.171 petere 895:
1.345 tgl 896: AC_REPLACE_FUNCS([crypt fseeko getopt getrusage inet_aton random rint srandom strdup strerror strtol strtoul unsetenv])
1.241 tgl 897:
898: # system's version of getaddrinfo(), if any, may be used only if we found
899: # a definition for struct addrinfo; see notes in src/include/getaddrinfo.h
900: if test x"$ac_cv_type_struct_addrinfo" = xyes ; then
901: AC_REPLACE_FUNCS([getaddrinfo])
902: else
903: AC_LIBOBJ(getaddrinfo)
1.278 tgl 904: fi
905:
906: # similarly, use system's getopt_long() only if system provides struct option.
907: if test x"$ac_cv_type_struct_option" = xyes ; then
908: AC_REPLACE_FUNCS([getopt_long])
909: else
910: AC_LIBOBJ(getopt_long)
1.241 tgl 911: fi
1.193 momjian 912:
1.216 momjian 913: # BSD/OS & NetBSD use a custom fseeko/ftello built on fsetpos/fgetpos
1.214 momjian 914: # We override the previous test that said fseeko/ftello didn't exist
1.216 momjian 915: # OS tests are also done in include/c.h and port/fseeko.c
916: case $host_os in bsdi*|netbsd*)
1.214 momjian 917: ac_cv_func_fseeko=yes
918: esac
919:
1.222 momjian 920: # Solaris has a very slow qsort in certain cases, so we replace it.
1.376 momjian 921: if test "$PORTNAME" = "solaris"; then
922: AC_LIBOBJ(qsort)
923: fi
1.243 momjian 924:
1.319 momjian 925: # Win32 support
1.376 momjian 926: if test "$PORTNAME" = "win32"; then
1.312 momjian 927: AC_LIBOBJ(copydir)
1.310 momjian 928: AC_LIBOBJ(gettimeofday)
1.359 momjian 929: AC_LIBOBJ(kill)
1.322 momjian 930: AC_LIBOBJ(open)
1.372 momjian 931: AC_LIBOBJ(rand)
932: AC_DEFINE([HAVE_SYMLINK], 1,
933: [Define to 1 if you have the `symlink' function.])
1.376 momjian 934: fi
1.313 momjian 935:
1.177 petere 936: if test "$with_readline" = yes; then
937: PGAC_VAR_RL_COMPLETION_APPEND_CHARACTER
938: AC_CHECK_FUNCS([rl_completion_matches rl_filename_completion_function])
1.237 momjian 939: AC_CHECK_FUNCS([replace_history_entry])
1.177 petere 940: fi
1.1 petere 941:
942:
943: dnl Cannot use AC_CHECK_FUNC because finite may be a macro
944: AC_MSG_CHECKING(for finite)
945: AC_TRY_LINK([#include <math.h>],
1.171 petere 946: [int dummy=finite(1.0);],
1.242 petere 947: [AC_DEFINE(HAVE_FINITE, 1, [Define to 1 if you have finite().])
1.171 petere 948: AC_MSG_RESULT(yes)],
949: [AC_MSG_RESULT(no)])
1.1 petere 950:
951: dnl Cannot use AC_CHECK_FUNC because sigsetjmp may be a macro
952: dnl (especially on GNU libc)
1.242 petere 953: dnl See also comments in c.h.
1.1 petere 954: AC_MSG_CHECKING(for sigsetjmp)
955: AC_TRY_LINK([#include <setjmp.h>],
1.171 petere 956: [sigjmp_buf x; sigsetjmp(x, 1);],
1.242 petere 957: [AC_DEFINE(HAVE_SIGSETJMP, 1, [Define to 1 if you have sigsetjmp().])
1.171 petere 958: AC_MSG_RESULT(yes)],
959: [AC_MSG_RESULT(no)])
1.1 petere 960:
1.222 momjian 961: AC_CHECK_FUNC(syslog,
1.242 petere 962: [AC_CHECK_HEADER(syslog.h,
963: [AC_DEFINE(HAVE_SYSLOG, 1, [Define to 1 if you have the syslog interface.])])])
1.1 petere 964:
1.76 petere 965: AC_CACHE_CHECK([for optreset], pgac_cv_var_int_optreset,
966: [AC_TRY_LINK([#include <unistd.h>],
967: [extern int optreset; optreset = 1;],
968: [pgac_cv_var_int_optreset=yes],
969: [pgac_cv_var_int_optreset=no])])
970: if test x"$pgac_cv_var_int_optreset" = x"yes"; then
1.242 petere 971: AC_DEFINE(HAVE_INT_OPTRESET, 1, [Define to 1 if you have the global variable 'int optreset'.])
1.76 petere 972: fi
973:
1.194 petere 974: AC_CHECK_FUNCS([strtoll strtoq], [break])
975: AC_CHECK_FUNCS([strtoull strtouq], [break])
976:
977: # Check for one of atexit() or on_exit()
978: AC_CHECK_FUNCS(atexit, [],
979: [AC_CHECK_FUNCS(on_exit, [],
1.225 momjian 980: [AC_MSG_ERROR([neither atexit() nor on_exit() found])])])
1.213 momjian 981:
1.195 petere 982: AC_FUNC_FSEEKO
1.266 momjian 983:
984: #
985: # Pthreads
986: #
987: # For each platform, we need to know about any special compile and link
988: # libraries, and whether the normal C function names are thread-safe.
1.281 momjian 989: # See the comment at the top of src/port/thread.c for more information.
1.266 momjian 990: #
1.271 momjian 991: if test "$enable_thread_safety" = yes; then
1.324 momjian 992: ACX_PTHREAD # set thread flags
1.334 momjian 993:
994: # Some platforms use these, so just defineed them. They can't hurt if they
995: # are not supported.
996: PTHREAD_CFLAGS="$PTHREAD_CFLAGS -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS"
997:
1.324 momjian 998:
999: # At this point, we don't want to muck with the compiler name for threading.
1000: # Let's see who fails, perhaps AIX. 2004-04-23
1001: if test "$PTHREAD_CC" != "$CC"; then
1002: AC_MSG_ERROR([
1003: PostgreSQL does not support platforms that require a special
1004: compiler binary for thread-safety.
1005: ])
1006: fi
1.266 momjian 1007:
1.324 momjian 1008: if test "$THREAD_SUPPORT" = no; then
1.266 momjian 1009: AC_MSG_ERROR([
1010: Cannot enable threads on your platform.
1.324 momjian 1011: Your platform is known to not support thread-safe programs.
1012: For details, compile and run src/bin/pg_thread_test.
1.266 momjian 1013: ])
1014: fi
1.262 momjian 1015:
1.316 momjian 1016: # Check for *_r functions
1.262 momjian 1017: _CFLAGS="$CFLAGS"
1.275 momjian 1018: _LIBS="$LIBS"
1.324 momjian 1019: CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
1020: LIBS="$LIBS $PTHREAD_LIBS"
1.384 momjian 1021:
1022: AC_CHECK_HEADER(pthread.h, [], [AC_MSG_ERROR([pthread.h not found, required for --enable-thread-safety])])
1023:
1.288 momjian 1024: AC_CHECK_FUNCS([strerror_r getpwuid_r gethostbyname_r])
1.321 momjian 1025:
1.364 momjian 1026: # Do test here with the proper thread flags
1.321 momjian 1027: PGAC_FUNC_GETPWUID_R_5ARG
1.361 momjian 1028: PGAC_FUNC_STRERROR_R_INT
1.363 momjian 1029:
1030: CFLAGS="$_CFLAGS"
1031: LIBS="$_LIBS"
1.316 momjian 1032:
1033: else
1034: # do not use values from template file
1.324 momjian 1035: PTHREAD_CFLAGS=
1036: PTHREAD_LIBS=
1.263 momjian 1037: fi
1.316 momjian 1038:
1.324 momjian 1039: AC_SUBST(PTHREAD_CFLAGS)
1040: AC_SUBST(PTHREAD_LIBS)
1.195 petere 1041:
1.109 petere 1042:
1043: # This test makes sure that run tests work at all. Sometimes a shared
1044: # library is found by the linker, but the runtime linker can't find it.
1045: # This check should come after all modifications of compiler or linker
1046: # variables, and before any other run tests.
1047: AC_MSG_CHECKING([test program])
1048: AC_TRY_RUN([int main() { return 0; }],
1049: [AC_MSG_RESULT(ok)],
1050: [AC_MSG_RESULT(failed)
1051: AC_MSG_ERROR([[
1052: *** Could not execute a simple test program. This may be a problem
1053: *** related to locating shared libraries. Check the file 'config.log'
1054: *** for the exact reason.]])],
1055: [AC_MSG_RESULT([cross-compiling])])
1056:
1057:
1.403 tgl 1058: # Force use of our snprintf if system's doesn't do arg control
1.404 momjian 1059: # This feature is used by NLS
1.409 momjian 1060: if test "$enable_nls" = yes &&
1061: test $pgac_need_repl_snprintf = no &&
1062: # On Win32, libintl replaces snprintf() with its own version that
1063: # understands arg control, so we don't need our own. In fact, it
1064: # also uses macros that conflict with ours, so we _can't_ use
1065: # our own.
1066: test "$PORTNAME" != "win32"; then
1.403 tgl 1067: PGAC_FUNC_PRINTF_ARG_CONTROL
1068: if test $pgac_cv_printf_arg_control != yes ; then
1069: pgac_need_repl_snprintf=yes
1070: fi
1071: fi
1072:
1073:
1.1 petere 1074: dnl Check to see if we have a working 64-bit integer type.
1075: dnl This breaks down into two steps:
1076: dnl (1) figure out if the compiler has a 64-bit int type with working
1077: dnl arithmetic, and if so
1078: dnl (2) see whether snprintf() can format the type correctly. (Currently,
1079: dnl snprintf is the only library routine we really need for int8 support.)
1080: dnl It's entirely possible to have a compiler that handles a 64-bit type
1081: dnl when the C library doesn't; this is fairly likely when using gcc on
1082: dnl an older platform, for example.
1083: dnl If there is no native snprintf() or it does not handle the 64-bit type,
1084: dnl we force our own version of snprintf() to be used instead.
1085: dnl Note this test must be run after our initial check for snprintf/vsnprintf.
1086:
1.6 petere 1087: PGAC_TYPE_64BIT_INT([long int])
1.1 petere 1088:
1.6 petere 1089: if test x"$HAVE_LONG_INT_64" = x"no" ; then
1090: PGAC_TYPE_64BIT_INT([long long int])
1091: fi
1.1 petere 1092:
1093:
1.112 tgl 1094: dnl If we need to use "long long int", figure out whether nnnLL notation works.
1095:
1.201 momjian 1096: if test x"$HAVE_LONG_LONG_INT_64" = xyes ; then
1.112 tgl 1097: AC_TRY_COMPILE([
1098: #define INT64CONST(x) x##LL
1099: long long int foo = INT64CONST(0x1234567890123456);
1100: ],
1101: [],
1.242 petere 1102: [AC_DEFINE(HAVE_LL_CONSTANTS, 1, [Define to 1 if constants of type 'long long int' should have the suffix LL.])],
1.112 tgl 1103: [])
1104: fi
1105:
1106:
1.234 petere 1107: # If we found "long int" is 64 bits, assume snprintf handles it. If
1108: # we found we need to use "long long int", better check. We cope with
1.314 tgl 1109: # snprintfs that use %lld, %qd, or %I64d as the format. If none of these
1110: # work, fall back to our own snprintf emulation (which we know uses %lld).
1.1 petere 1111:
1.234 petere 1112: if test "$HAVE_LONG_LONG_INT_64" = yes ; then
1.194 petere 1113: if test $pgac_need_repl_snprintf = no; then
1.234 petere 1114: PGAC_FUNC_SNPRINTF_LONG_LONG_INT_FORMAT
1115: if test "$LONG_LONG_INT_FORMAT" = ""; then
1116: # Force usage of our own snprintf, since system snprintf is broken
1117: pgac_need_repl_snprintf=yes
1118: LONG_LONG_INT_FORMAT='%lld'
1119: fi
1.1 petere 1120: else
1.234 petere 1121: # Here if we previously decided we needed to use our own snprintf
1122: LONG_LONG_INT_FORMAT='%lld'
1.1 petere 1123: fi
1.314 tgl 1124: LONG_LONG_UINT_FORMAT=`echo "$LONG_LONG_INT_FORMAT" | sed 's/d$/u/'`
1.234 petere 1125: INT64_FORMAT="\"$LONG_LONG_INT_FORMAT\""
1.314 tgl 1126: UINT64_FORMAT="\"$LONG_LONG_UINT_FORMAT\""
1.1 petere 1127: else
1128: # Here if we are not using 'long long int' at all
1129: INT64_FORMAT='"%ld"'
1.314 tgl 1130: UINT64_FORMAT='"%lu"'
1.1 petere 1131: fi
1132:
1.171 petere 1133: AC_DEFINE_UNQUOTED(INT64_FORMAT, $INT64_FORMAT,
1.242 petere 1134: [Define to the appropriate snprintf format for 64-bit ints, if any.])
1.314 tgl 1135:
1136: AC_DEFINE_UNQUOTED(UINT64_FORMAT, $UINT64_FORMAT,
1137: [Define to the appropriate snprintf format for unsigned 64-bit ints, if any.])
1.1 petere 1138:
1.403 tgl 1139: # Now we have checked all the reasons to replace snprintf
1140: if test $pgac_need_repl_snprintf = yes; then
1.406 momjian 1141: AC_DEFINE(USE_SNPRINTF, 1, [Use replacement snprintf() functions.])
1.403 tgl 1142: AC_LIBOBJ(snprintf)
1143: fi
1144:
1.242 petere 1145: # Need a #define for the size of Datum (unsigned long)
1.171 petere 1146: AC_CHECK_SIZEOF([unsigned long])
1.84 tgl 1147:
1.171 petere 1148: # Determine memory alignment requirements for the basic C data types.
1.1 petere 1149:
1.6 petere 1150: PGAC_CHECK_ALIGNOF(short)
1151: PGAC_CHECK_ALIGNOF(int)
1152: PGAC_CHECK_ALIGNOF(long)
1.171 petere 1153: if test x"$HAVE_LONG_LONG_INT_64" = x"yes" ; then
1.6 petere 1154: PGAC_CHECK_ALIGNOF(long long int)
1.1 petere 1155: fi
1.6 petere 1156: PGAC_CHECK_ALIGNOF(double)
1.1 petere 1157:
1.171 petere 1158: # Compute maximum alignment of any basic type.
1159: # We assume long's alignment is at least as strong as char, short, or int;
1160: # but we must check long long (if it exists) and double.
1161:
1162: MAX_ALIGNOF=$pgac_cv_alignof_long
1163: if test $MAX_ALIGNOF -lt $pgac_cv_alignof_double ; then
1164: MAX_ALIGNOF=$pgac_cv_alignof_double
1165: fi
1166: if test x"$HAVE_LONG_LONG_INT_64" = xyes && test $MAX_ALIGNOF -lt $pgac_cv_alignof_long_long_int ; then
1167: MAX_ALIGNOF="$pgac_cv_alignof_long_long_int"
1.1 petere 1168: fi
1.242 petere 1169: AC_DEFINE_UNQUOTED(MAXIMUM_ALIGNOF, $MAX_ALIGNOF, [Define as the maximum alignment requirement of any C data type.])
1.1 petere 1170:
1.155 petere 1171:
1.152 momjian 1172: # Some platforms predefine the types int8, int16, etc. Only check
1.171 petere 1173: # a (hopefully) representative subset.
1174: AC_CHECK_TYPES([int8, uint8, int64, uint64], [], [],
1175: [#include <stdio.h>
1.155 petere 1176: #ifdef HAVE_SUPPORTDEFS_H
1177: #include <SupportDefs.h>
1.171 petere 1178: #endif])
1.155 petere 1179:
1.171 petere 1180: # We also check for sig_atomic_t, which *should* be defined per ANSI
1181: # C, but is missing on some old platforms.
1.223 momjian 1182: AC_CHECK_TYPES(sig_atomic_t, [], [], [#include <signal.h>])
1.155 petere 1183:
1.152 momjian 1184:
1.6 petere 1185: PGAC_FUNC_POSIX_SIGNALS
1.388 momjian 1186: if test "$pgac_cv_func_posix_signals" != yes -a "$enable_thread_safety" = yes; then
1187: AC_MSG_ERROR([
1188: *** Thread-safety requires POSIX signals, which are not supported by your
1189: *** operating system.
1190: ])
1191: fi
1192:
1.195 petere 1193: if test $ac_cv_func_fseeko = yes; then
1194: AC_SYS_LARGEFILE
1195: fi
1.172 petere 1196:
1.401 tgl 1197: # SunOS doesn't handle negative byte comparisons properly with +/- return
1198: AC_FUNC_MEMCMP
1199:
1.172 petere 1200:
1.184 tgl 1201: # Select semaphore implementation type.
1202: if test x"$USE_NAMED_POSIX_SEMAPHORES" = x"1" ; then
1.242 petere 1203: AC_DEFINE(USE_NAMED_POSIX_SEMAPHORES, 1, [Define to select named POSIX semaphores.])
1.184 tgl 1204: SEMA_IMPLEMENTATION="src/backend/port/posix_sema.c"
1205: else
1206: if test x"$USE_UNNAMED_POSIX_SEMAPHORES" = x"1" ; then
1.242 petere 1207: AC_DEFINE(USE_UNNAMED_POSIX_SEMAPHORES, 1, [Define to select unnamed POSIX semaphores.])
1.184 tgl 1208: SEMA_IMPLEMENTATION="src/backend/port/posix_sema.c"
1209: else
1.242 petere 1210: AC_DEFINE(USE_SYSV_SEMAPHORES, 1, [Define to select SysV-style semaphores.])
1.184 tgl 1211: SEMA_IMPLEMENTATION="src/backend/port/sysv_sema.c"
1212: fi
1213: fi
1214:
1215:
1216: # Select shared-memory implementation type.
1.242 petere 1217: AC_DEFINE(USE_SYSV_SHARED_MEMORY, 1, [Define to select SysV-style shared memory.])
1.184 tgl 1218: SHMEM_IMPLEMENTATION="src/backend/port/sysv_shmem.c"
1219:
1220:
1.172 petere 1221: if test "$enable_nls" = yes ; then
1222: PGAC_CHECK_GETTEXT
1223: fi
1.1 petere 1224:
1.43 petere 1225: # Check for Tcl configuration script tclConfig.sh
1226: if test "$with_tcl" = yes; then
1227: PGAC_PATH_TCLCONFIGSH([$with_tclconfig])
1.185 petere 1228: PGAC_EVAL_TCLCONFIGSH([$TCL_CONFIG_SH],
1.235 petere 1229: [TCL_INCLUDE_SPEC,TCL_LIB_FILE,TCL_LIBS,TCL_LIB_SPEC,TCL_SHARED_BUILD])
1.185 petere 1230: AC_SUBST(TCL_SHLIB_LD_LIBS)dnl don't want to double-evaluate that one
1.391 tgl 1231: # now that we have TCL_INCLUDE_SPEC, we can check for <tcl.h>
1232: ac_save_CPPFLAGS=$CPPFLAGS
1233: CPPFLAGS="$TCL_INCLUDE_SPEC $CPPFLAGS"
1234: AC_CHECK_HEADER(tcl.h, [], [AC_MSG_ERROR([header file <tcl.h> is required for Tcl])])
1235: CPPFLAGS=$ac_save_CPPFLAGS
1.43 petere 1236: fi
1.1 petere 1237:
1.75 petere 1238: #
1239: # Check for DocBook and tools
1240: #
1241: PGAC_PROG_NSGMLS
1.178 petere 1242: PGAC_PROG_JADE
1.305 petere 1243: PGAC_CHECK_DOCBOOK(4.2)
1.178 petere 1244: PGAC_PATH_DOCBOOK_STYLESHEETS
1245: PGAC_PATH_COLLATEINDEX
1246: AC_CHECK_PROGS(SGMLSPL, sgmlspl)
1.75 petere 1247:
1.337 momjian 1248: # Thread testing
1249:
1250: # We have to run the thread test near the end so we have all our symbols
1251: # defined. Cross compiling throws a warning.
1252: #
1.366 momjian 1253: if test "$enable_thread_safety_force" = yes; then
1254: AC_MSG_WARN([
1255: *** Skipping thread test program. --enable-thread-safety-force was used.
1256: *** Run the program in src/tools/thread on the your machine and add
1257: proper locking function calls to your applications to guarantee thread
1258: safety.
1259: ])
1260: elif test "$enable_thread_safety" = yes; then
1.337 momjian 1261: AC_MSG_CHECKING([thread safety of required library functions])
1262:
1263: _CFLAGS="$CFLAGS"
1264: _LIBS="$LIBS"
1265: CFLAGS="$CFLAGS $PTHREAD_CFLAGS -DIN_CONFIGURE"
1266: LIBS="$LIBS $PTHREAD_LIBS"
1.338 momjian 1267: AC_TRY_RUN([#include "$srcdir/src/tools/thread/thread_test.c"],
1.337 momjian 1268: [AC_MSG_RESULT(yes)],
1269: [AC_MSG_RESULT(no)
1.339 momjian 1270: AC_MSG_ERROR([
1271: *** Thread test program failed. Your platform is not thread-safe.
1.366 momjian 1272: *** Check the file 'config.log'for the exact reason.
1273: ***
1274: *** You can use the configure option --enable-thread-safety-force
1275: *** to force threads to be enabled. However, you must then run
1276: *** the program in src/tools/thread and add locking function calls
1277: *** to your applications to guarantee thread safety.
1278: ])],
1.337 momjian 1279: [AC_MSG_RESULT(maybe)
1280: AC_MSG_WARN([
1281: *** Skipping thread test program because of cross-compile build.
1.366 momjian 1282: *** Run the program in src/tools/thread on the target machine.
1.337 momjian 1283: ])])
1284: CFLAGS="$_CFLAGS"
1285: LIBS="$_LIBS"
1286: fi
1.61 petere 1287:
1.104 petere 1288: # prepare build tree if outside source tree
1.138 petere 1289: # Note 1: test -ef might not exist, but it's more reliable than `pwd`.
1290: # Note 2: /bin/pwd might be better than shell's built-in at getting
1291: # a symlink-free name.
1.306 petere 1292: if ( test "$srcdir" -ef . ) >/dev/null 2>&1 || test "`cd $srcdir && /bin/pwd`" = "`/bin/pwd`"; then
1293: vpath_build=no
1294: else
1295: vpath_build=yes
1296: if test "$no_create" != yes; then
1.171 petere 1297: _AS_ECHO_N([preparing build tree... ])
1298: pgac_abs_top_srcdir=`cd "$srcdir" && pwd`
1299: $SHELL "$ac_aux_dir/prep_buildtree" "$pgac_abs_top_srcdir" "." \
1.104 petere 1300: || AC_MSG_ERROR(failed)
1301: AC_MSG_RESULT(done)
1.171 petere 1302: fi
1.61 petere 1303: fi
1.306 petere 1304: AC_SUBST(vpath_build)
1.1 petere 1305:
1.171 petere 1306:
1307: AC_CONFIG_FILES([GNUmakefile src/Makefile.global])
1308:
1309: AC_CONFIG_LINKS([
1310: src/backend/port/dynloader.c:src/backend/port/dynloader/${template}.c
1.184 tgl 1311: src/backend/port/pg_sema.c:${SEMA_IMPLEMENTATION}
1312: src/backend/port/pg_shmem.c:${SHMEM_IMPLEMENTATION}
1.171 petere 1313: src/include/dynloader.h:src/backend/port/dynloader/${template}.h
1314: src/include/pg_config_os.h:src/include/port/${template}.h
1315: src/Makefile.port:src/makefiles/Makefile.${template}
1316: ])
1.347 momjian 1317:
1.376 momjian 1318: if test "$PORTNAME" = "win32"; then
1.350 momjian 1319: AC_CONFIG_COMMANDS([check_win32_symlinks],[
1.347 momjian 1320: # Links sometimes fail undetected on Mingw -
1321: # so here we detect it and warn the user
1.360 momjian 1322: for FILE in $CONFIG_LINKS
1.347 momjian 1323: do
1324: # test -e works for symlinks in the MinGW console
1.362 momjian 1325: test -e `expr "$FILE" : '\([[^:]]*\)'` || AC_MSG_WARN([*** link for $FILE - please fix by hand])
1.347 momjian 1326: done
1.349 momjian 1327: ])
1.376 momjian 1328: fi
1.349 momjian 1329:
1330: AC_CONFIG_HEADERS([src/include/pg_config.h],
1331: [
1332: # Update timestamp for pg_config.h (see Makefile.global)
1333: echo >src/include/stamp-h
1334: ])
1335:
1336: AC_OUTPUT
1.171 petere 1337:
PostgreSQL CVSweb <[email protected]>