Annotation of pgsql/configure.in, revision 1.52
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.24 petere 31: VERSION='7.1devel'
32: AC_SUBST(VERSION)
33: AC_DEFINE_UNQUOTED(PG_VERSION, "$VERSION")
34:
1.1 petere 35: AC_CANONICAL_HOST
1.45 petere 36: AC_SUBST(host)
37: AC_SUBST(host_cpu)
38: AC_SUBST(host_os)
1.1 petere 39:
1.30 petere 40: template=
41: AC_MSG_CHECKING([which template to use])
42:
1.42 petere 43: PGAC_ARG_REQ(with, template, [],
44: [
45: case $withval in
1.30 petere 46: list) echo; ls "$srcdir/src/template"; exit;;
47: *) if test -f "$srcdir/src/template/$with_template" ; then
1.42 petere 48: template=$withval
1.30 petere 49: else
1.42 petere 50: AC_MSG_ERROR([\`$withval' is not a valid template name. Use \`list' for a list.])
1.30 petere 51: fi;;
52: esac
1.42 petere 53: ],
54: [
55: # --with-template not given
1.30 petere 56:
57: case $host_os in
58: aix*) template=aix ;;
59: bsdi*) template=bsdi ;;
60: cygwin*) template=win ;;
61: dgux*) template=dgux ;;
62: freebsd*) template=freebsd ;;
63: hpux*) template=hpux ;;
64: irix*) template=irix5 ;;
65: linux*) template=linux ;;
66: netbsd*) template=netbsd ;;
67: nextstep*) template=nextstep ;;
68: openbsd*) template=openbsd ;;
69: osf*) template=osf ;;
70: qnx*) template=qnx4 ;;
71: sco*) template=sco ;;
1.1 petere 72: solaris*)
1.30 petere 73: case $host_cpu in
74: sparc) template=solaris_sparc ;;
75: i?86) template=solaris_i386 ;;
1.1 petere 76: esac ;;
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 ;;
84: ultrix*) template=ultrix4 ;;
1.1 petere 85: esac
86:
1.30 petere 87: if test x"$template" = x"" ; then
88: AC_MSG_ERROR([
89: *******************************************************************
90: PostgreSQL has apparently not been ported to your platform yet.
1.32 petere 91: To try a manual configuration, look into the src/template directory
1.30 petere 92: for a similar platform and use the \`--with-template=' option.
93:
94: Please also contact <[email protected]> to see about
95: rectifying this. Include the above \`checking host system type...'
96: line.
97: *******************************************************************
98: ])
99: fi
100:
1.42 petere 101: ])
1.1 petere 102:
1.30 petere 103: AC_MSG_RESULT([$template])
1.1 petere 104:
1.30 petere 105: PORTNAME=$template
106: AC_SUBST(PORTNAME)
1.1 petere 107:
1.30 petere 108: AC_LINK_FILES([src/backend/port/dynloader/${template}.c], [src/backend/port/dynloader.c])
109: AC_LINK_FILES([src/backend/port/dynloader/${template}.h], [src/include/dynloader.h])
110: AC_LINK_FILES([src/include/port/${template}.h], [src/include/os.h])
111: AC_LINK_FILES([src/makefiles/Makefile.${template}], [src/Makefile.port])
112:
113: # Pick right test-and-set (TAS) code. Most platforms have inline
114: # assembler code in their port include file, so we just use a dummy
115: # file here.
116: tas_file=dummy.s
117: need_tas=no
118: case $template in
119: hpux) need_tas=yes; tas_file=hpux.s ;;
120: solaris_sparc) need_tas=yes; tas_file=solaris_sparc.s ;;
121: solaris_i386) need_tas=yes; tas_file=solaris_i386.s ;;
122: esac
1.1 petere 123:
1.30 petere 124: if test "$need_tas" = yes ; then
125: AC_LINK_FILES([src/backend/port/tas/${tas_file}], [src/backend/port/tas.s])
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:
203:
1.29 petere 204: #
205: # Default port number (--with-pgport), default 5432
206: #
207: AC_MSG_CHECKING([for default port number])
1.42 petere 208: PGAC_ARG_REQ(with, pgport, [ --with-pgport=PORTNUM change default port number [5432]],
209: [default_port=$withval],
210: [default_port=5432])
1.29 petere 211: # Need both of these because backend wants an integer and frontend a string
1.1 petere 212: AC_DEFINE_UNQUOTED(DEF_PGPORT, ${default_port})
213: AC_DEFINE_UNQUOTED(DEF_PGPORT_STR, "${default_port}")
1.29 petere 214: AC_MSG_RESULT([$default_port])
1.1 petere 215:
216:
1.29 petere 217: #
218: # Maximum number of allowed connections (--with-maxbackends), default 32
219: #
220: AC_MSG_CHECKING([for default soft limit on number of connections])
1.42 petere 221: PGAC_ARG_REQ(with, maxbackends, [ --with-maxbackends=N set default maximum number of connections [32]],
222: [],
223: [with_maxbackends=32])
1.29 petere 224: AC_MSG_RESULT([$with_maxbackends])
1.42 petere 225: AC_DEFINE_UNQUOTED([DEF_MAXBACKENDS], [$with_maxbackends],
226: [The default soft limit on the number of concurrent connections, i.e., the default for the postmaster -N switch (--with-maxbackends)])
1.29 petere 227:
1.1 petere 228:
1.29 petere 229: #
1.30 petere 230: # C compiler
231: #
232:
1.29 petere 233: # For historical reasons you can also use --with-CC to specify the C compiler
234: # to use, although the standard way to do this is to set the CC environment
235: # variable.
1.42 petere 236: PGAC_ARG_REQ(with, CC, [], [CC=$with_CC])
1.4 tgl 237:
1.30 petere 238: # On AIX, default compiler to xlc.
239: if test "$template" = aix && test -z "$CC" ; then CC=xlc; fi
1.4 tgl 240:
241: AC_PROG_CC
1.30 petere 242: # Read the template
243: . "$srcdir/src/template/$template" || exit
244: echo "using CFLAGS=$CFLAGS"
245: # Check if the compiler still works with the template settings
246: AC_PROG_CC_WORKS
1.44 petere 247: AC_EXEEXT
1.4 tgl 248: AC_PROG_CPP
249: AC_PROG_GCC_TRADITIONAL
1.30 petere 250:
1.6 petere 251: AC_SUBST(GCC)
1.30 petere 252: AC_SUBST(AROPT)
253: AC_SUBST(SHARED_LIB)
254: AC_SUBST(DLSUFFIX)
255: AC_SUBST(DL_LIB)
1.4 tgl 256:
1.29 petere 257: # Create compiler version string
1.24 petere 258: if test x"$GCC" = x"yes" ; then
259: cc_string="GCC `${CC} --version`"
1.4 tgl 260: else
1.24 petere 261: cc_string=$CC
1.4 tgl 262: fi
1.24 petere 263: 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])
264:
1.4 tgl 265:
1.31 petere 266: #
267: # Automatic dependency tracking
268: #
1.42 petere 269: PGAC_ARG_BOOL(enable, depend, no, [ --enable-depend turn on automatic dependency tracking],
270: [autodepend=yes])
1.31 petere 271: AC_SUBST(autodepend)
272:
273:
1.42 petere 274: #
1.30 petere 275: # --enable-debug adds -g to compiler flags
1.42 petere 276: #
277: PGAC_ARG_BOOL(enable, debug, no, [ --enable-debug build with debugging symbols (-g)],
278: [CFLAGS="$CFLAGS -g"])
279:
280:
281: #
282: # Enable assert checks
283: #
284: PGAC_ARG_BOOL(enable, cassert, no, [ --enable-cassert enable assertion checks (for debugging)],
285: [AC_DEFINE([USE_ASSERT_CHECKING], 1,
286: [Define to 1 to build with assertion checks])])
1.30 petere 287:
288:
289: #
290: # Include directories
291: #
292: ac_save_IFS=$IFS
293: IFS=':'
294: # SRCH_INC comes from the template file
295: for dir in $with_includes $SRCH_INC; do
296: if test -d "$dir"; then
297: INCLUDES="$INCLUDES -I$dir"
298: else
299: AC_MSG_WARN([*** Include directory $dir does not exist.])
300: fi
301: done
302: IFS=$ac_save_IFS
303: AC_SUBST(INCLUDES)
304:
305:
306: #
307: # Library directories
308: #
309: ac_save_IFS=$IFS
310: IFS=':'
311: # LIBRARY_DIRS comes from command line, SRCH_LIB from template file.
312: for dir in $LIBRARY_DIRS $SRCH_LIB; do
313: if test -d "$dir"; then
314: PGSQL_LDFLAGS="$PGSQL_LDFLAGS -L$dir"
315: else
316: AC_MSG_WARN([*** Library directory $dir does not exist.])
317: fi
318: done
319: IFS=$ac_save_IFS
320:
321:
1.43 petere 322: #
323: # Tcl/Tk
324: #
325: AC_MSG_CHECKING([whether to build with Tcl])
326: PGAC_ARG_BOOL(with, tcl, no, [ --with-tcl build Tcl and Tk interfaces])
327: AC_MSG_RESULT([$with_tcl])
328: AC_SUBST([with_tcl])
329:
330: # If Tcl is enabled (above) then Tk is also, unless the user disables it using --without-tk
331: AC_MSG_CHECKING([whether to build with Tk])
332: if test "$with_tcl" = yes; then
333: PGAC_ARG_BOOL(with, tk, yes, [ --without-tk do not build Tk interfaces if Tcl is enabled])
334: else
335: with_tk=no
336: fi
337: AC_MSG_RESULT([$with_tk])
338: AC_SUBST([with_tk])
1.1 petere 339:
340:
1.42 petere 341: # We see if the path to the TCL/TK configuration scripts is specified.
342: # This will override the use of tclsh to find the paths to search.
343:
1.43 petere 344: PGAC_ARG_REQ(with, tclconfig, [ --with-tclconfig=DIR tclConfig.sh and tkConfig.sh are in DIR])
1.1 petere 345:
1.42 petere 346: # We see if the path to the TK configuration scripts is specified.
347: # This will override the use of tclsh to find the paths to search.
1.1 petere 348:
1.43 petere 349: PGAC_ARG_REQ(with, tkconfig, [ --with-tkconfig=DIR tkConfig.sh is in DIR])
1.1 petere 350:
1.5 petere 351:
1.42 petere 352: #
353: # Optionally build Perl modules (Pg.pm and PL/Perl)
354: #
355: AC_MSG_CHECKING([whether to build Perl modules])
356: PGAC_ARG_BOOL(with, perl, no, [ --with-perl build Perl interface and PL/Perl])
357: AC_MSG_RESULT([$with_perl])
1.5 petere 358: AC_SUBST(with_perl)
359:
360:
1.42 petere 361: #
362: # Optionally build Python interface module
363: #
364: AC_MSG_CHECKING([whether to build Python modules])
365: PGAC_ARG_BOOL(with, python, no, [ --with-python build Python interface module],
366: [AC_MSG_RESULT(yes)
367: PGAC_PROG_PYTHON
368: PGAC_PATH_PYTHONDIR],
1.5 petere 369: [AC_MSG_RESULT(no)])
370: AC_SUBST(with_python)
1.1 petere 371:
1.13 petere 372:
1.28 petere 373: dnl A note on the Kerberos and OpenSSL options:
1.13 petere 374: dnl
1.28 petere 375: dnl The user can give an argument to the option in order the specify
376: dnl the base path of the respective installation (what he specified
377: dnl perhaps as --prefix). If no argument is given ($withval is "yes")
378: dnl then we take the path where the package installs by default. This
379: dnl way the user doesn't have to use redundant --with-includes and
380: dnl --with-libraries options, but he can still use them if the layout
381: dnl is non-standard.
382:
383: #
384: # Kerberos 4
385: #
1.42 petere 386: PGAC_ARG_OPTARG(with, krb4, [ --with-krb4[=DIR] build with Kerberos 4 support [/usr/athena]],
387: [krb4_prefix=/usr/athena],
388: [krb4_prefix=$withval],
389: [
1.28 petere 390: AC_MSG_RESULT([building with Kerberos 4 support])
1.42 petere 391: AC_DEFINE(KRB4, 1, [Define if you are building with Kerberos 4 support.])
1.28 petere 392:
393: if test -d "$krb4_prefix"; then
394: if test -d "$krb4_prefix/include"; then
395: INCLUDES="$INCLUDES -I$krb4_prefix/include"
1.13 petere 396: fi
1.28 petere 397: if test -d "$krb4_prefix/lib"; then
398: krb_libdir="-L$krb4_prefix/lib"
1.13 petere 399: LIBS="$krb_libdir $LIBS"
400: fi
401: fi
1.42 petere 402: # Test for these libraries is below
1.13 petere 403: KRB_LIBS="$krb_libdir -lkrb -ldes"
1.37 petere 404:
1.42 petere 405: krb_srvtab="/etc/srvtab"
406: ])
407:
408: AC_SUBST(with_krb4)
1.13 petere 409:
410:
1.28 petere 411: #
412: # Kerberos 5
413: #
1.42 petere 414: PGAC_ARG_OPTARG(with, krb5, [ --with-krb5[=DIR] build with Kerberos 5 support [/usr/athena]],
415: [krb5_prefix=/usr/athena],
416: [krb5_prefix=$withval],
417: [
1.28 petere 418: AC_MSG_RESULT([building with Kerberos 5 support])
1.42 petere 419: AC_DEFINE(KRB5, 1, [Define if you are building with Kerberos 5 support.])
1.28 petere 420:
1.42 petere 421: if test -d "$krb5_prefix"; then
1.28 petere 422: if test -d "$krb5_prefix/include"; then
423: INCLUDES="$INCLUDES -I$krb5_prefix/include"
1.13 petere 424: fi
1.28 petere 425: if test -d "$krb5_prefix/lib"; then
426: krb_libdir="-L$krb5_prefix/lib"
1.13 petere 427: LIBS="$krb_libdir $LIBS"
428: fi
429: fi
1.28 petere 430:
1.42 petere 431: # Test for these libraries is below
1.13 petere 432: KRB_LIBS="$krb_libdir -lkrb5 -lcrypto -lcom_err"
1.37 petere 433:
1.42 petere 434: krb_srvtab="FILE:\$(sysconfdir)/krb5.keytab"
435: ])
436:
437: AC_SUBST(with_krb5)
1.28 petere 438:
439:
440: # Using both Kerberos 4 and Kerberos 5 at the same time isn't going to work.
441: if test "$with_krb4" = yes && test "$with_krb5" = yes ; then
442: AC_MSG_ERROR([Kerberos 4 and Kerberos 5 support cannot be combined])
443: fi
1.13 petere 444:
1.37 petere 445: AC_SUBST(krb_srvtab)
1.13 petere 446: dnl Necessary for special libpq link
447: AC_SUBST(KRB_LIBS)
448:
449:
1.28 petere 450: #
451: # Kerberos configuration parameters
452: #
1.42 petere 453: PGAC_ARG_REQ(with, krb-srvnam,
1.43 petere 454: [ --with-krb-srvnam=NAME name of the PostgreSQL service principal in Kerberos [postgres]],
1.42 petere 455: [],
456: [with_krb_srvnam="postgres"])
457: AC_DEFINE_UNQUOTED([PG_KRB_SRVNAM], ["$with_krb_srvnam"],
458: [The name of the PostgreSQL service principal in Kerberos])
1.13 petere 459:
1.28 petere 460:
461:
462: #
463: # OpenSSL
464: #
1.42 petere 465: PGAC_ARG_OPTARG(with, openssl,
466: [ --with-openssl[=DIR] build with OpenSSL support [/usr/local/ssl]],
467: [openssl_prefix=/usr/local/ssl],
468: [openssl_prefix=$withval],
469: [
1.28 petere 470: AC_MSG_RESULT([building with OpenSSL support])
1.42 petere 471: AC_DEFINE([USE_SSL], 1, [Define to build with (Open)SSL support])
1.28 petere 472:
473: if test -d "${openssl_prefix}/include" ; then
474: INCLUDES="$INCLUDES -I${openssl_prefix}/include"
475: fi
476: if test -d "${openssl_prefix}/lib" ; then
477: openssl_libdir="${openssl_prefix}/lib"
478: LIBS="$LIBS -L${openssl_prefix}/lib"
1.41 momjian 479: else
480: openssl_libdir="${openssl_prefix}"
481: LIBS="$LIBS -L${openssl_prefix}"
1.28 petere 482: fi
1.42 petere 483: ])
484:
485: AC_SUBST(with_openssl)
1.28 petere 486:
1.13 petere 487:
1.28 petere 488: # OpenSSL and Kerberos 5 both have a `crypto' library, so if you want to
489: # use both of them you'll have to figure it out yourself.
490: if test "$with_openssl" = yes && test "$with_krb5" = yes ; then
491: AC_MSG_ERROR([OpenSSL and Kerberos 5 support cannot be combined])
492: fi
1.13 petere 493:
494:
1.42 petere 495: #
496: # Optionally enable the building of the ODBC driver
497: #
1.15 petere 498:
1.42 petere 499: # Old option name
500: if test "${with_odbc+set}" = set && test "${enable_odbc+set}" != set; then
1.15 petere 501: enable_odbc=$with_odbc
502: fi
503:
1.42 petere 504: AC_MSG_CHECKING([whether to build the ODBC driver])
505: PGAC_ARG_BOOL(enable, odbc, no, [ --enable-odbc build the ODBC driver package])
506: AC_MSG_RESULT([$enable_odbc])
507: AC_SUBST([enable_odbc])
1.8 momjian 508:
1.1 petere 509:
1.42 petere 510: # Allow for overriding the default location of the odbcinst.ini
511: # file which is normally ${sysconfdir} (i.e., ${prefix}/etc).
512: PGAC_ARG_REQ(with, odbcinst,
513: [ --with-odbcinst=DIR default directory for odbcinst.ini [sysconfdir]],
514: [odbcinst_ini_dir=$withval],
515: [odbcinst_ini_dir="\${sysconfdir}"])
516: AC_SUBST([odbcinst_ini_dir])
1.3 momjian 517:
518:
519:
1.30 petere 520: # Assume system is ELF if it predefines __ELF__ as 1,
521: # otherwise believe host_os based default.
522: case $host_os in
523: freebsd1*|freebsd2*) elf=yes;;
524: esac
1.1 petere 525:
526: AC_EGREP_CPP(yes,
527: [#if __ELF__
528: yes
529: #endif
530: ],
1.30 petere 531: [ELF_SYS=true],
532: [if test "X$elf" = "Xyes" ; then
533: ELF_SYS=true
1.1 petere 534: else
1.30 petere 535: ELF_SYS=
536: fi])
537: AC_SUBST(ELF_SYS)
1.1 petere 538:
539:
540:
1.42 petere 541: #
542: # Optionally build C++ code (i.e., libpq++)
543: #
1.36 petere 544: AC_MSG_CHECKING([whether to build C++ modules])
1.42 petere 545: PGAC_ARG_OPTARG(with, CXX, [ --with-CXX build C++ modules (libpq++)],
546: [],
547: [CXX=$withval],
548: [
549: AC_MSG_RESULT(yes)
1.6 petere 550: AC_PROG_CXX
551: AC_PROG_CXXCPP
552: PGAC_CLASS_STRING
553: PGAC_CXX_NAMESPACE_STD
1.42 petere 554: ],
555: [AC_MSG_RESULT(no)])
556: AC_SUBST(with_CXX)
1.1 petere 557:
558:
1.30 petere 559: CPPFLAGS="$CPPFLAGS $INCLUDES"
560: LDFLAGS="$LDFLAGS $PGSQL_LDFLAGS"
561:
562: echo "using CPPFLAGS=$CPPFLAGS"
563: echo "using LDFLAGS=$LDFLAGS"
564:
565:
1.28 petere 566: # Figure out how to invoke "install" and what install options to use.
1.1 petere 567:
568: AC_PROG_INSTALL
1.28 petere 569: # When Autoconf chooses install-sh as install program it tries to generate
570: # a relative path to it in each makefile where it subsitutes it. This clashes
571: # with our Makefile.global concept. This workaround helps.
572: case $INSTALL in
573: *install-sh*) INSTALL='\${SHELL} \${top_srcdir}/config/install-sh -c';;
574: esac
1.1 petere 575:
1.28 petere 576: # Fix Autoconf's brain-dead defaults for script installs.
577: INSTALL_SCRIPT="\${INSTALL} -m 755"
1.1 petere 578:
1.28 petere 579: # HPUX wants shared libs to be mode 555. Add your platform's special
580: # needs here if necessary.
581: case $host_os in
582: hpux*) INSTL_SHLIB_OPTS="-m 555" ;;
583: *) INSTL_SHLIB_OPTS="-m 644" ;;
1.1 petere 584: esac
1.19 tgl 585:
1.28 petere 586: INSTALL_SHLIB="\${INSTALL} $INSTL_SHLIB_OPTS"
587: AC_SUBST(INSTALL_SHLIB)
1.1 petere 588:
1.19 tgl 589:
1.28 petere 590: mkinstalldirs="\$(SHELL) \$(top_srcdir)/config/mkinstalldirs"
591: AC_SUBST(mkinstalldirs)
1.15 petere 592:
593:
1.2 petere 594: AC_PROG_AWK
1.39 petere 595: PGAC_PATH_FLEX
1.1 petere 596: AC_PROG_LN_S
597: AC_PROG_RANLIB
598: AC_PATH_PROG(tar, tar)
599: AC_CHECK_PROGS(PERL, perl,)
1.2 petere 600: AC_PROG_YACC
1.6 petere 601: AC_SUBST(YFLAGS)
1.43 petere 602: if test "$with_tk" = yes; then
603: AC_PATH_PROG(WISH, wish)
604: test -z "$WISH" && AC_MSG_ERROR([\`wish' is required for Tk support])
605: fi
1.1 petere 606:
607:
1.29 petere 608: ##
609: ## Libraries
610: ##
611:
1.1 petere 612: AC_CHECK_LIB(sfio, main)
1.13 petere 613: AC_CHECK_LIB(ncurses, main, [], [AC_CHECK_LIB(curses, main)])
1.1 petere 614: AC_CHECK_LIB(termcap, main)
1.52 ! petere 615: AC_CHECK_LIB(readline, readline)
! 616: AC_SEARCH_LIBS(using_history, history, [AC_DEFINE(HAVE_HISTORY_FUNCTIONS)])
1.1 petere 617:
618: if test "$PORTNAME" != "aix" -a "$PORTNAME" != "alpha"
619: then
620: AC_CHECK_LIB(bsd, main)
621: fi
1.21 petere 622: AC_CHECK_LIB(util, setproctitle)
1.1 petere 623: AC_CHECK_LIB(m, main)
624: AC_CHECK_LIB(dl, main)
625: AC_CHECK_LIB(socket, main)
626: AC_CHECK_LIB(nsl, main)
627: AC_CHECK_LIB(ipc, main)
628: AC_CHECK_LIB(IPC, main)
629: AC_CHECK_LIB(lc, main)
630: AC_CHECK_LIB(dld, main)
631: AC_CHECK_LIB(ln, main)
632: AC_CHECK_LIB(ld, main)
633: AC_CHECK_LIB(compat, main)
634: AC_CHECK_LIB(BSD, main)
635: AC_CHECK_LIB(gen, main)
636: AC_CHECK_LIB(PW, main)
1.21 petere 637: AC_SEARCH_LIBS(crypt, crypt)
1.28 petere 638: AC_CHECK_LIB(z, inflate)
639:
640: if test "$with_krb4" = yes ; then
641: AC_CHECK_LIB(des, [des_encrypt], [], [AC_MSG_ERROR([library \`des' is required for Kerberos 4])])
642: AC_CHECK_LIB(krb, [krb_sendauth], [], [AC_MSG_ERROR([library \`krb' is required for Kerberos 4])])
643: fi
644:
645: if test "$with_krb5" = yes ; then
646: AC_CHECK_LIB(com_err, main, [], [AC_MSG_ERROR([library \`com_err' is required for Kerberos 5])])
647: AC_CHECK_LIB(crypto, main, [], [AC_MSG_ERROR([library \`crypto' is required for Kerberos 5])])
648: AC_CHECK_LIB(krb5, main, [], [AC_MSG_ERROR([library \`krb5' is required for Kerberos 5])])
649: fi
650:
651: if test "$with_openssl" = yes ; then
652: dnl Order matters!
653: AC_CHECK_LIB(crypto, [CRYPTO_new_ex_data], [], [AC_MSG_ERROR([library \`ssl' is required for OpenSSL])])
654: AC_CHECK_LIB(ssl, [SSL_library_init], [], [AC_MSG_ERROR([library \`ssl' is required for OpenSSL])])
655: fi
1.1 petere 656:
1.28 petere 657:
1.29 petere 658: ##
659: ## Header files
660: ##
661: dnl sys/socket.h and sys/types.h are required by AC_FUNC_ACCEPT_ARGTYPES
1.51 petere 662: AC_CHECK_HEADERS([crypt.h dld.h endian.h fp_class.h getopt.h ieeefp.h netinet/tcp.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])
1.29 petere 663:
1.28 petere 664: AC_CHECK_HEADERS([readline/readline.h readline.h], [break])
665: AC_CHECK_HEADERS([readline/history.h history.h], [break])
1.15 petere 666:
1.28 petere 667: if test "$with_krb4" = yes ; then
668: AC_CHECK_HEADER(krb.h, [], [AC_MSG_ERROR([header file <krb.h> is required for Kerberos 4])])
669: fi
670:
671: if test "$with_krb5" = yes ; then
672: AC_CHECK_HEADER(krb5.h, [], [AC_MSG_ERROR([header file <krb5.h> is required for Kerberos 5])])
673: AC_CHECK_HEADER(com_err.h, [], [AC_MSG_ERROR([header file <com_err.h> is required for Kerberos 5])])
674: fi
675:
676: if test "$with_openssl" = yes ; then
677: AC_CHECK_HEADER([openssl/ssl.h], [], [AC_MSG_ERROR([header file <openssl/ssl.h> is required for OpenSSL])])
678: AC_CHECK_HEADER([openssl/err.h], [], [AC_MSG_ERROR([header file <openssl/err.h> is required for OpenSSL])])
679: fi
680:
1.1 petere 681:
1.29 petere 682: ##
683: ## Types, structures, compiler characteristics
684: ##
1.1 petere 685: AC_C_CONST
686: AC_C_INLINE
687: AC_C_STRINGIZE
1.40 petere 688: PGAC_C_SIGNED
689: PGAC_C_VOLATILE
1.29 petere 690: AC_STRUCT_TIMEZONE
691: PGAC_UNION_SEMUN
1.44 petere 692: PGAC_STRUCT_SOCKADDR_UN
1.1 petere 693:
1.29 petere 694: ##
695: ## Functions, global variables
696: ##
1.6 petere 697: PGAC_VAR_INT_TIMEZONE
1.29 petere 698: AC_FUNC_ACCEPT_ARGTYPES
1.6 petere 699: PGAC_FUNC_GETTIMEOFDAY_1ARG
1.1 petere 700:
1.30 petere 701: AC_MSG_CHECKING([for fcntl(F_SETLK)])
702: case $host_os in
703: linux*) AC_MSG_RESULT([broken on Linux]) ;;
704: *)
705: AC_TRY_LINK(
706: [#include <stdio.h>
707: #include <fcntl.h>
708: ],
709: [struct flock lck;
710: lck.l_whence = SEEK_SET; lck.l_start = lck.l_len = 0;
711: lck.l_type = F_WRLCK;
712: fcntl(0, F_SETLK, &lck);],
713: [AC_DEFINE(HAVE_FCNTL_SETLK) AC_MSG_RESULT(yes)],
714: [AC_MSG_RESULT(no)])
715: ;;
716: esac
1.1 petere 717:
1.46 momjian 718: AC_CHECK_FUNCS([fcvt getopt_long memmove pstat setproctitle setsid sigprocmask sysconf waitpid dlopen])
1.1 petere 719:
1.28 petere 720: AC_CACHE_CHECK([for PS_STRINGS], [pgac_cv_var_PS_STRINGS],
721: [AC_TRY_LINK(
722: [#include <machine/vmparam.h>
723: #include <sys/exec.h>
724: ],
1.1 petere 725: [PS_STRINGS->ps_nargvstr = 1;
726: PS_STRINGS->ps_argvstr = "foo";],
1.28 petere 727: [pgac_cv_var_PS_STRINGS=yes],
728: [pgac_cv_var_PS_STRINGS=no])])
729: if test "$pgac_cv_var_PS_STRINGS" = yes ; then
730: AC_DEFINE([HAVE_PS_STRINGS], [], [Define if the PS_STRINGS thing exists.])
731: fi
1.1 petere 732:
733: dnl We use our snprintf.c emulation if either snprintf() or vsnprintf()
734: dnl is missing. Yes, there are machines that have only one.
735: dnl We may also decide to use snprintf.c if snprintf() is present but does
736: dnl not have working "long long int" support -- see below.
737: SNPRINTF=''
738: AC_CHECK_FUNC(snprintf,
739: AC_DEFINE(HAVE_SNPRINTF),
740: SNPRINTF='snprintf.o')
741: AC_CHECK_FUNC(vsnprintf,
742: AC_DEFINE(HAVE_VSNPRINTF),
743: SNPRINTF='snprintf.o')
744: AC_SUBST(SNPRINTF)
745: dnl Check whether <stdio.h> declares snprintf() and vsnprintf(); if not,
746: dnl include/c.h will provide declarations. Note this is a separate test
747: dnl from whether the functions exist in the C library --- there are systems
748: dnl that have the functions but don't bother to declare them :-(
749: dnl Note: simple-minded pattern here will do wrong thing if stdio.h
750: dnl declares vsnprintf() but not snprintf(). Hopefully there are no
751: dnl systems that are *that* brain-damaged...
752: AC_EGREP_HEADER(snprintf, stdio.h, AC_DEFINE(HAVE_SNPRINTF_DECL))
753: AC_EGREP_HEADER(vsnprintf, stdio.h, AC_DEFINE(HAVE_VSNPRINTF_DECL))
1.29 petere 754:
755: # do this one the hard way in case isinf() is a macro
756: AC_CACHE_CHECK([for isinf], ac_cv_func_isinf,
1.1 petere 757: [AC_TRY_LINK(
1.29 petere 758: [#include <math.h>
759: ],
1.1 petere 760: [double x = 0.0; int res = isinf(x);],
1.29 petere 761: [ac_cv_func_isinf=yes],
762: [ac_cv_func_isinf=no])])
763:
764: if test $ac_cv_func_isinf = yes ; then
1.1 petere 765: AC_DEFINE(HAVE_ISINF)
1.29 petere 766: ISINF=
1.1 petere 767: else
768: ISINF='isinf.o'
1.29 petere 769: # Look for a way to implement a substitute for isinf()
770: AC_CHECK_FUNCS([fpclass fp_class fp_class_d class], [break])
1.1 petere 771: fi
772: AC_SUBST(ISINF)
1.29 petere 773:
1.1 petere 774: AC_CHECK_FUNC(getrusage,
775: AC_DEFINE(HAVE_GETRUSAGE),
776: GETRUSAGE='getrusage.o')
777: AC_SUBST(GETRUSAGE)
778: AC_CHECK_FUNC(srandom,
779: AC_DEFINE(HAVE_SRANDOM),
780: SRANDOM='srandom.o')
781: AC_SUBST(SRANDOM)
782: AC_CHECK_FUNC(gethostname,
783: AC_DEFINE(HAVE_GETHOSTNAME),
784: GETHOSTNAME='gethostname.o')
785: AC_SUBST(GETHOSTNAME)
786: AC_CHECK_FUNC(random,
787: AC_DEFINE(HAVE_RANDOM),
788: MISSING_RANDOM='random.o')
789: AC_SUBST(MISSING_RANDOM)
790: AC_CHECK_FUNC(inet_aton,
791: AC_DEFINE(HAVE_INET_ATON),
792: INET_ATON='inet_aton.o')
793: AC_SUBST(INET_ATON)
794: AC_CHECK_FUNC(strerror,
795: AC_DEFINE(HAVE_STRERROR),
796: [STRERROR='strerror.o' STRERROR2='../../backend/port/strerror.o'])
797: AC_SUBST(STRERROR)
798: AC_SUBST(STRERROR2)
799: AC_CHECK_FUNC(strdup,
800: AC_DEFINE(HAVE_STRDUP),
801: STRDUP='../../utils/strdup.o')
802: AC_SUBST(STRDUP)
803: AC_CHECK_FUNC(strtol,
804: AC_DEFINE(HAVE_STRTOL),
805: STRTOL='strtol.o')
806: AC_SUBST(STRTOL)
807: AC_CHECK_FUNC(strtoul,
808: AC_DEFINE(HAVE_STRTOUL),
809: STRTOL='strtoul.o')
810: AC_SUBST(STRTOUL)
811: AC_CHECK_FUNC(strcasecmp,
812: AC_DEFINE(HAVE_STRCASECMP),
813: STRCASECMP='strcasecmp.o')
814: AC_SUBST(STRCASECMP)
815: AC_CHECK_FUNC(cbrt,
816: AC_DEFINE(HAVE_CBRT),
817: AC_CHECK_LIB(m, cbrt, AC_DEFINE(HAVE_CBRT)))
818:
819: # On HPUX 9, rint() is not in regular libm.a but in /lib/pa1.1/libm.a;
820: # this hackery with HPUXMATHLIB allows us to cope.
821: HPUXMATHLIB=""
1.30 petere 822: case $host_cpu in
1.1 petere 823: hppa1.1)
824: if [[ -r /lib/pa1.1/libm.a ]] ; then
825: HPUXMATHLIB="-L /lib/pa1.1 -lm"
826: fi ;;
827: esac
828: AC_SUBST(HPUXMATHLIB)
829:
830: AC_CHECK_FUNC(rint,
831: AC_DEFINE(HAVE_RINT),
832: AC_CHECK_LIB(m, rint, AC_DEFINE(HAVE_RINT), , $HPUXMATHLIB))
833:
1.52 ! petere 834:
! 835: # Readline versions < 2.1 don't have rl_completion_append_character
! 836: AC_MSG_CHECKING([for rl_completion_append_character])
! 837: AC_TRY_LINK([#include <stdio.h>
! 838: #ifdef HAVE_READLINE_H
! 839: # include <readline.h>
! 840: #endif
! 841: #ifdef HAVE_READLINE_READLINE_H
! 842: # include <readline/readline.h>
! 843: #endif],
! 844: [rl_completion_append_character = 'x';],
! 845: [AC_MSG_RESULT(yes)
! 846: AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER)],
! 847: [AC_MSG_RESULT(no)])
! 848:
! 849:
! 850: # Check whether readline's filename_completion_function is declared.
! 851: # Some prehistoric versions of readline, in particular those shipped
! 852: # with earlier Cygwins don't have this declared, although it's in the
! 853: # library.
! 854: AC_MSG_CHECKING([whether filename_completion_function is declared])
! 855: if test "$ac_cv_header_readline_h" = yes; then
! 856: _readline_header='readline.h'
! 857: elif test "$ac_cv_header_readline_readline_h" = yes; then
! 858: _readline_header='readline/readline.h'
! 859: else
! 860: _readline_header='xxx'
! 861: fi
! 862: AC_EGREP_HEADER([filename_completion_function], [$_readline_header],
! 863: [AC_DEFINE(HAVE_FILENAME_COMPLETION_FUNCTION_DECL)
! 864: AC_MSG_RESULT(yes)],
! 865: [AC_MSG_RESULT(no)])
! 866:
1.1 petere 867:
868:
869: dnl Cannot use AC_CHECK_FUNC because finite may be a macro
870: AC_MSG_CHECKING(for finite)
871: AC_TRY_LINK([#include <math.h>],
872: [int dummy=finite(1.0);],
873: [AC_DEFINE(HAVE_FINITE) AC_MSG_RESULT(yes)],
874: AC_MSG_RESULT(no))
875:
876: dnl Cannot use AC_CHECK_FUNC because sigsetjmp may be a macro
877: dnl (especially on GNU libc)
878: dnl See also comments in config.h.
879: AC_MSG_CHECKING(for sigsetjmp)
880: AC_TRY_LINK([#include <setjmp.h>],
881: [sigjmp_buf x; sigsetjmp(x, 1);],
882: [AC_DEFINE(HAVE_SIGSETJMP) AC_MSG_RESULT(yes)],
883: AC_MSG_RESULT(no))
884:
1.42 petere 885:
886: PGAC_ARG_BOOL(enable, syslog, no, [ --enable-syslog enable logging to syslog],
887: [AC_CHECK_FUNC(syslog,
888: [AC_DEFINE([ENABLE_SYSLOG], 1,
889: [Define to 1 if to enable the syslogging code])],
890: [AC_MSG_ERROR([no syslog interface found])])])
891:
1.1 petere 892:
893: dnl Check to see if we have a working 64-bit integer type.
894: dnl This breaks down into two steps:
895: dnl (1) figure out if the compiler has a 64-bit int type with working
896: dnl arithmetic, and if so
897: dnl (2) see whether snprintf() can format the type correctly. (Currently,
898: dnl snprintf is the only library routine we really need for int8 support.)
899: dnl It's entirely possible to have a compiler that handles a 64-bit type
900: dnl when the C library doesn't; this is fairly likely when using gcc on
901: dnl an older platform, for example.
902: dnl If there is no native snprintf() or it does not handle the 64-bit type,
903: dnl we force our own version of snprintf() to be used instead.
904: dnl Note this test must be run after our initial check for snprintf/vsnprintf.
905:
1.6 petere 906: PGAC_TYPE_64BIT_INT([long int])
1.1 petere 907:
1.6 petere 908: if test x"$HAVE_LONG_INT_64" = x"no" ; then
909: PGAC_TYPE_64BIT_INT([long long int])
910: fi
1.1 petere 911:
912:
913: dnl If we found "long int" is 64 bits, assume snprintf handles it.
914: dnl If we found we need to use "long long int", better check.
915: dnl We cope with snprintfs that use either %lld or %qd as the format.
916: dnl If neither works, fall back to our own snprintf emulation (which we
917: dnl know uses %lld).
918:
1.7 petere 919: if [[ x"$HAVE_LONG_LONG_INT_64" = xyes ]] ; then
1.1 petere 920: if [[ x$SNPRINTF = x ]] ; then
921: AC_MSG_CHECKING(whether snprintf handles 'long long int' as %lld)
922: AC_TRY_RUN([#include <stdio.h>
923: typedef long long int int64;
924: #define INT64_FORMAT "%lld"
925:
926: int64 a = 20000001;
927: int64 b = 40000005;
928:
929: int does_int64_snprintf_work()
930: {
931: int64 c;
932: char buf[100];
933:
934: if (sizeof(int64) != 8)
935: return 0; /* doesn't look like the right size */
936:
937: c = a * b;
938: snprintf(buf, 100, INT64_FORMAT, c);
939: if (strcmp(buf, "800000140000005") != 0)
940: return 0; /* either multiply or snprintf is busted */
941: return 1;
942: }
943: main() {
944: exit(! does_int64_snprintf_work());
945: }],
946: [ AC_MSG_RESULT(yes)
947: INT64_FORMAT='"%lld"'
948: ],
949: [ AC_MSG_RESULT(no)
950: AC_MSG_CHECKING(whether snprintf handles 'long long int' as %qd)
951: AC_TRY_RUN([#include <stdio.h>
952: typedef long long int int64;
953: #define INT64_FORMAT "%qd"
954:
955: int64 a = 20000001;
956: int64 b = 40000005;
957:
958: int does_int64_snprintf_work()
959: {
960: int64 c;
961: char buf[100];
962:
963: if (sizeof(int64) != 8)
964: return 0; /* doesn't look like the right size */
965:
966: c = a * b;
967: snprintf(buf, 100, INT64_FORMAT, c);
968: if (strcmp(buf, "800000140000005") != 0)
969: return 0; /* either multiply or snprintf is busted */
970: return 1;
971: }
972: main() {
973: exit(! does_int64_snprintf_work());
974: }],
975: [ AC_MSG_RESULT(yes)
976: INT64_FORMAT='"%qd"'
977: ],
978: [ AC_MSG_RESULT(no)
979: # Force usage of our own snprintf, since system snprintf is broken
980: SNPRINTF='snprintf.o'
981: INT64_FORMAT='"%lld"'
982: ],
983: [ AC_MSG_RESULT(assuming not on target machine)
984: # Force usage of our own snprintf, since we cannot test foreign snprintf
985: SNPRINTF='snprintf.o'
986: INT64_FORMAT='"%lld"'
987: ]) ],
988: [ AC_MSG_RESULT(assuming not on target machine)
989: # Force usage of our own snprintf, since we cannot test foreign snprintf
990: SNPRINTF='snprintf.o'
991: INT64_FORMAT='"%lld"'
992: ])
993: else
994: # here if we previously decided we needed to use our own snprintf
995: INT64_FORMAT='"%lld"'
996: fi
997: else
998: # Here if we are not using 'long long int' at all
999: INT64_FORMAT='"%ld"'
1000: fi
1001:
1002: AC_DEFINE_UNQUOTED(INT64_FORMAT, $INT64_FORMAT)
1003:
1004:
1005: dnl Determine memory alignment requirements for the basic C datatypes.
1006:
1.6 petere 1007: PGAC_CHECK_ALIGNOF(short)
1008: PGAC_CHECK_ALIGNOF(int)
1009: PGAC_CHECK_ALIGNOF(long)
1.7 petere 1010: if [[ x"$HAVE_LONG_LONG_INT_64" = xyes ]] ; then
1.6 petere 1011: PGAC_CHECK_ALIGNOF(long long int)
1.1 petere 1012: fi
1.6 petere 1013: PGAC_CHECK_ALIGNOF(double)
1.1 petere 1014:
1015: dnl Compute maximum alignment of any basic type.
1016: dnl We assume long's alignment is at least as strong as char, short, or int;
1017: dnl but we must check long long (if it exists) and double.
1018:
1.6 petere 1019: if test $pgac_cv_alignof_double != 'sizeof(double)' ; then
1020: MAX_ALIGNOF=$pgac_cv_alignof_long
1021: if test $MAX_ALIGNOF -lt $pgac_cv_alignof_double ; then
1022: MAX_ALIGNOF=$pgac_cv_alignof_double
1.1 petere 1023: fi
1.7 petere 1024: if test x"$HAVE_LONG_LONG_INT_64" = xyes && test $MAX_ALIGNOF -lt $pgac_cv_alignof_long_long_int ; then
1.6 petere 1025: MAX_ALIGNOF="$pgac_cv_alignof_long_long_int"
1.1 petere 1026: fi
1027: else
1028: dnl cross-compiling: assume that double's alignment is worst case
1.6 petere 1029: MAX_ALIGNOF="$pgac_cv_alignof_double"
1.1 petere 1030: fi
1.6 petere 1031: AC_DEFINE_UNQUOTED(MAXIMUM_ALIGNOF, $MAX_ALIGNOF, [Define as the maximum alignment requirement of any type])
1.1 petere 1032:
1.6 petere 1033: PGAC_FUNC_POSIX_SIGNALS
1.1 petere 1034:
1035:
1.43 petere 1036: # Check for Tcl configuration script tclConfig.sh
1037: if test "$with_tcl" = yes; then
1038: PGAC_PATH_TCLCONFIGSH([$with_tclconfig])
1039: fi
1.1 petere 1040:
1.43 petere 1041: # Check for Tk configuration script tkConfig.sh
1042: if test "$with_tk" = yes; then
1043: PGAC_PATH_TKCONFIGSH([$with_tkconfig $with_tclconfig])
1.1 petere 1044: fi
1045:
1046:
1.43 petere 1047: # Finally ready to produce output files ...
1.1 petere 1048:
1049: AC_OUTPUT(
1.33 petere 1050: [
1051: GNUmakefile
1052: src/GNUmakefile
1053: src/Makefile.global
1054: src/backend/port/Makefile
1055: ],
1.43 petere 1056: [echo "timestamp file" > src/include/stamp-h]
1.1 petere 1057: )
PostgreSQL CVSweb <[email protected]>