]> granicus.if.org Git - postgresql/blob - src/configure.in
Rename heap_replace to heap_update.
[postgresql] / src / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(backend/access/common/heaptuple.c)
3 AC_PREFIX_DEFAULT(/usr/local/pgsql)
4 AC_CONFIG_HEADER(include/config.h)
5
6 dnl Autoconf 2.12, at least, generates a useless relative path to install-sh
7 dnl unless we do this.
8 AC_CONFIG_AUX_DIR(`pwd`)
9
10 AC_CANONICAL_HOST
11
12 tas_file=dummy.s
13 case "$host_os" in
14  solaris*)
15         case "$host_cpu" in
16           sparc) os=solaris_sparc need_tas=yes tas_file=solaris_sparc.s ;;
17            i386) os=solaris_i386 need_tas=yes tas_file=solaris_i386.s ;;
18         esac ;;
19    sunos*) os=sunos4 need_tas=no ;;
20      beos) os=beos need_tas=no ;;
21      aux*) os=aux need_tas=no ;;
22    linux*) os=linux need_tas=no ;;
23     bsdi*) os=bsdi need_tas=no ;;
24  freebsd1*|freebsd2*) os=freebsd need_tas=no ;;
25  freebsd*) os=freebsd need_tas=no elf=yes ;;
26   netbsd*)
27         os=bsd need_tas=no
28         case "$host_cpu" in
29           powerpc) elf=yes ;;
30         esac ;;
31   openbsd*) os=bsd need_tas=no ;;
32     dgux*) os=dgux need_tas=no ;;
33      aix*) os=aix need_tas=no ;;
34 nextstep*) os=nextstep need_tas=no ;;
35   ultrix*) os=ultrix4 need_tas=no ;;
36     irix*) os=irix5 need_tas=no ;;
37     hpux*) os=hpux need_tas=yes tas_file=hpux.s ;;
38      osf*) os=alpha need_tas=no ;;
39      sco*) os=sco need_tas=no ;;
40  machten*) os=machten need_tas=no ;;
41   cygwin*) os=win need_tas=no ;;
42  sysv4.2*)
43        case "$host_vendor" in
44                univel) os=univel need_tas=no ;;
45                     *) os=unknown need_tas=no ;;
46        esac ;;
47    sysv4*) os=svr4 need_tas=no ;;
48    unixware*) os=unixware need_tas=no ;;
49 *) echo ""
50    echo "*************************************************************"
51    echo "configure does not currently recognize your operating system,"
52    echo "therefore you must do a manual configuration of:"
53    echo "$host_os"
54    echo "Please contact scrappy@hub.org to see about rectifying this, "
55    echo "including the above 'checking host system type...' line "
56    echo "*************************************************************"
57    echo ""
58    exit;;
59 esac
60
61 PORTNAME=${os}
62 CPU=${host_cpu}
63 AC_LINK_FILES(backend/port/dynloader/${os}.c, backend/port/dynloader.c)
64 AC_LINK_FILES(backend/port/dynloader/${os}.h, include/dynloader.h)
65 AC_LINK_FILES(include/port/${os}.h, include/os.h)
66 AC_LINK_FILES(makefiles/Makefile.${os}, Makefile.port)
67
68 if test "X$need_tas" = "Xyes"
69 then
70         AC_LINK_FILES(backend/port/tas/${tas_file}, backend/port/tas.s)
71         TAS=tas.o
72         AC_SUBST(TAS)
73 fi
74
75 echo "checking echo setting..."
76 if echo '\c' | grep -s c >/dev/null 2>&1
77 then
78         ECHO_N="echo -n"
79         ECHO_C=""
80 else
81         ECHO_N="echo"
82         ECHO_C='\c'
83 fi
84
85 dnl this part selects the template from the ones in the template directory.
86
87 AC_MSG_CHECKING(setting template to)
88 AC_ARG_WITH(template,
89     [  --with-template=TEMPLATE
90                           use operating system template file 
91                               see template directory],
92     [  TEMPLATE=$withval ],
93     [
94 # First, try for a template exactly matching $host
95 if test -f "template/$host"
96 then TEMPLATE="$host"
97 else
98     # Next try for an exact match to a .similar entry.
99     # There shouldn't be multiple matches, but take the last if there are.
100     GUESS=`grep "^$host=" template/.similar | sed 's/^.*=//' | tail -1`
101     if test "$GUESS"
102     then TEMPLATE="$GUESS"
103     else
104         # Next look for a .similar entry that is a prefix of $host.
105         # If there are multiple matches, take the last one.
106         exec 4<template/.similar
107         while read LINE <&4
108         do
109             SIMHOST=`expr "$LINE" : '\(.*\)='`
110             MATCH=`expr "$host" : "$SIMHOST"`
111             if test "$MATCH" != 0
112             then GUESS=`echo "$LINE" | sed 's/^.*=//'`
113             fi
114         done
115         exec 4<&-
116         if test "$GUESS"
117         then TEMPLATE="$GUESS"
118         else
119             # Last chance ... maybe uname -s will match an entry.
120             TEMPLATE=`uname -s | tr A-Z a-z` 
121         fi
122     fi
123 fi
124     ])
125 AC_MSG_RESULT($TEMPLATE)
126
127 export TEMPLATE
128 if test ! -f "template/$TEMPLATE"; then
129         echo ""
130         echo "$TEMPLATE does not exist"
131         echo ""
132         echo "Available Templates (set using --with-template):"
133         echo ""
134         ls template
135         echo ""
136         exit
137 fi
138
139 dnl Read the selected template file.
140 dnl For reasons of backwards compatibility, lines of the form
141 dnl     IDENTIFIER: something
142 dnl should be treated as variable assignments.  However, we also want to
143 dnl allow other shell commands in the template file (in case the file
144 dnl needs to make conditional tests, etc).  So, generate a temp file with
145 dnl the IDENTIFIER: lines translated, then source it.
146
147 [
148 rm -f conftest.sh
149 sed 's/^\([A-Za-z_]*\):\(.*\)$/\1="\2"/' "template/$TEMPLATE" >conftest.sh
150 . ./conftest.sh
151 rm -f conftest.sh
152 ]
153
154
155 AC_ARG_WITH(includes,
156     [  --with-includes=DIR     site header files for tk/tcl, etc in DIR],
157     [
158         case "$withval" in
159         "" | y | ye | yes | n | no)
160             AC_MSG_ERROR([*** You must supply an argument to the --with-includes option.])
161           ;;
162         esac
163         INCLUDE_DIRS="$withval"
164     ])
165
166 if test "$INCLUDE_DIRS" -o "$SRCH_INC"; then
167         for dir in $INCLUDE_DIRS $SRCH_INC; do
168                 if test -d "$dir"; then
169                         PGSQL_CPPFLAGS="$PGSQL_CPPFLAGS -I$dir"
170                 else
171                         AC_MSG_WARN([*** Include directory $dir does not exist.])
172                 fi
173         done
174 fi
175
176 AC_ARG_WITH(libs,
177     [  --with-libs=DIR         also search for libraries in DIR],
178     [
179         case "$withval" in
180         "" | y | ye | yes | n | no)
181             AC_MSG_ERROR([*** You must supply an argument to the --with-libs option.])
182           ;;
183         esac
184         LIBRARY_DIRS="$withval"
185     ])
186
187 AC_ARG_WITH(libraries,
188     [  --with-libraries=DIR    also search for libraries in DIR],
189     [
190         case "$withval" in
191         "" | y | ye | yes | n | no)
192             AC_MSG_ERROR([*** You must supply an argument to the --with-libraries option.])
193           ;;
194         esac
195         LIBRARY_DIRS="$withval"
196     ])
197
198 if test "$LIBRARY_DIRS" -o "$SRCH_LIB"; then
199         for dir in $LIBRARY_DIRS $SRCH_LIB; do
200                 if test -d "$dir"; then
201                         PGSQL_LDFLAGS="$PGSQL_LDFLAGS -L$dir"
202                 else
203                         AC_MSG_WARN([*** Library directory $dir does not exist.])
204                 fi
205         done
206 fi
207
208 dnl We have read the default value of USE_LOCALE from the template
209 dnl file.  We have a further option of using
210 dnl     --enable-locale to explicitly enable it
211 dnl It defaults to disabled
212 AC_MSG_CHECKING(setting USE_LOCALE)
213 AC_ARG_ENABLE(
214    locale,
215    [  --enable-locale         enable locale support ],
216    AC_DEFINE(USE_LOCALE) AC_MSG_RESULT(enabled),
217    AC_MSG_RESULT(disabled)
218 )
219
220 dnl We exclude cyrillic recode support unless we override it with
221 dnl     --enable-recode to explicitly enable it
222 dnl It defaults to disabled
223 AC_MSG_CHECKING(setting CYR_RECODE)
224 AC_ARG_ENABLE(
225    recode,
226    [  --enable-recode         enable cyrillic recode support ],
227    AC_DEFINE(CYR_RECODE) AC_MSG_RESULT(enabled),
228    AC_MSG_RESULT(disabled)
229 )
230
231 AC_MSG_CHECKING(setting MULTIBYTE)
232 AC_ARG_WITH(mb,
233     [  --with-mb=<encoding>    enable multi-byte support ], 
234     [
235         case "$withval" in
236         EUC_JP|EUC_CN|EUC_KR|EUC_TW|UNICODE|MULE_INTERNAL|LATIN1|LATIN2|LATIN3|LATIN4|LATIN5|KOI8|WIN|ALT)
237             AC_MSG_RESULT("enabled with $withval")
238             ;;
239         *)
240             AC_MSG_ERROR([*** You must supply an argument to the --with-mb option one of EUC_JP,EUC_CN,EUC_KR,EUC_TW,UNICODE,MULE_INTERNAL,LATIN1-5,KOI8,WIN,ALT])
241           ;;
242         esac
243         MULTIBYTE="$withval"
244     ],
245     AC_MSG_RESULT("disabled")
246 )
247
248 dnl We use the default value of 5432 for the DEF_PGPORT value.  If
249 dnl we over-ride it with --with-pgport=port then we bypass this piece
250 AC_MSG_CHECKING(setting DEF_PGPORT)
251 AC_ARG_WITH(
252    pgport,
253    [  --with-pgport=<portnum> change default startup port ],
254    AC_DEFINE_UNQUOTED(DEF_PGPORT, "${withval}") AC_MSG_RESULT($with_pgport),
255    AC_DEFINE_UNQUOTED(DEF_PGPORT, "5432") AC_MSG_RESULT(5432)
256 )
257
258 dnl DEF_MAXBACKENDS can be set by --with-maxbackends.  Default value is 32.
259 AC_MSG_CHECKING(setting DEF_MAXBACKENDS)
260 AC_ARG_WITH(
261    maxbackends,
262    [  --with-maxbackends=<n>  set default maximum number of server processes ],
263    AC_DEFINE_UNQUOTED(DEF_MAXBACKENDS, ${withval}) AC_MSG_RESULT($with_maxbackends),
264    AC_DEFINE_UNQUOTED(DEF_MAXBACKENDS, 32) AC_MSG_RESULT(32)
265 )
266
267 dnl We exclude tcl support unless user says --with-tcl
268 AC_MSG_CHECKING(setting USE_TCL)
269 AC_ARG_WITH(
270    tcl,
271    [  --with-tcl              build Tcl interfaces and pgtclsh ],
272    [
273         case "$withval" in
274         y | ye | yes)           USE_TCL=true; USE_TK=true; AC_MSG_RESULT(enabled) ;;
275         *)                      USE_TCL=; USE_TK=; AC_MSG_RESULT(disabled) ;;
276         esac
277    ],
278    [ USE_TCL=; USE_TK=; AC_MSG_RESULT(disabled) ]
279 )
280
281 export USE_TCL
282 export USE_TK
283
284 dnl We see if the path to the TCL/TK configuration scripts is specified.
285 dnl This will overide the use of tclsh to find the paths to search.
286
287 AC_ARG_WITH(tclconfig,
288     [  --with-tclconfig=DIR    tclConfig.sh and tkConfig.sh are in DIR],
289     [
290         case "$withval" in
291         "" | y | ye | yes | n | no)
292             AC_MSG_ERROR([*** You must supply an argument to the --with-tclconfig option.])
293           ;;
294         esac
295         TCL_DIRS="$withval"
296     ]
297 )
298
299 dnl We see if the path to the TK configuration scripts is specified.
300 dnl This will overide the use of tclsh to find the paths to search.
301
302 AC_ARG_WITH(tkconfig,
303     [  --with-tkconfig=DIR     tkConfig.sh is in DIR],
304     [
305         case "$withval" in
306         "" | y | ye | yes | n | no)
307             AC_MSG_ERROR([*** You must supply an argument to the --with-tkconfig option.])
308           ;;
309         esac
310         TK_DIRS="$withval"
311     ]
312 )
313
314 dnl We exclude perl support unless we override it with --with-perl
315 AC_MSG_CHECKING(setting USE_PERL)
316 AC_ARG_WITH(
317    perl,
318    [  --with-perl             build Perl interface ],
319    [
320         case "$withval" in
321         y | ye | yes)   USE_PERL=true; AC_MSG_RESULT(enabled) ;;
322         *)              USE_PERL=false; AC_MSG_RESULT(disabled) ;;
323         esac
324    ],
325    [ USE_PERL=false; AC_MSG_RESULT(disabled) ]
326 )
327
328 dnl We include odbc support unless we disable it with --with-odbc=false
329 AC_MSG_CHECKING(setting USE_ODBC)
330 AC_ARG_WITH(
331    odbc,
332    [  --with-odbc             build ODBC driver package ],
333    [
334         case "$withval" in
335         y | ye | yes)           USE_ODBC=true; AC_MSG_RESULT(enabled) ;;
336         *)                      USE_ODBC=false; AC_MSG_RESULT(disabled) ;;
337         esac
338    ],
339    [ USE_ODBC=false; AC_MSG_RESULT(disabled) ]
340 )
341 export USE_ODBC
342
343 dnl Allow for overriding the default location of the odbcinst.ini
344 dnl file which is normally ${prefix}/share or ${prefix} if this is
345 dnl being compiled inside the postgres distribution.
346 dnl Link in the port and template directories
347 dnl to help build a "standalone ODBC" tar file
348 if test "X$USE_ODBC" = "Xtrue"
349 then
350    AC_LINK_FILES(include/port, interfaces/odbc/port)
351    AC_LINK_FILES(makefiles, interfaces/odbc/makefiles)
352    AC_LINK_FILES(template, interfaces/odbc/template)
353    AC_LINK_FILES(include/config.h, interfaces/odbc/config.h)
354
355    AC_MSG_CHECKING(setting ODBCINST)
356    AC_ARG_WITH(
357       odbcinst,
358       [  --with-odbcinst=dir     change default directory for odbcinst.ini],
359       AC_DEFINE_UNQUOTED(ODBCINST, ${with_odbcinst}) AC_MSG_RESULT($with_odbcinst),
360       AC_DEFINE_UNQUOTED(ODBCINST, ${ODBCINSTDIR}) AC_MSG_RESULT(${ODBCINSTDIR})
361    )
362 fi
363 if test "X$with_odbcinst" != "X"
364 then
365     ODBCINSTDIR=$with_odbcinst
366 fi
367 AC_SUBST(ODBCINSTDIR)
368
369 dnl Unless we specify the command line options
370 dnl     --enable cassert        to explicitly enable it
371 dnl If you do not explicitly do it, it defaults to disabled
372 AC_MSG_CHECKING(setting ASSERT CHECKING)
373 AC_ARG_ENABLE(
374    cassert,
375    [  --enable-cassert        enable assertion checks (debugging) ],
376    AC_DEFINE(USE_ASSERT_CHECKING) AC_MSG_RESULT(enabled),
377    AC_MSG_RESULT(disabled)
378 )
379
380 dnl Check for C support (allow override if needed)
381 dnl Note: actually, setting CC environment variable works just as well.
382 AC_ARG_WITH(CC,
383     [  --with-CC=compiler      use specific C compiler],
384     [
385         case "$withval" in
386         "" | y | ye | yes | n | no)
387             AC_MSG_ERROR([*** You must supply an argument to the --with-CC option.])
388           ;;
389         esac
390         CC="$withval"
391     ])
392
393 dnl Find a compiler if CC is not already set.
394 AC_PROG_CC
395 dnl Find CPP, then check traditional.
396 dnl Caution: these macros must be called in this order...
397 AC_PROG_CPP
398 AC_PROG_GCC_TRADITIONAL
399
400 if test "$CC" = "gcc"
401 then
402         CC_VERSION=`${CC} --version`
403 else
404         CC_VERSION=""
405 fi
406 AC_SUBST(CC_VERSION)
407
408 CPPFLAGS="$CPPFLAGS $PGSQL_CPPFLAGS"
409 echo "- setting CPPFLAGS=$CPPFLAGS"
410
411 LDFLAGS="$LDFLAGS $PGSQL_LDFLAGS"
412 echo "- setting LDFLAGS=$LDFLAGS"
413
414 dnl --enable-debug adds -g to compiler flags
415 dnl --disable-debug will forcefully remove it
416 AC_MSG_CHECKING(setting debug compiler flag)
417 AC_ARG_ENABLE(
418     debug,
419     [  --enable-debug          build with debugging symbols (-g) ],
420     [
421         case "$enableval" in
422         y | ye | yes)
423             CFLAGS="$CFLAGS -g"
424             AC_MSG_RESULT(enabled)
425             ;;
426         *)
427             CFLAGS=`echo "$CFLAGS" | sed -e 's/ -g/ /g' | sed -e 's/^-g//'`
428             AC_MSG_RESULT(disabled)
429             ;;
430         esac            
431    ],
432    AC_MSG_RESULT(using default)
433 )
434
435 # Assume system is ELF if it predefines __ELF__ as 1,
436 # otherwise believe "elf" setting from check of host_os above.
437 AC_EGREP_CPP(yes,
438 [#if __ELF__
439   yes
440 #endif
441 ],
442         ELF_SYS=true,
443 [if test "X$elf" = "Xyes"
444 then
445         ELF_SYS=true
446 else
447         ELF_SYS=
448 fi
449 ])
450
451 AC_SUBST(ELF_SYS)
452 AC_SUBST(PORTNAME)
453 AC_SUBST(CPU)
454 AC_SUBST(SRCDIR)
455 AC_SUBST(LDFLAGS)
456 AC_SUBST(CPPFLAGS)
457 AC_SUBST(AROPT)
458 AC_SUBST(SHARED_LIB)
459 AC_SUBST(CFLAGS)
460 AC_SUBST(DLSUFFIX)
461 AC_SUBST(DL_LIB)
462 AC_SUBST(USE_TCL)
463 AC_SUBST(USE_TK)
464 AC_SUBST(WISH)
465 AC_SUBST(USE_PERL)
466 AC_SUBST(USE_ODBC)
467 AC_SUBST(MULTIBYTE)
468
469 dnl Check for C++ support (allow override if needed)
470 HAVECXX='HAVE_Cplusplus=true'
471 AC_ARG_WITH(CXX,
472     [  --with-CXX=compiler     use specific C++ compiler
473   --without-CXX           prevent building C++ code ],
474     [
475         case "$withval" in
476         "" | y | ye | yes)
477             AC_MSG_ERROR([*** You must supply an argument to the --with-CC option.])
478           ;;
479         n | no)
480             HAVECXX='HAVE_Cplusplus=false'
481           ;;
482         esac
483         CXX="$withval"
484     ],
485     [   AC_PROG_CXX])
486 AC_SUBST(HAVECXX)
487
488 dnl make sure we revert to C compiler, not C++, for subsequent tests
489 AC_LANG_C
490
491 dnl Figure out how to invoke "install" and what install options to use.
492
493 AC_PROG_INSTALL
494
495 INSTLOPTS="-m 444"
496 INSTL_EXE_OPTS="-m 555"
497 INSTL_LIB_OPTS="-m 644"
498 INSTL_SHLIB_OPTS="-m 644"
499
500 dnl HPUX wants shared libs to be mode 555.
501 case "$host_os" in
502  hpux*)
503         INSTL_SHLIB_OPTS="-m 555" ;;
504 esac
505
506 AC_SUBST(INSTALL)
507 AC_SUBST(INSTLOPTS)
508 AC_SUBST(INSTL_LIB_OPTS)
509 AC_SUBST(INSTL_SHLIB_OPTS)
510 AC_SUBST(INSTL_EXE_OPTS)
511
512 dnl Check the option to echo to inhibit newlines.
513 ECHO_N_OUT=`echo -n "" | wc -c`
514 ECHO_C_OUT=`echo "\c" | wc -c`
515 if test "$ECHO_N_OUT" -eq 0; then
516         DASH_N='-n'
517         BACKSLASH_C=
518 else
519         if test "ECHO_C_OUT" -eq 0; then
520                 DASH_N=
521                 BACKSLASH_C='\\\\c'
522         else
523                 AC_MSG_ERROR("echo behaviour undetermined")
524         fi
525 fi
526 AC_SUBST(DASH_N)
527 AC_SUBST(BACKSLASH_C)
528
529 AC_PROG_LEX
530 AC_PROG_LN_S
531 AC_PROG_MAKE_SET
532 AC_PROG_RANLIB
533 AC_PATH_PROG(find, find)
534 AC_PATH_PROG(tar, tar)
535 AC_PATH_PROG(split, split)
536 AC_PATH_PROG(etags, etags)
537 AC_PATH_PROG(xargs, xargs)
538 AC_PATH_PROG(ipcs, ipcs)
539 AC_PATH_PROG(ipcrm, ipcrm)
540 AC_PATH_PROGS(TR, trbsd tr, NOT_FOUND)
541 AC_PATH_PROGS(GZCAT, gzcat zcat, gzcat)
542
543 dnl Check tr flags to convert from lower to upper case
544 TRSTRINGS="`echo ABCdef | $TR '[[a-z]]' '[[A-Z]]' 2>/dev/null | grep ABCDEF`"
545 TRCLASS="`echo ABCdef | $TR '[[:lower:]]' '[[:upper:]]' 2>/dev/null | grep ABCDEF`"
546
547 if test "$TRSTRINGS" = "ABCDEF"; then
548         TRARGS="'[[a-z]]' '[[A-Z]]'"
549 elif test "$TRCLASS" = "ABCDEF"; then
550         TRARGS="'[[:lower:]]' '[[:upper:]]'"
551 else
552         AC_MSG_ERROR("Can\'t find method to convert from upper to lower case with tr")
553 fi
554 AC_SUBST(TRARGS)
555
556 dnl Changes to look for YACC.  We have three choices (in order of pref.)
557 dnl (1) We specify in YACC and YFLAGS what we want
558 dnl (2) We have bison and we use bison -y
559 dnl (3) We have yacc and use it
560
561 if test -f "$YACC"
562 then
563         echo "- Using $YACC $YFLAGS"
564 else
565     AC_PATH_PROG(bison, bison)
566     if test -f "$bison"
567     then
568         echo "- Using $bison -y $YFLAGS"
569         YACC="$bison"
570         YFLAGS="-y $YFLAGS"
571     else
572         AC_PATH_PROG(yacc, yacc)
573         echo "- Using $yacc $YFLAGS"
574         YACC="$yacc"
575     fi
576 fi
577 AC_SUBST(YACC)
578 AC_SUBST(YFLAGS)
579
580 AC_CHECK_LIB(sfio,     main)
581 for curses in ncurses curses ; do
582         AC_CHECK_LIB(${curses}, main,
583                 [LIBS="-l${curses} $LIBS"; break])
584 done
585 AC_CHECK_LIB(termcap,  main)
586 AC_CHECK_LIB(readline, main)
587 AC_CHECK_LIB(readline, using_history, AC_DEFINE(HAVE_HISTORY_IN_READLINE),
588     AC_CHECK_LIB(history,  main) )
589
590 if test "$PORTNAME" != "aix" -a "$PORTNAME" != "alpha"
591 then
592         AC_CHECK_LIB(bsd,      main)
593 fi
594 AC_CHECK_LIB(m,        main)
595 AC_CHECK_LIB(dl,       main)
596 AC_CHECK_LIB(socket,   main)
597 AC_CHECK_LIB(nsl,      main)
598 AC_CHECK_LIB(ipc,      main)
599 AC_CHECK_LIB(IPC,      main)
600 AC_CHECK_LIB(lc,       main)
601 AC_CHECK_LIB(dld,      main)
602 AC_CHECK_LIB(ln,       main)
603 AC_CHECK_LIB(ld,       main)
604 AC_CHECK_LIB(compat,   main)
605 AC_CHECK_LIB(BSD,      main)
606 AC_CHECK_LIB(crypt,    main)
607 AC_CHECK_LIB(gen,      main)
608 AC_CHECK_LIB(PW,       main)
609
610 dnl Checks for header files.
611 AC_HEADER_STDC
612 AC_HEADER_SYS_WAIT
613 AC_CHECK_HEADERS(arpa/inet.h)
614 AC_CHECK_HEADERS(crypt.h)
615 AC_CHECK_HEADERS(dld.h)
616 AC_CHECK_HEADERS(endian.h)
617 AC_CHECK_HEADERS(float.h)
618 AC_CHECK_HEADERS(fp_class.h)
619 AC_CHECK_HEADERS(getopt.h)
620 AC_CHECK_HEADERS(history.h)
621 AC_CHECK_HEADERS(ieeefp.h)
622 AC_CHECK_HEADERS(limits.h)
623 AC_CHECK_HEADERS(netdb.h)
624 AC_CHECK_HEADERS(netinet/in.h)
625 AC_CHECK_HEADERS(readline.h)
626 AC_CHECK_HEADERS(readline/history.h)
627 AC_CHECK_HEADERS(readline/readline.h)
628 AC_CHECK_HEADERS(sys/select.h)
629 AC_CHECK_HEADERS(termios.h)
630 AC_CHECK_HEADERS(unistd.h)
631 AC_CHECK_HEADERS(values.h)
632 dnl ODBC headers...
633 AC_CHECK_HEADERS(sys/param.h pwd.h)
634 dnl
635
636 dnl Checks for typedefs, structures, and compiler characteristics.
637 AC_C_CONST
638 AC_C_INLINE
639 AC_C_STRINGIZE
640 AC_TYPE_UID_T
641 AC_TYPE_MODE_T
642 AC_TYPE_OFF_T
643 AC_TYPE_SIZE_T
644 AC_HEADER_TIME
645 AC_STRUCT_TM
646 AC_STRUCT_TIMEZONE
647
648 AC_MSG_CHECKING(for signed types)
649 AC_TRY_COMPILE([],
650 [signed char c; signed short s; signed int i;],
651 [AC_MSG_RESULT(yes)],
652 [AC_DEFINE(signed, ) AC_MSG_RESULT(no)])
653
654 AC_MSG_CHECKING(for volatile)
655 AC_TRY_COMPILE([],
656 [extern volatile int i;],
657 [AC_MSG_RESULT(yes)],
658 [AC_DEFINE(volatile, ) AC_MSG_RESULT(no)])
659
660 AC_MSG_CHECKING(for type of last arg to accept)
661 AC_TRY_COMPILE([#include <stdlib.h>
662 #include <sys/types.h>
663 #include <sys/socket.h>
664 ],
665 [int a = accept(1, (struct sockaddr *) 0, (size_t *) 0);],
666 [AC_DEFINE(SOCKET_SIZE_TYPE, size_t) AC_MSG_RESULT(size_t)],
667 [AC_DEFINE(SOCKET_SIZE_TYPE, int) AC_MSG_RESULT(int)])
668
669 dnl Check for any "odd" conditions
670 AC_MSG_CHECKING(for int timezone)
671 AC_TRY_LINK([#include <time.h>],
672             [int res = timezone / 60; ],
673             [AC_DEFINE(HAVE_INT_TIMEZONE) AC_MSG_RESULT(yes)],
674             AC_MSG_RESULT(no))
675
676 AC_MSG_CHECKING(for gettimeofday args)
677 AC_TRY_LINK([#include <sys/time.h>],
678             [struct timeval *tp; struct timezone *tzp; gettimeofday(tp,tzp); ],
679             [AC_DEFINE(HAVE_GETTIMEOFDAY_2_ARGS) AC_MSG_RESULT(2 args)],
680             AC_MSG_RESULT(no))
681
682 AC_MSG_CHECKING(for union semun)
683 AC_TRY_LINK([#include <sys/types.h>
684 #include <sys/ipc.h>
685 #include <sys/sem.h>],
686             [union semun semun;],
687             [AC_DEFINE(HAVE_UNION_SEMUN) AC_MSG_RESULT(yes)],
688             AC_MSG_RESULT(no))
689
690 AC_MSG_CHECKING(for fcntl(F_SETLK))
691 AC_TRY_LINK([#include <fcntl.h>],
692             [struct flock lck;
693              lck.l_whence = SEEK_SET; lck.l_start = lck.l_len = 0;
694              lck.l_type = F_WRLCK;
695              fcntl(0, F_SETLK, &lck);],
696             [AC_DEFINE(HAVE_FCNTL_SETLK) AC_MSG_RESULT(yes)],
697             AC_MSG_RESULT(no))
698
699 dnl Checks for library functions.
700 AC_FUNC_MEMCMP
701 AC_TYPE_SIGNAL
702 AC_FUNC_VPRINTF
703 AC_CHECK_FUNCS(memmove sigsetjmp sysconf)
704 AC_CHECK_FUNCS(sigprocmask waitpid setsid fcvt)
705 AC_CHECK_FUNCS(fpclass fp_class fp_class_d class)
706 dnl We use our snprintf.c emulation if either snprintf() or vsnprintf()
707 dnl is missing.  Yes, there are machines that have only one.
708 dnl We may also decide to use snprintf.c if snprintf() is present but does
709 dnl not have working "long long int" support -- see below.
710 SNPRINTF=''
711 AC_CHECK_FUNC(snprintf,
712               AC_DEFINE(HAVE_SNPRINTF),
713               SNPRINTF='snprintf.o')
714 AC_CHECK_FUNC(vsnprintf,
715               AC_DEFINE(HAVE_VSNPRINTF),
716               SNPRINTF='snprintf.o')
717 AC_SUBST(SNPRINTF)
718 dnl do this one the hard way in case isinf() is a macro
719 AC_MSG_CHECKING(for isinf)
720 AC_CACHE_VAL(ac_cv_func_or_macro_isinf,
721 [AC_TRY_LINK(
722 [#include <math.h>],
723 [double x = 0.0; int res = isinf(x);],
724 [ac_cv_func_or_macro_isinf=yes],
725 [ac_cv_func_or_macro_isinf=no])])
726 if [[ $ac_cv_func_or_macro_isinf = yes ]]; then
727   AC_MSG_RESULT(yes)
728   AC_DEFINE(HAVE_ISINF)
729   ISINF=''
730 else
731   AC_MSG_RESULT(no)
732   ISINF='isinf.o'
733 fi
734 AC_SUBST(ISINF)
735 AC_CHECK_FUNC(getrusage,
736               AC_DEFINE(HAVE_GETRUSAGE),
737               GETRUSAGE='getrusage.o')
738 AC_SUBST(GETRUSAGE)
739 AC_CHECK_FUNC(srandom,
740               AC_DEFINE(HAVE_SRANDOM),
741               SRANDOM='srandom.o')
742 AC_SUBST(SRANDOM)
743 AC_CHECK_FUNC(gethostname,
744               AC_DEFINE(HAVE_GETHOSTNAME),
745               GETHOSTNAME='gethostname.o')
746 AC_SUBST(GETHOSTNAME)
747 AC_CHECK_FUNC(random,
748               AC_DEFINE(HAVE_RANDOM),
749               MISSING_RANDOM='random.o')
750 AC_SUBST(MISSING_RANDOM)
751 AC_CHECK_FUNC(inet_aton,
752               AC_DEFINE(HAVE_INET_ATON),
753               INET_ATON='inet_aton.o')
754 AC_SUBST(INET_ATON)
755 AC_CHECK_FUNC(strerror,
756               AC_DEFINE(HAVE_STRERROR),
757               [STRERROR='strerror.o' STRERROR2='../../backend/port/strerror.o'])
758 AC_SUBST(STRERROR)
759 AC_SUBST(STRERROR2)
760 AC_CHECK_FUNC(strdup,
761               AC_DEFINE(HAVE_STRDUP),
762               STRDUP='../../utils/strdup.o')
763 AC_SUBST(STRDUP)
764 AC_CHECK_FUNC(strtol,
765               AC_DEFINE(HAVE_STRTOL),
766               STRTOL='strtol.o')
767 AC_SUBST(STRTOL)
768 AC_CHECK_FUNC(strtoul,
769               AC_DEFINE(HAVE_STRTOUL),
770               STRTOL='strtoul.o')
771 AC_SUBST(STRTOUL)
772 AC_CHECK_FUNC(strcasecmp,
773               AC_DEFINE(HAVE_STRCASECMP),
774               STRCASECMP='strcasecmp.o')
775 AC_SUBST(STRCASECMP)
776 AC_CHECK_FUNC(cbrt,
777               AC_DEFINE(HAVE_CBRT),
778               AC_CHECK_LIB(m, cbrt, AC_DEFINE(HAVE_CBRT)))
779
780 # On HPUX 9, rint() is not in regular libm.a but in /lib/pa1.1/libm.a;
781 # this hackery with HPUXMATHLIB allows us to cope.
782 HPUXMATHLIB=""
783 case "$host_cpu" in
784   hppa1.1) 
785         if [[ -r /lib/pa1.1/libm.a ]] ; then
786             HPUXMATHLIB="-L /lib/pa1.1 -lm"
787         fi ;;
788 esac
789 AC_SUBST(HPUXMATHLIB)
790
791 AC_CHECK_FUNC(rint,
792               AC_DEFINE(HAVE_RINT),
793               AC_CHECK_LIB(m, rint, AC_DEFINE(HAVE_RINT), , $HPUXMATHLIB))
794
795
796 dnl Check for GNU style long options support (getopt_long)
797 AC_CHECK_FUNCS(getopt_long)
798
799
800 AC_MSG_CHECKING(for finite() macro or function)
801 AC_TRY_LINK([#include <math.h>],
802         [int dummy=finite(1.0);],
803         [AC_DEFINE(HAVE_FINITE) AC_MSG_RESULT(yes)],
804         AC_MSG_RESULT(no))
805
806 dnl Check to see if we have a working 64-bit integer type.
807 dnl This breaks down into two steps:
808 dnl (1) figure out if the compiler has a 64-bit int type with working
809 dnl arithmetic, and if so
810 dnl (2) see whether snprintf() can format the type correctly.  (Currently,
811 dnl snprintf is the only library routine we really need for int8 support.)
812 dnl It's entirely possible to have a compiler that handles a 64-bit type
813 dnl when the C library doesn't; this is fairly likely when using gcc on
814 dnl an older platform, for example.
815 dnl If there is no native snprintf() or it does not handle the 64-bit type,
816 dnl we force our own version of snprintf() to be used instead.
817 dnl Note this test must be run after our initial check for snprintf/vsnprintf.
818
819 HAVE_LONG_INT_64=0
820 AC_MSG_CHECKING(whether 'long int' is 64 bits)
821 AC_TRY_RUN([typedef long int int64;
822
823 /* These are globals to discourage the compiler from folding all the
824  * arithmetic tests down to compile-time constants.
825  */
826 int64 a = 20000001;
827 int64 b = 40000005;
828
829 int does_int64_work()
830 {
831   int64 c,d;
832
833   if (sizeof(int64) != 8)
834     return 0;                   /* doesn't look like the right size */
835
836   /* Do perfunctory checks to see if 64-bit arithmetic seems to work */
837   c = a * b;
838   d = (c + b) / b;
839   if (d != a+1)
840     return 0;
841   return 1;
842 }
843 main() {
844   exit(! does_int64_work());
845 }],
846         [HAVE_LONG_INT_64=1
847          AC_DEFINE(HAVE_LONG_INT_64)
848          AC_MSG_RESULT(yes)],
849         AC_MSG_RESULT(no),
850         AC_MSG_RESULT(assuming not on target machine))
851
852 HAVE_LONG_LONG_INT_64=0
853 if [[ $HAVE_LONG_INT_64 -eq 0 ]] ; then
854 AC_MSG_CHECKING(whether 'long long int' is 64 bits)
855 AC_TRY_RUN([typedef long long int int64;
856
857 /* These are globals to discourage the compiler from folding all the
858  * arithmetic tests down to compile-time constants.
859  */
860 int64 a = 20000001;
861 int64 b = 40000005;
862
863 int does_int64_work()
864 {
865   int64 c,d;
866
867   if (sizeof(int64) != 8)
868     return 0;                   /* doesn't look like the right size */
869
870   /* Do perfunctory checks to see if 64-bit arithmetic seems to work */
871   c = a * b;
872   d = (c + b) / b;
873   if (d != a+1)
874     return 0;
875   return 1;
876 }
877 main() {
878   exit(! does_int64_work());
879 }],
880         [HAVE_LONG_LONG_INT_64=1
881          AC_DEFINE(HAVE_LONG_LONG_INT_64)
882          AC_MSG_RESULT(yes)],
883         AC_MSG_RESULT(no),
884         AC_MSG_RESULT(assuming not on target machine))
885 fi
886
887 dnl If we found "long int" is 64 bits, assume snprintf handles it.
888 dnl If we found we need to use "long long int", better check.
889 dnl We cope with snprintfs that use either %lld or %qd as the format.
890 dnl If neither works, fall back to our own snprintf emulation (which we
891 dnl know uses %lld).
892
893 if [[ $HAVE_LONG_LONG_INT_64 -eq 1 ]] ; then
894   if [[ x$SNPRINTF = x ]] ; then
895     AC_MSG_CHECKING(whether snprintf handles 'long long int' as %lld)
896     AC_TRY_RUN([#include <stdio.h>
897 typedef long long int int64;
898 #define INT64_FORMAT "%lld"
899
900 int64 a = 20000001;
901 int64 b = 40000005;
902
903 int does_int64_snprintf_work()
904 {
905   int64 c;
906   char buf[100];
907
908   if (sizeof(int64) != 8)
909     return 0;                   /* doesn't look like the right size */
910
911   c = a * b;
912   snprintf(buf, 100, INT64_FORMAT, c);
913   if (strcmp(buf, "800000140000005") != 0)
914     return 0;                   /* either multiply or snprintf is busted */
915   return 1;
916 }
917 main() {
918   exit(! does_int64_snprintf_work());
919 }],
920         [ AC_MSG_RESULT(yes)
921           INT64_FORMAT='"%lld"'
922         ],
923   [ AC_MSG_RESULT(no)
924     AC_MSG_CHECKING(whether snprintf handles 'long long int' as %qd) 
925     AC_TRY_RUN([#include <stdio.h>
926 typedef long long int int64;
927 #define INT64_FORMAT "%qd"
928    
929 int64 a = 20000001;
930 int64 b = 40000005;
931    
932 int does_int64_snprintf_work()
933 {  
934   int64 c;
935   char buf[100];
936
937   if (sizeof(int64) != 8)
938     return 0;     /* doesn't look like the right size */
939
940   c = a * b;
941   snprintf(buf, 100, INT64_FORMAT, c);
942   if (strcmp(buf, "800000140000005") != 0)
943     return 0;     /* either multiply or snprintf is busted */
944   return 1;
945 }
946 main() {
947   exit(! does_int64_snprintf_work());
948 }],
949   [ AC_MSG_RESULT(yes)
950     INT64_FORMAT='"%qd"'
951   ],
952   [ AC_MSG_RESULT(no)
953         # Force usage of our own snprintf, since system snprintf is broken
954         SNPRINTF='snprintf.o'
955         INT64_FORMAT='"%lld"'
956   ],
957   [ AC_MSG_RESULT(assuming not on target machine)
958         # Force usage of our own snprintf, since we cannot test foreign snprintf
959         SNPRINTF='snprintf.o'
960         INT64_FORMAT='"%lld"'
961   ]) ],
962   [ AC_MSG_RESULT(assuming not on target machine)
963         # Force usage of our own snprintf, since we cannot test foreign snprintf
964         SNPRINTF='snprintf.o'
965         INT64_FORMAT='"%lld"'
966   ])
967   else
968     # here if we previously decided we needed to use our own snprintf
969     INT64_FORMAT='"%lld"'
970   fi
971 else
972   # Here if we are not using 'long long int' at all
973   INT64_FORMAT='"%ld"'
974 fi
975
976 AC_DEFINE_UNQUOTED(INT64_FORMAT, $INT64_FORMAT)
977
978
979 dnl Determine memory alignment requirements for the basic C datatypes.
980
981 dnl CHECK_ALIGNOF(TYPE)
982 dnl This is modeled on the standard autoconf macro AC_CHECK_SIZEOF,
983 dnl except it finds the alignment requirement of the type instead of the size.
984 dnl The defined symbol is named ALIGNOF_TYPE, where the type name is
985 dnl converted in the same way as for AC_CHECK_SIZEOF.
986 dnl If cross-compiling, sizeof(type) is used as a default assumption.
987
988 AC_DEFUN(CHECK_ALIGNOF,
989 [changequote(<<, >>)dnl
990 dnl The name to #define.
991 define(<<AC_TYPE_NAME>>, translit(alignof_$1, [a-z *], [A-Z_P]))dnl
992 dnl The cache variable name.
993 define(<<AC_CV_NAME>>, translit(ac_cv_alignof_$1, [ *], [_p]))dnl
994 changequote([, ])dnl
995 AC_MSG_CHECKING(alignment of $1)
996 AC_CACHE_VAL(AC_CV_NAME,
997 [AC_TRY_RUN([#include <stdio.h>
998 struct { char filler; $1 field; } mystruct;
999 main()
1000 {
1001   FILE *f=fopen("conftestval", "w");
1002   if (!f) exit(1);
1003   fprintf(f, "%d\n", ((char*) & mystruct.field) - ((char*) & mystruct));
1004   exit(0);
1005 }], AC_CV_NAME=`cat conftestval`,
1006 AC_CV_NAME='sizeof($1)',
1007 AC_CV_NAME='sizeof($1)')])dnl
1008 AC_MSG_RESULT($AC_CV_NAME)
1009 AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
1010 undefine([AC_TYPE_NAME])dnl
1011 undefine([AC_CV_NAME])dnl
1012 ])
1013
1014 CHECK_ALIGNOF(short)
1015 CHECK_ALIGNOF(int)
1016 CHECK_ALIGNOF(long)
1017 if [[ $HAVE_LONG_LONG_INT_64 -eq 1 ]] ; then
1018   CHECK_ALIGNOF(long long int)
1019 fi
1020 CHECK_ALIGNOF(double)
1021
1022 dnl Compute maximum alignment of any basic type.
1023 dnl We assume long's alignment is at least as strong as char, short, or int;
1024 dnl but we must check long long (if it exists) and double.
1025
1026 if [[ $ac_cv_alignof_double != 'sizeof(double)' ]] ; then
1027   MAX_ALIGNOF="$ac_cv_alignof_long"
1028   if [[ $MAX_ALIGNOF -lt $ac_cv_alignof_double ]] ; then
1029     MAX_ALIGNOF="$ac_cv_alignof_double"
1030   fi
1031   if [[ $HAVE_LONG_LONG_INT_64 -eq 1 ]] ; then
1032     if [[ $MAX_ALIGNOF -lt $ac_cv_alignof_long_long_int ]] ; then
1033       MAX_ALIGNOF="$ac_cv_alignof_long_long_int"
1034     fi
1035   fi
1036 else
1037   dnl cross-compiling: assume that double's alignment is worst case
1038   MAX_ALIGNOF="$ac_cv_alignof_double"
1039 fi
1040 AC_DEFINE_UNQUOTED(MAXIMUM_ALIGNOF, $MAX_ALIGNOF)
1041
1042
1043 dnl Check to see if platform has POSIX signal interface.
1044 dnl NOTE: if this test fails then POSIX signals definitely don't work.
1045 dnl It could be that the test compiles but the POSIX routines don't
1046 dnl really work ... in that case the platform-specific port files
1047 dnl can unset USE_POSIX_SIGNALS and HAVE_POSIX_SIGNALS.  (The former
1048 dnl goes into config.h, the latter into Makefile.global.)
1049
1050 AC_MSG_CHECKING(for POSIX signal interface)
1051 AC_TRY_LINK([#include <signal.h>],
1052 [struct sigaction act, oact;
1053 sigemptyset(&act.sa_mask);
1054 act.sa_flags = SA_RESTART;
1055 sigaction(0, &act, &oact);],
1056 [AC_DEFINE(USE_POSIX_SIGNALS)
1057 HAVE_POSIX_SIGNALS="1"
1058 AC_MSG_RESULT(yes)],
1059 [HAVE_POSIX_SIGNALS=""
1060 AC_MSG_RESULT(no)])
1061 AC_SUBST(HAVE_POSIX_SIGNALS)
1062
1063 dnl Check for Tcl configuration script tclConfig.sh
1064
1065 dnl If --with-tclconfig was given, don't check for tclsh, tcl
1066 if test -z "$TCL_DIRS"
1067 then
1068         AC_PATH_PROG(TCLSH, tclsh)
1069         if test -z "$TCLSH"
1070         then
1071                 AC_PATH_PROG(TCLSH, tcl)
1072                 if test -z "$TCLSH"
1073                 then
1074                         AC_MSG_WARN(TCL/TK support disabled; tcl shell is not in your path)
1075                         USE_TCL=
1076                 fi
1077         fi
1078 fi
1079         
1080 if test "$USE_TCL" = true
1081 then
1082         AC_MSG_CHECKING(for tclConfig.sh)
1083         TCL_CONFIG_SH=
1084         library_dirs=
1085         if test -z "$TCL_DIRS"
1086         then
1087                 library_dirs=`echo 'puts $auto_path' | $TCLSH`
1088         fi
1089         library_dirs="$TCL_DIRS $TK_DIRS $library_dirs"
1090         for dir in $library_dirs; do
1091                 if test -d "$dir" -a -r "$dir/tclConfig.sh"; then
1092                         TCL_CONFIG_SH=$dir/tclConfig.sh
1093                         break
1094                 fi
1095         done
1096         if test -z "$TCL_CONFIG_SH"; then
1097                 AC_MSG_RESULT(no)
1098                 AC_MSG_WARN(TCL/TK support disabled; Tcl configuration script missing)
1099                 USE_TCL=
1100         else
1101                 AC_MSG_RESULT($TCL_CONFIG_SH)
1102                 AC_SUBST(TCL_CONFIG_SH)
1103         fi
1104 fi
1105
1106 USE_TK=$USE_TCL         # If TCL is disabled, disable TK
1107
1108 dnl Check for Tk configuration script tkConfig.sh
1109 if test "$USE_TK" = true
1110 then
1111         AC_MSG_CHECKING(for tkConfig.sh)
1112         TK_CONFIG_SH=
1113         # library_dirs are set in the check for TCL
1114         for dir in $library_dirs
1115         do
1116                 if test -d "$dir" -a -r "$dir/tkConfig.sh"
1117                 then
1118                         TK_CONFIG_SH=$dir/tkConfig.sh
1119                         break
1120                 fi
1121         done
1122         if test -z "$TK_CONFIG_SH"
1123         then
1124                 AC_MSG_RESULT(no)
1125                 AC_MSG_WARN(TK support disabled; Tk configuration script missing)
1126                 USE_TK=
1127         else
1128                 AC_MSG_RESULT($TK_CONFIG_SH)
1129                 AC_SUBST(TK_CONFIG_SH)
1130                 AC_PATH_PROG(WISH, wish)
1131         fi
1132 fi
1133
1134 USE_X=$USE_TK
1135
1136 dnl Check for X libraries
1137
1138 if test "$USE_X" = true; then
1139
1140         ice_save_LIBS="$LIBS"
1141         ice_save_CFLAGS="$CFLAGS"
1142         ice_save_CPPFLAGS="$CPPFLAGS"
1143         ice_save_LDFLAGS="$LDFLAGS"
1144
1145         AC_PATH_XTRA
1146
1147         LIBS="$LIBS $X_EXTRA_LIBS"
1148         CFLAGS="$CFLAGS $X_CFLAGS"
1149         CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1150         LDFLAGS="$LDFLAGS $X_LIBS"
1151
1152         dnl Check for X library
1153
1154         X11_LIBS=""
1155         AC_CHECK_LIB(X11, XOpenDisplay, X11_LIBS="-lX11",,${X_PRE_LIBS})
1156         if test "$X11_LIBS" = ""; then
1157                 dnl Not having X is bad news for pgtksh. Let the user fix this.
1158                 AC_MSG_WARN([The X11 library '-lX11' could not be found,
1159 so TK support will be disabled.  To enable TK support,
1160 please use the configure options '--x-includes=DIR'
1161 and '--x-libraries=DIR' to specify the X location.
1162 See the file 'config.log' for further diagnostics.])
1163                 USE_TK=
1164         fi
1165         AC_SUBST(X_LIBS)
1166         AC_SUBST(X11_LIBS)
1167         AC_SUBST(X_PRE_LIBS)
1168
1169         LIBS="$ice_save_LIBS"
1170         CFLAGS="$ice_save_CFLAGS"
1171         CPPFLAGS="$ice_save_CPPFLAGS"
1172         LDFLAGS="$ice_save_LDFLAGS"
1173 fi
1174
1175 dnl cause configure to recurse into subdirectories with their own configure
1176 dnl Darn, setting AC_CONFIG_SUBDIRS sets a list $subdirs$ in the configure output
1177 dnl  file, but then configure doesn't bother using that list. Probably a bug in
1178 dnl  this version of autoconf.
1179 dnl So at the moment interfaces/odbc gets configured unconditionally.
1180 dnl - thomas 1998-10-05
1181 #if test "X$USE_ODBC" = "Xtrue"
1182 #then
1183 #       AC_CONFIG_SUBDIRS(interfaces/odbc)
1184 #fi
1185 if test "$USE_ODBC" = "true"
1186 then
1187         PWD_INCDIR=no
1188         AC_CHECK_HEADER(pwd.h, PWD_INCDIR=yes)
1189         if test "$PWD_INCDIR" = "no"; then
1190                 AC_MSG_WARN(odbc support disabled; pwd.h missing)
1191                 USE_ODBC=
1192         fi
1193         AC_SUBST(USE_ODBC)
1194 fi
1195
1196 dnl Output files that are neither makefiles nor shell scripts probably
1197 dnl need fully-expanded substitutions, rather than partial expansions
1198 dnl that include references to other variables.  Currently the only
1199 dnl such item that's needed is an expanded version of libdir, but
1200 dnl others may be needed someday.  NOTE: 'eval' technique only copes
1201 dnl with one level of indirect reference per expansion; two levels is
1202 dnl currently enough for libdir, but it's ugly...
1203
1204 dnl First we have to force 'NONE' prefix to be expanded itself.
1205 dnl For some reason, autoconf 2.13 doesn't do this until AC_OUTPUT,
1206 dnl which is too late...
1207 test "x$prefix" = xNONE && prefix=$ac_default_prefix
1208 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
1209
1210 eval expanded_libdir="$libdir"
1211 eval expanded_libdir="$expanded_libdir"
1212 AC_SUBST(expanded_libdir)
1213
1214 dnl Finally ready to produce output files ...
1215
1216 AC_OUTPUT(
1217         GNUmakefile
1218         Makefile.global
1219         backend/port/Makefile
1220         backend/catalog/genbki.sh
1221         backend/utils/Gen_fmgrtab.sh
1222         bin/pg_dump/Makefile
1223         bin/pg_version/Makefile
1224         bin/pgtclsh/mkMakefile.tcldefs.sh
1225         bin/pgtclsh/mkMakefile.tkdefs.sh
1226         bin/psql/Makefile
1227         include/version.h
1228         interfaces/libpq/Makefile
1229         interfaces/ecpg/lib/Makefile
1230         interfaces/libpq++/Makefile
1231         interfaces/libpgeasy/Makefile
1232         interfaces/libpgtcl/Makefile
1233         interfaces/odbc/GNUmakefile
1234         interfaces/odbc/Makefile.global
1235         pl/plpgsql/src/Makefile
1236         pl/plpgsql/src/mklang.sql
1237         pl/tcl/mkMakefile.tcldefs.sh
1238 )