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