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