]> granicus.if.org Git - postgresql/blob - src/configure.in
Update pgaccess
[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(history,  main)
587 AC_CHECK_LIB(readline, main)
588 AC_CHECK_LIB(readline, write_history, AC_DEFINE(HAVE_HISTORY))
589 if test "$PORTNAME" != "aix" -a "$PORTNAME" != "alpha"
590 then
591         AC_CHECK_LIB(bsd,      main)
592 fi
593 AC_CHECK_LIB(m,        main)
594 AC_CHECK_LIB(dl,       main)
595 AC_CHECK_LIB(socket,   main)
596 AC_CHECK_LIB(nsl,      main)
597 AC_CHECK_LIB(ipc,      main)
598 AC_CHECK_LIB(IPC,      main)
599 AC_CHECK_LIB(lc,       main)
600 AC_CHECK_LIB(dld,      main)
601 AC_CHECK_LIB(ln,       main)
602 AC_CHECK_LIB(ld,       main)
603 AC_CHECK_LIB(compat,   main)
604 AC_CHECK_LIB(BSD,      main)
605 AC_CHECK_LIB(crypt,    main)
606 AC_CHECK_LIB(gen,      main)
607 AC_CHECK_LIB(PW,       main)
608
609 dnl Checks for header files.
610 AC_HEADER_STDC
611 AC_HEADER_SYS_WAIT
612 AC_CHECK_HEADERS(arpa/inet.h)
613 AC_CHECK_HEADERS(crypt.h)
614 AC_CHECK_HEADERS(dld.h)
615 AC_CHECK_HEADERS(endian.h)
616 AC_CHECK_HEADERS(float.h)
617 AC_CHECK_HEADERS(fp_class.h)
618 AC_CHECK_HEADERS(getopt.h)
619 AC_CHECK_HEADERS(history.h)
620 AC_CHECK_HEADERS(ieeefp.h)
621 AC_CHECK_HEADERS(limits.h)
622 AC_CHECK_HEADERS(netdb.h)
623 AC_CHECK_HEADERS(netinet/in.h)
624 AC_CHECK_HEADERS(readline.h)
625 AC_CHECK_HEADERS(readline/history.h)
626 AC_CHECK_HEADERS(readline/readline.h)
627 AC_CHECK_HEADERS(sys/select.h)
628 AC_CHECK_HEADERS(termios.h)
629 AC_CHECK_HEADERS(unistd.h)
630 AC_CHECK_HEADERS(values.h)
631 dnl ODBC headers...
632 AC_CHECK_HEADERS(sys/param.h pwd.h)
633 dnl
634
635 dnl Checks for typedefs, structures, and compiler characteristics.
636 AC_C_CONST
637 AC_C_INLINE
638 AC_C_STRINGIZE
639 AC_TYPE_UID_T
640 AC_TYPE_MODE_T
641 AC_TYPE_OFF_T
642 AC_TYPE_SIZE_T
643 AC_HEADER_TIME
644 AC_STRUCT_TM
645 AC_STRUCT_TIMEZONE
646
647 AC_MSG_CHECKING(for signed types)
648 AC_TRY_COMPILE([],
649 [signed char c; signed short s; signed int i;],
650 [AC_MSG_RESULT(yes)],
651 [AC_DEFINE(signed, ) AC_MSG_RESULT(no)])
652
653 AC_MSG_CHECKING(for volatile)
654 AC_TRY_COMPILE([],
655 [extern volatile int i;],
656 [AC_MSG_RESULT(yes)],
657 [AC_DEFINE(volatile, ) AC_MSG_RESULT(no)])
658
659 AC_MSG_CHECKING(for type of last arg to accept)
660 AC_TRY_COMPILE([#include <stdlib.h>
661 #include <sys/types.h>
662 #include <sys/socket.h>
663 ],
664 [int a = accept(1, (struct sockaddr *) 0, (size_t *) 0);],
665 [AC_DEFINE(SOCKET_SIZE_TYPE, size_t) AC_MSG_RESULT(size_t)],
666 [AC_DEFINE(SOCKET_SIZE_TYPE, int) AC_MSG_RESULT(int)])
667
668 dnl Check for any "odd" conditions
669 AC_MSG_CHECKING(for int timezone)
670 AC_TRY_LINK([#include <time.h>],
671             [int res = timezone / 60; ],
672             [AC_DEFINE(HAVE_INT_TIMEZONE) AC_MSG_RESULT(yes)],
673             AC_MSG_RESULT(no))
674
675 AC_MSG_CHECKING(for gettimeofday args)
676 AC_TRY_LINK([#include <sys/time.h>],
677             [struct timeval *tp; struct timezone *tzp; gettimeofday(tp,tzp); ],
678             [AC_DEFINE(HAVE_GETTIMEOFDAY_2_ARGS) AC_MSG_RESULT(2 args)],
679             AC_MSG_RESULT(no))
680
681 AC_MSG_CHECKING(for union semun)
682 AC_TRY_LINK([#include <sys/types.h>
683 #include <sys/ipc.h>
684 #include <sys/sem.h>],
685             [union semun semun;],
686             [AC_DEFINE(HAVE_UNION_SEMUN) AC_MSG_RESULT(yes)],
687             AC_MSG_RESULT(no))
688
689 AC_MSG_CHECKING(for fcntl(F_SETLK))
690 AC_TRY_LINK([#include <fcntl.h>],
691             [struct flock lck;
692              lck.l_whence = SEEK_SET; lck.l_start = lck.l_len = 0;
693              lck.l_type = F_WRLCK;
694              fcntl(0, F_SETLK, &lck);],
695             [AC_DEFINE(HAVE_FCNTL_SETLK) AC_MSG_RESULT(yes)],
696             AC_MSG_RESULT(no))
697
698 dnl Checks for library functions.
699 AC_FUNC_MEMCMP
700 AC_TYPE_SIGNAL
701 AC_FUNC_VPRINTF
702 AC_CHECK_FUNCS(memmove sigsetjmp sysconf)
703 AC_CHECK_FUNCS(sigprocmask waitpid setsid fcvt)
704 AC_CHECK_FUNCS(fpclass fp_class fp_class_d class)
705 dnl We use our snprintf.c emulation if either snprintf() or vsnprintf()
706 dnl is missing.  Yes, there are machines that have only one.
707 dnl We may also decide to use snprintf.c if snprintf() is present but does
708 dnl not have working "long long int" support -- see below.
709 SNPRINTF=''
710 AC_CHECK_FUNC(snprintf,
711               AC_DEFINE(HAVE_SNPRINTF),
712               SNPRINTF='snprintf.o')
713 AC_CHECK_FUNC(vsnprintf,
714               AC_DEFINE(HAVE_VSNPRINTF),
715               SNPRINTF='snprintf.o')
716 AC_SUBST(SNPRINTF)
717 dnl do this one the hard way in case isinf() is a macro
718 AC_MSG_CHECKING(for isinf)
719 AC_CACHE_VAL(ac_cv_func_or_macro_isinf,
720 [AC_TRY_LINK(
721 [#include <math.h>],
722 [double x = 0.0; int res = isinf(x);],
723 [ac_cv_func_or_macro_isinf=yes],
724 [ac_cv_func_or_macro_isinf=no])])
725 if [[ $ac_cv_func_or_macro_isinf = yes ]]; then
726   AC_MSG_RESULT(yes)
727   AC_DEFINE(HAVE_ISINF)
728   ISINF=''
729 else
730   AC_MSG_RESULT(no)
731   ISINF='isinf.o'
732 fi
733 AC_SUBST(ISINF)
734 AC_CHECK_FUNC(getrusage,
735               AC_DEFINE(HAVE_GETRUSAGE),
736               GETRUSAGE='getrusage.o')
737 AC_SUBST(GETRUSAGE)
738 AC_CHECK_FUNC(srandom,
739               AC_DEFINE(HAVE_SRANDOM),
740               SRANDOM='srandom.o')
741 AC_SUBST(SRANDOM)
742 AC_CHECK_FUNC(gethostname,
743               AC_DEFINE(HAVE_GETHOSTNAME),
744               GETHOSTNAME='gethostname.o')
745 AC_SUBST(GETHOSTNAME)
746 AC_CHECK_FUNC(random,
747               AC_DEFINE(HAVE_RANDOM),
748               MISSING_RANDOM='random.o')
749 AC_SUBST(MISSING_RANDOM)
750 AC_CHECK_FUNC(inet_aton,
751               AC_DEFINE(HAVE_INET_ATON),
752               INET_ATON='inet_aton.o')
753 AC_SUBST(INET_ATON)
754 AC_CHECK_FUNC(strerror,
755               AC_DEFINE(HAVE_STRERROR),
756               [STRERROR='strerror.o' STRERROR2='../../backend/port/strerror.o'])
757 AC_SUBST(STRERROR)
758 AC_SUBST(STRERROR2)
759 AC_CHECK_FUNC(strdup,
760               AC_DEFINE(HAVE_STRDUP),
761               STRDUP='../../utils/strdup.o')
762 AC_SUBST(STRDUP)
763 AC_CHECK_FUNC(strtol,
764               AC_DEFINE(HAVE_STRTOL),
765               STRTOL='strtol.o')
766 AC_SUBST(STRTOL)
767 AC_CHECK_FUNC(strtoul,
768               AC_DEFINE(HAVE_STRTOUL),
769               STRTOL='strtoul.o')
770 AC_SUBST(STRTOUL)
771 AC_CHECK_FUNC(strcasecmp,
772               AC_DEFINE(HAVE_STRCASECMP),
773               STRCASECMP='strcasecmp.o')
774 AC_SUBST(STRCASECMP)
775 AC_CHECK_FUNC(cbrt,
776               AC_DEFINE(HAVE_CBRT),
777               AC_CHECK_LIB(m, cbrt, AC_DEFINE(HAVE_CBRT)))
778
779 # On HPUX 9, rint() is not in regular libm.a but in /lib/pa1.1/libm.a;
780 # this hackery with HPUXMATHLIB allows us to cope.
781 HPUXMATHLIB=""
782 case "$host_cpu" in
783   hppa1.1) 
784         if [[ -r /lib/pa1.1/libm.a ]] ; then
785             HPUXMATHLIB="-L /lib/pa1.1 -lm"
786         fi ;;
787 esac
788 AC_SUBST(HPUXMATHLIB)
789
790 AC_CHECK_FUNC(rint,
791               AC_DEFINE(HAVE_RINT),
792               AC_CHECK_LIB(m, rint, AC_DEFINE(HAVE_RINT), , $HPUXMATHLIB))
793
794 AC_MSG_CHECKING(for finite() macro or function)
795 AC_TRY_LINK([#include <math.h>],
796         [int dummy=finite(1.0);],
797         [AC_DEFINE(HAVE_FINITE) AC_MSG_RESULT(yes)],
798         AC_MSG_RESULT(no))
799
800 dnl Check to see if we have a working 64-bit integer type.
801 dnl This breaks down into two steps:
802 dnl (1) figure out if the compiler has a 64-bit int type with working
803 dnl arithmetic, and if so
804 dnl (2) see whether snprintf() can format the type correctly.  (Currently,
805 dnl snprintf is the only library routine we really need for int8 support.)
806 dnl It's entirely possible to have a compiler that handles a 64-bit type
807 dnl when the C library doesn't; this is fairly likely when using gcc on
808 dnl an older platform, for example.
809 dnl If there is no native snprintf() or it does not handle the 64-bit type,
810 dnl we force our own version of snprintf() to be used instead.
811 dnl Note this test must be run after our initial check for snprintf/vsnprintf.
812
813 HAVE_LONG_INT_64=0
814 AC_MSG_CHECKING(whether 'long int' is 64 bits)
815 AC_TRY_RUN([typedef long int int64;
816
817 /* These are globals to discourage the compiler from folding all the
818  * arithmetic tests down to compile-time constants.
819  */
820 int64 a = 20000001;
821 int64 b = 40000005;
822
823 int does_int64_work()
824 {
825   int64 c,d;
826
827   if (sizeof(int64) != 8)
828     return 0;                   /* doesn't look like the right size */
829
830   /* Do perfunctory checks to see if 64-bit arithmetic seems to work */
831   c = a * b;
832   d = (c + b) / b;
833   if (d != a+1)
834     return 0;
835   return 1;
836 }
837 main() {
838   exit(! does_int64_work());
839 }],
840         [HAVE_LONG_INT_64=1
841          AC_DEFINE(HAVE_LONG_INT_64)
842          AC_MSG_RESULT(yes)],
843         AC_MSG_RESULT(no),
844         AC_MSG_RESULT(assuming not on target machine))
845
846 HAVE_LONG_LONG_INT_64=0
847 if [[ $HAVE_LONG_INT_64 -eq 0 ]] ; then
848 AC_MSG_CHECKING(whether 'long long int' is 64 bits)
849 AC_TRY_RUN([typedef long long int int64;
850
851 /* These are globals to discourage the compiler from folding all the
852  * arithmetic tests down to compile-time constants.
853  */
854 int64 a = 20000001;
855 int64 b = 40000005;
856
857 int does_int64_work()
858 {
859   int64 c,d;
860
861   if (sizeof(int64) != 8)
862     return 0;                   /* doesn't look like the right size */
863
864   /* Do perfunctory checks to see if 64-bit arithmetic seems to work */
865   c = a * b;
866   d = (c + b) / b;
867   if (d != a+1)
868     return 0;
869   return 1;
870 }
871 main() {
872   exit(! does_int64_work());
873 }],
874         [HAVE_LONG_LONG_INT_64=1
875          AC_DEFINE(HAVE_LONG_LONG_INT_64)
876          AC_MSG_RESULT(yes)],
877         AC_MSG_RESULT(no),
878         AC_MSG_RESULT(assuming not on target machine))
879 fi
880
881 dnl If we found "long int" is 64 bits, assume snprintf handles it.
882 dnl If we found we need to use "long long int", better check.
883 dnl We cope with snprintfs that use either %lld or %qd as the format.
884 dnl If neither works, fall back to our own snprintf emulation (which we
885 dnl know uses %lld).
886
887 if [[ $HAVE_LONG_LONG_INT_64 -eq 1 ]] ; then
888   if [[ x$SNPRINTF = x ]] ; then
889     AC_MSG_CHECKING(whether snprintf handles 'long long int' as %lld)
890     AC_TRY_RUN([#include <stdio.h>
891 typedef long long int int64;
892 #define INT64_FORMAT "%lld"
893
894 int64 a = 20000001;
895 int64 b = 40000005;
896
897 int does_int64_snprintf_work()
898 {
899   int64 c;
900   char buf[100];
901
902   if (sizeof(int64) != 8)
903     return 0;                   /* doesn't look like the right size */
904
905   c = a * b;
906   snprintf(buf, 100, INT64_FORMAT, c);
907   if (strcmp(buf, "800000140000005") != 0)
908     return 0;                   /* either multiply or snprintf is busted */
909   return 1;
910 }
911 main() {
912   exit(! does_int64_snprintf_work());
913 }],
914         [ AC_MSG_RESULT(yes)
915           INT64_FORMAT='"%lld"'
916         ],
917   [ AC_MSG_RESULT(no)
918     AC_MSG_CHECKING(whether snprintf handles 'long long int' as %qd) 
919     AC_TRY_RUN([#include <stdio.h>
920 typedef long long int int64;
921 #define INT64_FORMAT "%qd"
922    
923 int64 a = 20000001;
924 int64 b = 40000005;
925    
926 int does_int64_snprintf_work()
927 {  
928   int64 c;
929   char buf[100];
930
931   if (sizeof(int64) != 8)
932     return 0;     /* doesn't look like the right size */
933
934   c = a * b;
935   snprintf(buf, 100, INT64_FORMAT, c);
936   if (strcmp(buf, "800000140000005") != 0)
937     return 0;     /* either multiply or snprintf is busted */
938   return 1;
939 }
940 main() {
941   exit(! does_int64_snprintf_work());
942 }],
943   [ AC_MSG_RESULT(yes)
944     INT64_FORMAT='"%qd"'
945   ],
946   [ AC_MSG_RESULT(no)
947         # Force usage of our own snprintf, since system snprintf is broken
948         SNPRINTF='snprintf.o'
949         INT64_FORMAT='"%lld"'
950   ],
951   [ AC_MSG_RESULT(assuming not on target machine)
952         # Force usage of our own snprintf, since we cannot test foreign snprintf
953         SNPRINTF='snprintf.o'
954         INT64_FORMAT='"%lld"'
955   ]) ],
956   [ AC_MSG_RESULT(assuming not on target machine)
957         # Force usage of our own snprintf, since we cannot test foreign snprintf
958         SNPRINTF='snprintf.o'
959         INT64_FORMAT='"%lld"'
960   ])
961   else
962     # here if we previously decided we needed to use our own snprintf
963     INT64_FORMAT='"%lld"'
964   fi
965 else
966   # Here if we are not using 'long long int' at all
967   INT64_FORMAT='"%ld"'
968 fi
969
970 AC_DEFINE_UNQUOTED(INT64_FORMAT, $INT64_FORMAT)
971
972
973 dnl Determine memory alignment requirements for the basic C datatypes.
974
975 dnl CHECK_ALIGNOF(TYPE)
976 dnl This is modeled on the standard autoconf macro AC_CHECK_SIZEOF,
977 dnl except it finds the alignment requirement of the type instead of the size.
978 dnl The defined symbol is named ALIGNOF_TYPE, where the type name is
979 dnl converted in the same way as for AC_CHECK_SIZEOF.
980 dnl If cross-compiling, sizeof(type) is used as a default assumption.
981
982 AC_DEFUN(CHECK_ALIGNOF,
983 [changequote(<<, >>)dnl
984 dnl The name to #define.
985 define(<<AC_TYPE_NAME>>, translit(alignof_$1, [a-z *], [A-Z_P]))dnl
986 dnl The cache variable name.
987 define(<<AC_CV_NAME>>, translit(ac_cv_alignof_$1, [ *], [_p]))dnl
988 changequote([, ])dnl
989 AC_MSG_CHECKING(alignment of $1)
990 AC_CACHE_VAL(AC_CV_NAME,
991 [AC_TRY_RUN([#include <stdio.h>
992 struct { char filler; $1 field; } mystruct;
993 main()
994 {
995   FILE *f=fopen("conftestval", "w");
996   if (!f) exit(1);
997   fprintf(f, "%d\n", ((char*) & mystruct.field) - ((char*) & mystruct));
998   exit(0);
999 }], AC_CV_NAME=`cat conftestval`,
1000 AC_CV_NAME='sizeof($1)',
1001 AC_CV_NAME='sizeof($1)')])dnl
1002 AC_MSG_RESULT($AC_CV_NAME)
1003 AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
1004 undefine([AC_TYPE_NAME])dnl
1005 undefine([AC_CV_NAME])dnl
1006 ])
1007
1008 CHECK_ALIGNOF(short)
1009 CHECK_ALIGNOF(int)
1010 CHECK_ALIGNOF(long)
1011 if [[ $HAVE_LONG_LONG_INT_64 -eq 1 ]] ; then
1012   CHECK_ALIGNOF(long long int)
1013 fi
1014 CHECK_ALIGNOF(double)
1015
1016 dnl Compute maximum alignment of any basic type.
1017 dnl We assume long's alignment is at least as strong as char, short, or int;
1018 dnl but we must check long long (if it exists) and double.
1019
1020 if [[ $ac_cv_alignof_double != 'sizeof(double)' ]] ; then
1021   MAX_ALIGNOF="$ac_cv_alignof_long"
1022   if [[ $MAX_ALIGNOF -lt $ac_cv_alignof_double ]] ; then
1023     MAX_ALIGNOF="$ac_cv_alignof_double"
1024   fi
1025   if [[ $HAVE_LONG_LONG_INT_64 -eq 1 ]] ; then
1026     if [[ $MAX_ALIGNOF -lt $ac_cv_alignof_long_long_int ]] ; then
1027       MAX_ALIGNOF="$ac_cv_alignof_long_long_int"
1028     fi
1029   fi
1030 else
1031   dnl cross-compiling: assume that double's alignment is worst case
1032   MAX_ALIGNOF="$ac_cv_alignof_double"
1033 fi
1034 AC_DEFINE_UNQUOTED(MAXIMUM_ALIGNOF, $MAX_ALIGNOF)
1035
1036
1037 dnl Check to see if platform has POSIX signal interface.
1038 dnl NOTE: if this test fails then POSIX signals definitely don't work.
1039 dnl It could be that the test compiles but the POSIX routines don't
1040 dnl really work ... in that case the platform-specific port files
1041 dnl can unset USE_POSIX_SIGNALS and HAVE_POSIX_SIGNALS.  (The former
1042 dnl goes into config.h, the latter into Makefile.global.)
1043
1044 AC_MSG_CHECKING(for POSIX signal interface)
1045 AC_TRY_LINK([#include <signal.h>],
1046 [struct sigaction act, oact;
1047 sigemptyset(&act.sa_mask);
1048 act.sa_flags = SA_RESTART;
1049 sigaction(0, &act, &oact);],
1050 [AC_DEFINE(USE_POSIX_SIGNALS)
1051 HAVE_POSIX_SIGNALS="1"
1052 AC_MSG_RESULT(yes)],
1053 [HAVE_POSIX_SIGNALS=""
1054 AC_MSG_RESULT(no)])
1055 AC_SUBST(HAVE_POSIX_SIGNALS)
1056
1057 dnl Check for Tcl configuration script tclConfig.sh
1058
1059 dnl If --with-tclconfig was given, don't check for tclsh, tcl
1060 if test -z "$TCL_DIRS"
1061 then
1062         AC_PATH_PROG(TCLSH, tclsh)
1063         if test -z "$TCLSH"
1064         then
1065                 AC_PATH_PROG(TCLSH, tcl)
1066                 if test -z "$TCLSH"
1067                 then
1068                         AC_MSG_WARN(TCL/TK support disabled; tcl shell is not in your path)
1069                         USE_TCL=
1070                 fi
1071         fi
1072 fi
1073         
1074 if test "$USE_TCL" = true
1075 then
1076         AC_MSG_CHECKING(for tclConfig.sh)
1077         TCL_CONFIG_SH=
1078         library_dirs=
1079         if test -z "$TCL_DIRS"
1080         then
1081                 library_dirs=`echo 'puts $auto_path' | $TCLSH`
1082         fi
1083         library_dirs="$TCL_DIRS $TK_DIRS $library_dirs"
1084         for dir in $library_dirs; do
1085                 if test -d "$dir" -a -r "$dir/tclConfig.sh"; then
1086                         TCL_CONFIG_SH=$dir/tclConfig.sh
1087                         break
1088                 fi
1089         done
1090         if test -z "$TCL_CONFIG_SH"; then
1091                 AC_MSG_RESULT(no)
1092                 AC_MSG_WARN(TCL/TK support disabled; Tcl configuration script missing)
1093                 USE_TCL=
1094         else
1095                 AC_MSG_RESULT($TCL_CONFIG_SH)
1096                 AC_SUBST(TCL_CONFIG_SH)
1097         fi
1098 fi
1099
1100 USE_TK=$USE_TCL         # If TCL is disabled, disable TK
1101
1102 dnl Check for Tk configuration script tkConfig.sh
1103 if test "$USE_TK" = true
1104 then
1105         AC_MSG_CHECKING(for tkConfig.sh)
1106         TK_CONFIG_SH=
1107         # library_dirs are set in the check for TCL
1108         for dir in $library_dirs
1109         do
1110                 if test -d "$dir" -a -r "$dir/tkConfig.sh"
1111                 then
1112                         TK_CONFIG_SH=$dir/tkConfig.sh
1113                         break
1114                 fi
1115         done
1116         if test -z "$TK_CONFIG_SH"
1117         then
1118                 AC_MSG_RESULT(no)
1119                 AC_MSG_WARN(TK support disabled; Tk configuration script missing)
1120                 USE_TK=
1121         else
1122                 AC_MSG_RESULT($TK_CONFIG_SH)
1123                 AC_SUBST(TK_CONFIG_SH)
1124                 AC_PATH_PROG(WISH, wish)
1125         fi
1126 fi
1127
1128 USE_X=$USE_TK
1129
1130 dnl Check for X libraries
1131
1132 if test "$USE_X" = true; then
1133
1134         ice_save_LIBS="$LIBS"
1135         ice_save_CFLAGS="$CFLAGS"
1136         ice_save_CPPFLAGS="$CPPFLAGS"
1137         ice_save_LDFLAGS="$LDFLAGS"
1138
1139         AC_PATH_XTRA
1140
1141         LIBS="$LIBS $X_EXTRA_LIBS"
1142         CFLAGS="$CFLAGS $X_CFLAGS"
1143         CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1144         LDFLAGS="$LDFLAGS $X_LIBS"
1145
1146         dnl Check for X library
1147
1148         X11_LIBS=""
1149         AC_CHECK_LIB(X11, XOpenDisplay, X11_LIBS="-lX11",,${X_PRE_LIBS})
1150         if test "$X11_LIBS" = ""; then
1151                 dnl Not having X is bad news for pgtksh. Let the user fix this.
1152                 AC_MSG_WARN([The X11 library '-lX11' could not be found,
1153 so TK support will be disabled.  To enable TK support,
1154 please use the configure options '--x-includes=DIR'
1155 and '--x-libraries=DIR' to specify the X location.
1156 See the file 'config.log' for further diagnostics.])
1157                 USE_TK=
1158         fi
1159         AC_SUBST(X_LIBS)
1160         AC_SUBST(X11_LIBS)
1161         AC_SUBST(X_PRE_LIBS)
1162
1163         LIBS="$ice_save_LIBS"
1164         CFLAGS="$ice_save_CFLAGS"
1165         CPPFLAGS="$ice_save_CPPFLAGS"
1166         LDFLAGS="$ice_save_LDFLAGS"
1167 fi
1168
1169 dnl cause configure to recurse into subdirectories with their own configure
1170 dnl Darn, setting AC_CONFIG_SUBDIRS sets a list $subdirs$ in the configure output
1171 dnl  file, but then configure doesn't bother using that list. Probably a bug in
1172 dnl  this version of autoconf.
1173 dnl So at the moment interfaces/odbc gets configured unconditionally.
1174 dnl - thomas 1998-10-05
1175 #if test "X$USE_ODBC" = "Xtrue"
1176 #then
1177 #       AC_CONFIG_SUBDIRS(interfaces/odbc)
1178 #fi
1179 if test "$USE_ODBC" = "true"
1180 then
1181         PWD_INCDIR=no
1182         AC_CHECK_HEADER(pwd.h, PWD_INCDIR=yes)
1183         if test "$PWD_INCDIR" = "no"; then
1184                 AC_MSG_WARN(odbc support disabled; pwd.h missing)
1185                 USE_ODBC=
1186         fi
1187         AC_SUBST(USE_ODBC)
1188 fi
1189
1190 dnl Output files that are neither makefiles nor shell scripts probably
1191 dnl need fully-expanded substitutions, rather than partial expansions
1192 dnl that include references to other variables.  Currently the only
1193 dnl such item that's needed is an expanded version of libdir, but
1194 dnl others may be needed someday.  NOTE: 'eval' technique only copes
1195 dnl with one level of indirect reference per expansion; two levels is
1196 dnl currently enough for libdir, but it's ugly...
1197
1198 dnl First we have to force 'NONE' prefix to be expanded itself.
1199 dnl For some reason, autoconf 2.13 doesn't do this until AC_OUTPUT,
1200 dnl which is too late...
1201 test "x$prefix" = xNONE && prefix=$ac_default_prefix
1202 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
1203
1204 eval expanded_libdir="$libdir"
1205 eval expanded_libdir="$expanded_libdir"
1206 AC_SUBST(expanded_libdir)
1207
1208 dnl Finally ready to produce output files ...
1209
1210 AC_OUTPUT(
1211         GNUmakefile
1212         Makefile.global
1213         backend/port/Makefile
1214         backend/catalog/genbki.sh
1215         backend/utils/Gen_fmgrtab.sh
1216         bin/pg_dump/Makefile
1217         bin/pg_version/Makefile
1218         bin/pgtclsh/mkMakefile.tcldefs.sh
1219         bin/pgtclsh/mkMakefile.tkdefs.sh
1220         bin/psql/Makefile
1221         include/version.h
1222         interfaces/libpq/Makefile
1223         interfaces/ecpg/lib/Makefile
1224         interfaces/libpq++/Makefile
1225         interfaces/libpgeasy/Makefile
1226         interfaces/libpgtcl/Makefile
1227         interfaces/odbc/GNUmakefile
1228         interfaces/odbc/Makefile.global
1229         pl/plpgsql/src/Makefile
1230         pl/plpgsql/src/mklang.sql
1231         pl/tcl/mkMakefile.tcldefs.sh
1232 )