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