1 dnl aclocal.m4 generated automatically by aclocal 1.4
3 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
14 # Autoconf macros for configuring the build of Python extension modules
16 # $Header: /cvsroot/pgsql/aclocal.m4,v 1.2 2000/06/11 11:39:45 petere Exp $
21 # Look for Python and set the output variable `PYTHON'
22 # to `python' if found, empty otherwise.
23 AC_DEFUN([PGAC_PROG_PYTHON],
24 [AC_CHECK_PROG(PYTHON, python, python)])
29 # Finds the names of various install dirs and helper files
30 # necessary to build a Python extension module.
32 # It would be nice if we could check whether the current setup allows
33 # the build of the shared module. Future project.
34 AC_DEFUN([PGAC_PATH_PYTHONDIR],
35 [AC_REQUIRE([PGAC_PROG_PYTHON])
36 [if test "${PYTHON+set}" = set ; then
37 python_version=`${PYTHON} -c "import sys; print sys.version[:3]"`
38 python_prefix=`${PYTHON} -c "import sys; print sys.prefix"`
39 python_execprefix=`${PYTHON} -c "import sys; print sys.exec_prefix"`
40 python_configdir="${python_execprefix}/lib/python${python_version}/config"
41 python_moduledir="${python_prefix}/lib/python${python_version}"
42 python_extmakefile="${python_configdir}/Makefile.pre.in"]
44 AC_MSG_CHECKING(for Python extension makefile)
45 if test -f "${python_extmakefile}" ; then
50 [The Python extension makefile was expected at \`${python_extmakefile}\'
51 but does not exist. This means the Python module cannot be built automatically.])
54 AC_SUBST(python_version)
55 AC_SUBST(python_prefix)
56 AC_SUBST(python_execprefix)
57 AC_SUBST(python_configdir)
58 AC_SUBST(python_moduledir)
59 AC_SUBST(python_extmakefile)
61 AC_MSG_ERROR([Python not found])
62 fi])# PGAC_PATH_PYTHONDIR
64 # Macros to detect certain C++ features
65 # $Header: /cvsroot/pgsql/aclocal.m4,v 1.2 2000/06/11 11:39:45 petere Exp $
70 # Look for class `string'. First look for the <string> header. If this
71 # is found a <string> header then it's probably safe to assume that
72 # class string exists. If not, check to make sure that <string.h>
73 # defines class `string'.
74 AC_DEFUN([PGAC_CLASS_STRING],
77 AC_CHECK_HEADER(string,
78 [AC_DEFINE(HAVE_CXX_STRING_HEADER)])
80 if test x"$ac_cv_header_string" != xyes ; then
81 AC_CACHE_CHECK([for class string in <string.h>],
82 [pgac_cv_class_string_in_string_h],
83 [AC_TRY_COMPILE([#include <stdio.h>
87 [string foo = "test"],
88 [pgac_cv_class_string_in_string_h=yes],
89 [pgac_cv_class_string_in_string_h=no])])
91 if test x"$pgac_cv_class_string_in_string_h" != xyes ; then
92 AC_MSG_ERROR([neither <string> nor <string.h> seem to define the C++ class \`string\'])
95 AC_LANG_RESTORE])# PGAC_CLASS_STRING
98 # PGAC_CXX_NAMESPACE_STD
99 # ----------------------
100 # Check whether the C++ compiler understands `using namespace std'.
102 # Note 1: On at least some compilers, it will not work until you've
103 # included a header that mentions namespace std. Thus, include the
104 # usual suspects before trying it.
106 # Note 2: This test does not actually reveal whether the C++ compiler
107 # properly understands namespaces in all generality. (GNU C++ 2.8.1
108 # is one that doesn't.) However, we don't care.
109 AC_DEFUN([PGAC_CXX_NAMESPACE_STD],
110 [AC_REQUIRE([PGAC_CLASS_STRING])
111 AC_CACHE_CHECK([for namespace std in C++],
112 pgac_cv_cxx_namespace_std,
119 #ifdef HAVE_CXX_STRING_HEADER
124 [pgac_cv_cxx_namespace_std=yes],
125 [pgac_cv_cxx_namespace_std=no])
128 if test $pgac_cv_cxx_namespace_std = yes ; then
129 AC_DEFINE(HAVE_NAMESPACE_STD, 1, [Define to 1 if the C++ compiler understands `using namespace std'])
130 fi])# PGAC_CXX_NAMESPACE_STD
132 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
133 dnl The program must properly implement --version.
134 AC_DEFUN(AM_MISSING_PROG,
135 [AC_MSG_CHECKING(for working $2)
136 # Run test in a subshell; some versions of sh will print an error if
137 # an executable is not found, even if stderr is redirected.
138 # Redirect stdin to placate older versions of autoconf. Sigh.
139 if ($2 --version) < /dev/null > /dev/null 2>&1; then
144 AC_MSG_RESULT(missing)
148 # Macros to detect C compiler features
149 # $Header: /cvsroot/pgsql/aclocal.m4,v 1.2 2000/06/11 11:39:45 petere Exp $
154 # Check if the C compiler understands signed types.
155 # (Of course any ISO C compiler should, what is this still doing here?)
156 AC_DEFUN([PGAC_C_SIGNED],
157 [AC_CACHE_CHECK(for signed types, pgac_cv_c_signed,
159 [signed char c; signed short s; signed int i;],
160 [pgac_cv_c_signed=yes],
161 [pgac_cv_c_signed=no])])
162 if test x"$pgac_cv_c_signed" = xno ; then
163 AC_DEFINE(signed,, [Define empty if the C compiler does not understand signed types])
170 # Check if the C compiler understands `volatile'. Note that if it doesn't
171 # then this will potentially break the program semantics.
172 AC_DEFUN([PGAC_C_VOLATILE],
173 [AC_CACHE_CHECK(for volatile, pgac_cv_c_volatile,
175 [extern volatile int i;],
176 [pgac_cv_c_volatile=yes],
177 [pgac_cv_c_volatile=no])])
178 if test x"$pgac_cv_c_volatile" = xno ; then
179 AC_DEFINE(volatile,, [Define empty if the C compiler does not understand `volatile'])
180 fi])# PGAC_C_VOLATILE
184 # PGAC_TYPE_64BIT_INT(TYPE)
185 # -------------------------
186 # Check if TYPE is a working 64 bit integer type. Set HAVE_TYPE_64 to
187 # yes or no respectively, and define HAVE_TYPE_64 if yes.
188 AC_DEFUN([PGAC_TYPE_64BIT_INT],
189 [define([Ac_define], [translit([have_$1_64], [a-z *], [A-Z_P])])dnl
190 define([Ac_cachevar], [translit([pgac_cv_type_$1_64], [ *], [_p])])dnl
191 AC_CACHE_CHECK([whether $1 is 64 bits], [Ac_cachevar],
196 * These are globals to discourage the compiler from folding all the
197 * arithmetic tests down to compile-time constants.
202 int does_int64_work()
206 if (sizeof(int64) != 8)
207 return 0; /* definitely not the right size */
209 /* Do perfunctory checks to see if 64-bit arithmetic seems to work */
217 exit(! does_int64_work());
222 dnl We will do better here with Autoconf 2.50
223 AC_MSG_WARN([64 bit arithmetic disabled when cross-compiling])])])
225 Ac_define=$Ac_cachevar
226 if test x"$Ac_cachevar" = xyes ; then
227 AC_DEFINE(Ac_define,, [Set to 1 if `]$1[' is 64 bits])
229 undefine([Ac_define])dnl
230 undefine([Ac_cachevar])dnl
231 ])# PGAC_TYPE_64BIT_INT
235 # PGAC_CHECK_ALIGNOF(TYPE)
236 # ------------------------
237 # Find the alignment requirement of the given type. Define the result
238 # as ALIGNOF_TYPE. If cross-compiling, sizeof(type) is used as a
239 # default assumption.
241 # This is modeled on the standard autoconf macro AC_CHECK_SIZEOF.
242 # That macro never got any points for style.
243 AC_DEFUN([PGAC_CHECK_ALIGNOF],
244 [changequote(<<, >>)dnl
245 dnl The name to #define.
246 define(<<AC_TYPE_NAME>>, translit(alignof_$1, [a-z *], [A-Z_P]))dnl
247 dnl The cache variable name.
248 define(<<AC_CV_NAME>>, translit(pgac_cv_alignof_$1, [ *], [_p]))dnl
250 AC_MSG_CHECKING(alignment of $1)
251 AC_CACHE_VAL(AC_CV_NAME,
252 [AC_TRY_RUN([#include <stdio.h>
253 struct { char filler; $1 field; } mystruct;
256 FILE *f=fopen("conftestval", "w");
258 fprintf(f, "%d\n", ((char*) & mystruct.field) - ((char*) & mystruct));
260 }], AC_CV_NAME=`cat conftestval`,
261 AC_CV_NAME='sizeof($1)',
262 AC_CV_NAME='sizeof($1)')])dnl
263 AC_MSG_RESULT($AC_CV_NAME)
264 AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The alignment requirement of a `]$1['])
265 undefine([AC_TYPE_NAME])dnl
266 undefine([AC_CV_NAME])dnl
267 ])# PGAC_CHECK_ALIGNOF
269 # $Header: /cvsroot/pgsql/aclocal.m4,v 1.2 2000/06/11 11:39:45 petere Exp $
270 # This comes from the official Autoconf macro archive at
271 # <http://research.cys.de/autoconf-archive/>
272 # (I removed the $ before the Id CVS keyword below.)
275 dnl @synopsis AC_FUNC_ACCEPT_ARGTYPES
277 dnl Checks the data types of the three arguments to accept(). Results are
278 dnl placed into the symbols ACCEPT_TYPE_ARG[123], consistent with the
279 dnl following example:
281 dnl #define ACCEPT_TYPE_ARG1 int
282 dnl #define ACCEPT_TYPE_ARG2 struct sockaddr *
283 dnl #define ACCEPT_TYPE_ARG3 socklen_t
285 dnl This macro requires AC_CHECK_HEADERS to have already verified the
286 dnl presence or absence of sys/types.h and sys/socket.h.
288 dnl NOTE: This is just a modified version of the AC_FUNC_SELECT_ARGTYPES
289 dnl macro. Credit for that one goes to David MacKenzie et. al.
291 dnl @version Id: ac_func_accept_argtypes.m4,v 1.1 1999/12/03 11:29:29 simons Exp $
292 dnl @author Daniel Richard G. <skunk@mit.edu>
295 # PostgreSQL local changes: In the original version ACCEPT_TYPE_ARG3
296 # is a pointer type. That's kind of useless because then you can't
297 # use the macro to define a corresponding variable. We also make the
298 # reasonable(?) assumption that you can use arg3 for getsocktype etc.
299 # as well (i.e., anywhere POSIX.2 has socklen_t).
301 AC_DEFUN(AC_FUNC_ACCEPT_ARGTYPES,
302 [AC_MSG_CHECKING([types of arguments for accept()])
303 AC_CACHE_VAL(ac_cv_func_accept_arg1,dnl
304 [AC_CACHE_VAL(ac_cv_func_accept_arg2,dnl
305 [AC_CACHE_VAL(ac_cv_func_accept_arg3,dnl
306 [for ac_cv_func_accept_arg1 in 'int' 'unsigned int'; do
307 for ac_cv_func_accept_arg2 in 'struct sockaddr *' 'void *'; do
308 for ac_cv_func_accept_arg3 in 'socklen_t' 'size_t' 'unsigned int' 'int'; do
310 [#ifdef HAVE_SYS_TYPES_H
311 #include <sys/types.h>
313 #ifdef HAVE_SYS_SOCKET_H
314 #include <sys/socket.h>
316 extern accept ($ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *);],,dnl
317 [ac_not_found=no ; break 3], ac_not_found=yes)
324 if test "$ac_not_found" = yes; then
325 ac_cv_func_accept_arg1=int
326 ac_cv_func_accept_arg2='struct sockaddr *'
327 ac_cv_func_accept_arg3='socklen_t'
329 AC_MSG_RESULT([$ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *])
330 AC_DEFINE_UNQUOTED(ACCEPT_TYPE_ARG1,$ac_cv_func_accept_arg1)
331 AC_DEFINE_UNQUOTED(ACCEPT_TYPE_ARG2,$ac_cv_func_accept_arg2)
332 AC_DEFINE_UNQUOTED(ACCEPT_TYPE_ARG3,$ac_cv_func_accept_arg3)
335 # Macros that test various C library quirks
336 # $Header: /cvsroot/pgsql/aclocal.m4,v 1.2 2000/06/11 11:39:45 petere Exp $
339 # PGAC_VAR_INT_TIMEZONE
340 # ---------------------
341 # Check if the global variable `timezone' exists. If so, define
343 AC_DEFUN([PGAC_VAR_INT_TIMEZONE],
344 [AC_CACHE_CHECK(for int timezone, pgac_cv_var_int_timezone,
345 [AC_TRY_LINK([#include <time.h>],
346 [int res = timezone / 60;],
347 [pgac_cv_var_int_timezone=yes],
348 [pgac_cv_var_int_timezone=no])])
349 if test x"$pgac_cv_var_int_timezone" = xyes ; then
350 AC_DEFINE(HAVE_INT_TIMEZONE,, [Set to 1 if you have the global variable timezone])
351 fi])# PGAC_VAR_INT_TIMEZONE
354 # PGAC_FUNC_GETTIMEOFDAY_1ARG
355 # ---------------------------
356 # Check if gettimeofday() has only one arguments. (Normal is two.)
357 # If so, define GETTIMEOFDAY_1ARG.
358 AC_DEFUN([PGAC_FUNC_GETTIMEOFDAY_1ARG],
359 [AC_CACHE_CHECK(whether gettimeofday takes only one argument,
360 pgac_cv_func_gettimeofday_1arg,
361 [AC_TRY_COMPILE([#include <sys/time.h>],
363 struct timezone *tzp;
364 gettimeofday(tp,tzp);],
365 [pgac_cv_func_gettimeofday_1arg=no],
366 [pgac_cv_func_gettimeofday_1arg=yes])])
367 if test x"$pgac_cv_func_gettimeofday_1arg" = xyes ; then
368 AC_DEFINE(GETTIMEOFDAY_1ARG,, [Set to 1 if gettimeofday() takes only 1 argument])
369 fi])# PGAC_FUNC_GETTIMEOFDAY_1ARG
374 # Check if `union semun' exists. Define HAVE_UNION_SEMUN if so.
375 # If it doesn't then one could define it as
376 # union semun { int val; struct semid_ds *buf; unsigned short *array; }
377 AC_DEFUN([PGAC_UNION_SEMUN],
378 [AC_CACHE_CHECK(for union semun, pgac_cv_union_semun,
379 [AC_TRY_COMPILE([#include <sys/types.h>
381 #include <sys/sem.h>],
382 [union semun semun;],
383 [pgac_cv_union_semun=yes],
384 [pgac_cv_union_semun=no])])
385 if test x"$pgac_cv_union_semun" = xyes ; then
386 AC_DEFINE(HAVE_UNION_SEMUN,, [Set to 1 if you have `union semun'])
387 fi])# PGAC_UNION_SEMUN
390 # PGAC_FUNC_POSIX_SIGNALS
391 # -----------------------
392 # Check to see if the machine has the POSIX signal interface. Define
393 # HAVE_POSIX_SIGNALS if so. Also set the output variable HAVE_POSIX_SIGNALS
396 # Note that this test only compiles a test program, it doesn't check
397 # whether the routines actually work. If that becomes a problem, make
399 AC_DEFUN([PGAC_FUNC_POSIX_SIGNALS],
400 [AC_CACHE_CHECK(for POSIX signal interface, pgac_cv_func_posix_signals,
401 [AC_TRY_LINK([#include <signal.h>
403 [struct sigaction act, oact;
404 sigemptyset(&act.sa_mask);
405 act.sa_flags = SA_RESTART;
406 sigaction(0, &act, &oact);],
407 [pgac_cv_func_posix_signals=yes],
408 [pgac_cv_func_posix_signals=no])])
409 if test x"$pgac_cv_func_posix_signals" = xyes ; then
410 AC_DEFINE(HAVE_POSIX_SIGNALS,, [Set to 1 if you have the POSIX signal interface])
412 HAVE_POSIX_SIGNALS=$pgac_cv_func_posix_signals
413 AC_SUBST(HAVE_POSIX_SIGNALS)])# PGAC_FUNC_POSIX_SIGNALS