Commit 06cd0f1a authored by Peter Eisentraut's avatar Peter Eisentraut

Substituted new configure test for types of accept()

Interfaced a lot of the custom tests to the config.cache, in the process
made them separate macros and grouped them out into files. Made naming
adjustments.

Removed a couple of useless/unused configure tests.

Disabled C++ by default. C++ is no more special than Perl, Python, and Tcl.
And it breaks equally often. :(
parent b4182b13
...@@ -13,7 +13,7 @@ dnl PARTICULAR PURPOSE. ...@@ -13,7 +13,7 @@ dnl PARTICULAR PURPOSE.
# #
# Autoconf macros for configuring the build of Python extension modules # Autoconf macros for configuring the build of Python extension modules
# #
# $Header: /cvsroot/pgsql/aclocal.m4,v 1.1 2000/06/10 18:01:34 petere Exp $ # $Header: /cvsroot/pgsql/aclocal.m4,v 1.2 2000/06/11 11:39:45 petere Exp $
# #
# PGAC_PROG_PYTHON # PGAC_PROG_PYTHON
...@@ -61,6 +61,74 @@ else ...@@ -61,6 +61,74 @@ else
AC_MSG_ERROR([Python not found]) AC_MSG_ERROR([Python not found])
fi])# PGAC_PATH_PYTHONDIR fi])# PGAC_PATH_PYTHONDIR
# Macros to detect certain C++ features
# $Header: /cvsroot/pgsql/aclocal.m4,v 1.2 2000/06/11 11:39:45 petere Exp $
# PGAC_CLASS_STRING
# -----------------
# Look for class `string'. First look for the <string> header. If this
# is found a <string> header then it's probably safe to assume that
# class string exists. If not, check to make sure that <string.h>
# defines class `string'.
AC_DEFUN([PGAC_CLASS_STRING],
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_CHECK_HEADER(string,
[AC_DEFINE(HAVE_CXX_STRING_HEADER)])
if test x"$ac_cv_header_string" != xyes ; then
AC_CACHE_CHECK([for class string in <string.h>],
[pgac_cv_class_string_in_string_h],
[AC_TRY_COMPILE([#include <stdio.h>
#include <stdlib.h>
#include <string.h>
],
[string foo = "test"],
[pgac_cv_class_string_in_string_h=yes],
[pgac_cv_class_string_in_string_h=no])])
if test x"$pgac_cv_class_string_in_string_h" != xyes ; then
AC_MSG_ERROR([neither <string> nor <string.h> seem to define the C++ class \`string\'])
fi
fi
AC_LANG_RESTORE])# PGAC_CLASS_STRING
# PGAC_CXX_NAMESPACE_STD
# ----------------------
# Check whether the C++ compiler understands `using namespace std'.
#
# Note 1: On at least some compilers, it will not work until you've
# included a header that mentions namespace std. Thus, include the
# usual suspects before trying it.
#
# Note 2: This test does not actually reveal whether the C++ compiler
# properly understands namespaces in all generality. (GNU C++ 2.8.1
# is one that doesn't.) However, we don't care.
AC_DEFUN([PGAC_CXX_NAMESPACE_STD],
[AC_REQUIRE([PGAC_CLASS_STRING])
AC_CACHE_CHECK([for namespace std in C++],
pgac_cv_cxx_namespace_std,
[
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE(
[#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_CXX_STRING_HEADER
#include <string>
#endif
using namespace std;
], [],
[pgac_cv_cxx_namespace_std=yes],
[pgac_cv_cxx_namespace_std=no])
AC_LANG_RESTORE])
if test $pgac_cv_cxx_namespace_std = yes ; then
AC_DEFINE(HAVE_NAMESPACE_STD, 1, [Define to 1 if the C++ compiler understands `using namespace std'])
fi])# PGAC_CXX_NAMESPACE_STD
dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
dnl The program must properly implement --version. dnl The program must properly implement --version.
AC_DEFUN(AM_MISSING_PROG, AC_DEFUN(AM_MISSING_PROG,
...@@ -77,3 +145,270 @@ else ...@@ -77,3 +145,270 @@ else
fi fi
AC_SUBST($1)]) AC_SUBST($1)])
# Macros to detect C compiler features
# $Header: /cvsroot/pgsql/aclocal.m4,v 1.2 2000/06/11 11:39:45 petere Exp $
# PGAC_C_SIGNED
# -------------
# Check if the C compiler understands signed types.
# (Of course any ISO C compiler should, what is this still doing here?)
AC_DEFUN([PGAC_C_SIGNED],
[AC_CACHE_CHECK(for signed types, pgac_cv_c_signed,
[AC_TRY_COMPILE([],
[signed char c; signed short s; signed int i;],
[pgac_cv_c_signed=yes],
[pgac_cv_c_signed=no])])
if test x"$pgac_cv_c_signed" = xno ; then
AC_DEFINE(signed,, [Define empty if the C compiler does not understand signed types])
fi])# PGAC_C_SIGNED
# PGAC_C_VOLATILE
# ---------------
# Check if the C compiler understands `volatile'. Note that if it doesn't
# then this will potentially break the program semantics.
AC_DEFUN([PGAC_C_VOLATILE],
[AC_CACHE_CHECK(for volatile, pgac_cv_c_volatile,
[AC_TRY_COMPILE([],
[extern volatile int i;],
[pgac_cv_c_volatile=yes],
[pgac_cv_c_volatile=no])])
if test x"$pgac_cv_c_volatile" = xno ; then
AC_DEFINE(volatile,, [Define empty if the C compiler does not understand `volatile'])
fi])# PGAC_C_VOLATILE
# PGAC_TYPE_64BIT_INT(TYPE)
# -------------------------
# Check if TYPE is a working 64 bit integer type. Set HAVE_TYPE_64 to
# yes or no respectively, and define HAVE_TYPE_64 if yes.
AC_DEFUN([PGAC_TYPE_64BIT_INT],
[define([Ac_define], [translit([have_$1_64], [a-z *], [A-Z_P])])dnl
define([Ac_cachevar], [translit([pgac_cv_type_$1_64], [ *], [_p])])dnl
AC_CACHE_CHECK([whether $1 is 64 bits], [Ac_cachevar],
[AC_TRY_RUN(
[typedef $1 int64;
/*
* These are globals to discourage the compiler from folding all the
* arithmetic tests down to compile-time constants.
*/
int64 a = 20000001;
int64 b = 40000005;
int does_int64_work()
{
int64 c,d;
if (sizeof(int64) != 8)
return 0; /* definitely not the right size */
/* Do perfunctory checks to see if 64-bit arithmetic seems to work */
c = a * b;
d = (c + b) / b;
if (d != a+1)
return 0;
return 1;
}
main() {
exit(! does_int64_work());
}],
[Ac_cachevar=yes],
[Ac_cachevar=no],
[Ac_cachevar=no
dnl We will do better here with Autoconf 2.50
AC_MSG_WARN([64 bit arithmetic disabled when cross-compiling])])])
Ac_define=$Ac_cachevar
if test x"$Ac_cachevar" = xyes ; then
AC_DEFINE(Ac_define,, [Set to 1 if `]$1[' is 64 bits])
fi
undefine([Ac_define])dnl
undefine([Ac_cachevar])dnl
])# PGAC_TYPE_64BIT_INT
# PGAC_CHECK_ALIGNOF(TYPE)
# ------------------------
# Find the alignment requirement of the given type. Define the result
# as ALIGNOF_TYPE. If cross-compiling, sizeof(type) is used as a
# default assumption.
#
# This is modeled on the standard autoconf macro AC_CHECK_SIZEOF.
# That macro never got any points for style.
AC_DEFUN([PGAC_CHECK_ALIGNOF],
[changequote(<<, >>)dnl
dnl The name to #define.
define(<<AC_TYPE_NAME>>, translit(alignof_$1, [a-z *], [A-Z_P]))dnl
dnl The cache variable name.
define(<<AC_CV_NAME>>, translit(pgac_cv_alignof_$1, [ *], [_p]))dnl
changequote([, ])dnl
AC_MSG_CHECKING(alignment of $1)
AC_CACHE_VAL(AC_CV_NAME,
[AC_TRY_RUN([#include <stdio.h>
struct { char filler; $1 field; } mystruct;
main()
{
FILE *f=fopen("conftestval", "w");
if (!f) exit(1);
fprintf(f, "%d\n", ((char*) & mystruct.field) - ((char*) & mystruct));
exit(0);
}], AC_CV_NAME=`cat conftestval`,
AC_CV_NAME='sizeof($1)',
AC_CV_NAME='sizeof($1)')])dnl
AC_MSG_RESULT($AC_CV_NAME)
AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The alignment requirement of a `]$1['])
undefine([AC_TYPE_NAME])dnl
undefine([AC_CV_NAME])dnl
])# PGAC_CHECK_ALIGNOF
# $Header: /cvsroot/pgsql/aclocal.m4,v 1.2 2000/06/11 11:39:45 petere Exp $
# This comes from the official Autoconf macro archive at
# <http://research.cys.de/autoconf-archive/>
# (I removed the $ before the Id CVS keyword below.)
dnl @synopsis AC_FUNC_ACCEPT_ARGTYPES
dnl
dnl Checks the data types of the three arguments to accept(). Results are
dnl placed into the symbols ACCEPT_TYPE_ARG[123], consistent with the
dnl following example:
dnl
dnl #define ACCEPT_TYPE_ARG1 int
dnl #define ACCEPT_TYPE_ARG2 struct sockaddr *
dnl #define ACCEPT_TYPE_ARG3 socklen_t
dnl
dnl This macro requires AC_CHECK_HEADERS to have already verified the
dnl presence or absence of sys/types.h and sys/socket.h.
dnl
dnl NOTE: This is just a modified version of the AC_FUNC_SELECT_ARGTYPES
dnl macro. Credit for that one goes to David MacKenzie et. al.
dnl
dnl @version Id: ac_func_accept_argtypes.m4,v 1.1 1999/12/03 11:29:29 simons Exp $
dnl @author Daniel Richard G. <skunk@mit.edu>
dnl
# PostgreSQL local changes: In the original version ACCEPT_TYPE_ARG3
# is a pointer type. That's kind of useless because then you can't
# use the macro to define a corresponding variable. We also make the
# reasonable(?) assumption that you can use arg3 for getsocktype etc.
# as well (i.e., anywhere POSIX.2 has socklen_t).
AC_DEFUN(AC_FUNC_ACCEPT_ARGTYPES,
[AC_MSG_CHECKING([types of arguments for accept()])
AC_CACHE_VAL(ac_cv_func_accept_arg1,dnl
[AC_CACHE_VAL(ac_cv_func_accept_arg2,dnl
[AC_CACHE_VAL(ac_cv_func_accept_arg3,dnl
[for ac_cv_func_accept_arg1 in 'int' 'unsigned int'; do
for ac_cv_func_accept_arg2 in 'struct sockaddr *' 'void *'; do
for ac_cv_func_accept_arg3 in 'socklen_t' 'size_t' 'unsigned int' 'int'; do
AC_TRY_COMPILE(dnl
[#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
extern accept ($ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *);],,dnl
[ac_not_found=no ; break 3], ac_not_found=yes)
done
done
done
])dnl AC_CACHE_VAL
])dnl AC_CACHE_VAL
])dnl AC_CACHE_VAL
if test "$ac_not_found" = yes; then
ac_cv_func_accept_arg1=int
ac_cv_func_accept_arg2='struct sockaddr *'
ac_cv_func_accept_arg3='socklen_t'
fi
AC_MSG_RESULT([$ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *])
AC_DEFINE_UNQUOTED(ACCEPT_TYPE_ARG1,$ac_cv_func_accept_arg1)
AC_DEFINE_UNQUOTED(ACCEPT_TYPE_ARG2,$ac_cv_func_accept_arg2)
AC_DEFINE_UNQUOTED(ACCEPT_TYPE_ARG3,$ac_cv_func_accept_arg3)
])
# Macros that test various C library quirks
# $Header: /cvsroot/pgsql/aclocal.m4,v 1.2 2000/06/11 11:39:45 petere Exp $
# PGAC_VAR_INT_TIMEZONE
# ---------------------
# Check if the global variable `timezone' exists. If so, define
# HAVE_INT_TIMEZONE.
AC_DEFUN([PGAC_VAR_INT_TIMEZONE],
[AC_CACHE_CHECK(for int timezone, pgac_cv_var_int_timezone,
[AC_TRY_LINK([#include <time.h>],
[int res = timezone / 60;],
[pgac_cv_var_int_timezone=yes],
[pgac_cv_var_int_timezone=no])])
if test x"$pgac_cv_var_int_timezone" = xyes ; then
AC_DEFINE(HAVE_INT_TIMEZONE,, [Set to 1 if you have the global variable timezone])
fi])# PGAC_VAR_INT_TIMEZONE
# PGAC_FUNC_GETTIMEOFDAY_1ARG
# ---------------------------
# Check if gettimeofday() has only one arguments. (Normal is two.)
# If so, define GETTIMEOFDAY_1ARG.
AC_DEFUN([PGAC_FUNC_GETTIMEOFDAY_1ARG],
[AC_CACHE_CHECK(whether gettimeofday takes only one argument,
pgac_cv_func_gettimeofday_1arg,
[AC_TRY_COMPILE([#include <sys/time.h>],
[struct timeval *tp;
struct timezone *tzp;
gettimeofday(tp,tzp);],
[pgac_cv_func_gettimeofday_1arg=no],
[pgac_cv_func_gettimeofday_1arg=yes])])
if test x"$pgac_cv_func_gettimeofday_1arg" = xyes ; then
AC_DEFINE(GETTIMEOFDAY_1ARG,, [Set to 1 if gettimeofday() takes only 1 argument])
fi])# PGAC_FUNC_GETTIMEOFDAY_1ARG
# PGAC_UNION_SEMUN
# ----------------
# Check if `union semun' exists. Define HAVE_UNION_SEMUN if so.
# If it doesn't then one could define it as
# union semun { int val; struct semid_ds *buf; unsigned short *array; }
AC_DEFUN([PGAC_UNION_SEMUN],
[AC_CACHE_CHECK(for union semun, pgac_cv_union_semun,
[AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>],
[union semun semun;],
[pgac_cv_union_semun=yes],
[pgac_cv_union_semun=no])])
if test x"$pgac_cv_union_semun" = xyes ; then
AC_DEFINE(HAVE_UNION_SEMUN,, [Set to 1 if you have `union semun'])
fi])# PGAC_UNION_SEMUN
# PGAC_FUNC_POSIX_SIGNALS
# -----------------------
# Check to see if the machine has the POSIX signal interface. Define
# HAVE_POSIX_SIGNALS if so. Also set the output variable HAVE_POSIX_SIGNALS
# to yes or no.
#
# Note that this test only compiles a test program, it doesn't check
# whether the routines actually work. If that becomes a problem, make
# a fancier check.
AC_DEFUN([PGAC_FUNC_POSIX_SIGNALS],
[AC_CACHE_CHECK(for POSIX signal interface, pgac_cv_func_posix_signals,
[AC_TRY_LINK([#include <signal.h>
],
[struct sigaction act, oact;
sigemptyset(&act.sa_mask);
act.sa_flags = SA_RESTART;
sigaction(0, &act, &oact);],
[pgac_cv_func_posix_signals=yes],
[pgac_cv_func_posix_signals=no])])
if test x"$pgac_cv_func_posix_signals" = xyes ; then
AC_DEFINE(HAVE_POSIX_SIGNALS,, [Set to 1 if you have the POSIX signal interface])
fi
HAVE_POSIX_SIGNALS=$pgac_cv_func_posix_signals
AC_SUBST(HAVE_POSIX_SIGNALS)])# PGAC_FUNC_POSIX_SIGNALS
# $Header: /cvsroot/pgsql/config/ac_func_accept_argtypes.m4,v 1.1 2000/06/11 11:39:46 petere Exp $
# This comes from the official Autoconf macro archive at
# <http://research.cys.de/autoconf-archive/>
# (I removed the $ before the Id CVS keyword below.)
dnl @synopsis AC_FUNC_ACCEPT_ARGTYPES
dnl
dnl Checks the data types of the three arguments to accept(). Results are
dnl placed into the symbols ACCEPT_TYPE_ARG[123], consistent with the
dnl following example:
dnl
dnl #define ACCEPT_TYPE_ARG1 int
dnl #define ACCEPT_TYPE_ARG2 struct sockaddr *
dnl #define ACCEPT_TYPE_ARG3 socklen_t
dnl
dnl This macro requires AC_CHECK_HEADERS to have already verified the
dnl presence or absence of sys/types.h and sys/socket.h.
dnl
dnl NOTE: This is just a modified version of the AC_FUNC_SELECT_ARGTYPES
dnl macro. Credit for that one goes to David MacKenzie et. al.
dnl
dnl @version Id: ac_func_accept_argtypes.m4,v 1.1 1999/12/03 11:29:29 simons Exp $
dnl @author Daniel Richard G. <skunk@mit.edu>
dnl
# PostgreSQL local changes: In the original version ACCEPT_TYPE_ARG3
# is a pointer type. That's kind of useless because then you can't
# use the macro to define a corresponding variable. We also make the
# reasonable(?) assumption that you can use arg3 for getsocktype etc.
# as well (i.e., anywhere POSIX.2 has socklen_t).
AC_DEFUN(AC_FUNC_ACCEPT_ARGTYPES,
[AC_MSG_CHECKING([types of arguments for accept()])
AC_CACHE_VAL(ac_cv_func_accept_arg1,dnl
[AC_CACHE_VAL(ac_cv_func_accept_arg2,dnl
[AC_CACHE_VAL(ac_cv_func_accept_arg3,dnl
[for ac_cv_func_accept_arg1 in 'int' 'unsigned int'; do
for ac_cv_func_accept_arg2 in 'struct sockaddr *' 'void *'; do
for ac_cv_func_accept_arg3 in 'socklen_t' 'size_t' 'unsigned int' 'int'; do
AC_TRY_COMPILE(dnl
[#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
extern accept ($ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *);],,dnl
[ac_not_found=no ; break 3], ac_not_found=yes)
done
done
done
])dnl AC_CACHE_VAL
])dnl AC_CACHE_VAL
])dnl AC_CACHE_VAL
if test "$ac_not_found" = yes; then
ac_cv_func_accept_arg1=int
ac_cv_func_accept_arg2='struct sockaddr *'
ac_cv_func_accept_arg3='socklen_t'
fi
AC_MSG_RESULT([$ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *])
AC_DEFINE_UNQUOTED(ACCEPT_TYPE_ARG1,$ac_cv_func_accept_arg1)
AC_DEFINE_UNQUOTED(ACCEPT_TYPE_ARG2,$ac_cv_func_accept_arg2)
AC_DEFINE_UNQUOTED(ACCEPT_TYPE_ARG3,$ac_cv_func_accept_arg3)
])
# Macros to detect C compiler features
# $Header: /cvsroot/pgsql/config/c-compiler.m4,v 1.1 2000/06/11 11:39:46 petere Exp $
# PGAC_C_SIGNED
# -------------
# Check if the C compiler understands signed types.
# (Of course any ISO C compiler should, what is this still doing here?)
AC_DEFUN([PGAC_C_SIGNED],
[AC_CACHE_CHECK(for signed types, pgac_cv_c_signed,
[AC_TRY_COMPILE([],
[signed char c; signed short s; signed int i;],
[pgac_cv_c_signed=yes],
[pgac_cv_c_signed=no])])
if test x"$pgac_cv_c_signed" = xno ; then
AC_DEFINE(signed,, [Define empty if the C compiler does not understand signed types])
fi])# PGAC_C_SIGNED
# PGAC_C_VOLATILE
# ---------------
# Check if the C compiler understands `volatile'. Note that if it doesn't
# then this will potentially break the program semantics.
AC_DEFUN([PGAC_C_VOLATILE],
[AC_CACHE_CHECK(for volatile, pgac_cv_c_volatile,
[AC_TRY_COMPILE([],
[extern volatile int i;],
[pgac_cv_c_volatile=yes],
[pgac_cv_c_volatile=no])])
if test x"$pgac_cv_c_volatile" = xno ; then
AC_DEFINE(volatile,, [Define empty if the C compiler does not understand `volatile'])
fi])# PGAC_C_VOLATILE
# PGAC_TYPE_64BIT_INT(TYPE)
# -------------------------
# Check if TYPE is a working 64 bit integer type. Set HAVE_TYPE_64 to
# yes or no respectively, and define HAVE_TYPE_64 if yes.
AC_DEFUN([PGAC_TYPE_64BIT_INT],
[define([Ac_define], [translit([have_$1_64], [a-z *], [A-Z_P])])dnl
define([Ac_cachevar], [translit([pgac_cv_type_$1_64], [ *], [_p])])dnl
AC_CACHE_CHECK([whether $1 is 64 bits], [Ac_cachevar],
[AC_TRY_RUN(
[typedef $1 int64;
/*
* These are globals to discourage the compiler from folding all the
* arithmetic tests down to compile-time constants.
*/
int64 a = 20000001;
int64 b = 40000005;
int does_int64_work()
{
int64 c,d;
if (sizeof(int64) != 8)
return 0; /* definitely not the right size */
/* Do perfunctory checks to see if 64-bit arithmetic seems to work */
c = a * b;
d = (c + b) / b;
if (d != a+1)
return 0;
return 1;
}
main() {
exit(! does_int64_work());
}],
[Ac_cachevar=yes],
[Ac_cachevar=no],
[Ac_cachevar=no
dnl We will do better here with Autoconf 2.50
AC_MSG_WARN([64 bit arithmetic disabled when cross-compiling])])])
Ac_define=$Ac_cachevar
if test x"$Ac_cachevar" = xyes ; then
AC_DEFINE(Ac_define,, [Set to 1 if `]$1[' is 64 bits])
fi
undefine([Ac_define])dnl
undefine([Ac_cachevar])dnl
])# PGAC_TYPE_64BIT_INT
# PGAC_CHECK_ALIGNOF(TYPE)
# ------------------------
# Find the alignment requirement of the given type. Define the result
# as ALIGNOF_TYPE. If cross-compiling, sizeof(type) is used as a
# default assumption.
#
# This is modeled on the standard autoconf macro AC_CHECK_SIZEOF.
# That macro never got any points for style.
AC_DEFUN([PGAC_CHECK_ALIGNOF],
[changequote(<<, >>)dnl
dnl The name to #define.
define(<<AC_TYPE_NAME>>, translit(alignof_$1, [a-z *], [A-Z_P]))dnl
dnl The cache variable name.
define(<<AC_CV_NAME>>, translit(pgac_cv_alignof_$1, [ *], [_p]))dnl
changequote([, ])dnl
AC_MSG_CHECKING(alignment of $1)
AC_CACHE_VAL(AC_CV_NAME,
[AC_TRY_RUN([#include <stdio.h>
struct { char filler; $1 field; } mystruct;
main()
{
FILE *f=fopen("conftestval", "w");
if (!f) exit(1);
fprintf(f, "%d\n", ((char*) & mystruct.field) - ((char*) & mystruct));
exit(0);
}], AC_CV_NAME=`cat conftestval`,
AC_CV_NAME='sizeof($1)',
AC_CV_NAME='sizeof($1)')])dnl
AC_MSG_RESULT($AC_CV_NAME)
AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The alignment requirement of a `]$1['])
undefine([AC_TYPE_NAME])dnl
undefine([AC_CV_NAME])dnl
])# PGAC_CHECK_ALIGNOF
# Macros that test various C library quirks
# $Header: /cvsroot/pgsql/config/c-library.m4,v 1.1 2000/06/11 11:39:46 petere Exp $
# PGAC_VAR_INT_TIMEZONE
# ---------------------
# Check if the global variable `timezone' exists. If so, define
# HAVE_INT_TIMEZONE.
AC_DEFUN([PGAC_VAR_INT_TIMEZONE],
[AC_CACHE_CHECK(for int timezone, pgac_cv_var_int_timezone,
[AC_TRY_LINK([#include <time.h>],
[int res = timezone / 60;],
[pgac_cv_var_int_timezone=yes],
[pgac_cv_var_int_timezone=no])])
if test x"$pgac_cv_var_int_timezone" = xyes ; then
AC_DEFINE(HAVE_INT_TIMEZONE,, [Set to 1 if you have the global variable timezone])
fi])# PGAC_VAR_INT_TIMEZONE
# PGAC_FUNC_GETTIMEOFDAY_1ARG
# ---------------------------
# Check if gettimeofday() has only one arguments. (Normal is two.)
# If so, define GETTIMEOFDAY_1ARG.
AC_DEFUN([PGAC_FUNC_GETTIMEOFDAY_1ARG],
[AC_CACHE_CHECK(whether gettimeofday takes only one argument,
pgac_cv_func_gettimeofday_1arg,
[AC_TRY_COMPILE([#include <sys/time.h>],
[struct timeval *tp;
struct timezone *tzp;
gettimeofday(tp,tzp);],
[pgac_cv_func_gettimeofday_1arg=no],
[pgac_cv_func_gettimeofday_1arg=yes])])
if test x"$pgac_cv_func_gettimeofday_1arg" = xyes ; then
AC_DEFINE(GETTIMEOFDAY_1ARG,, [Set to 1 if gettimeofday() takes only 1 argument])
fi])# PGAC_FUNC_GETTIMEOFDAY_1ARG
# PGAC_UNION_SEMUN
# ----------------
# Check if `union semun' exists. Define HAVE_UNION_SEMUN if so.
# If it doesn't then one could define it as
# union semun { int val; struct semid_ds *buf; unsigned short *array; }
AC_DEFUN([PGAC_UNION_SEMUN],
[AC_CACHE_CHECK(for union semun, pgac_cv_union_semun,
[AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>],
[union semun semun;],
[pgac_cv_union_semun=yes],
[pgac_cv_union_semun=no])])
if test x"$pgac_cv_union_semun" = xyes ; then
AC_DEFINE(HAVE_UNION_SEMUN,, [Set to 1 if you have `union semun'])
fi])# PGAC_UNION_SEMUN
# PGAC_FUNC_POSIX_SIGNALS
# -----------------------
# Check to see if the machine has the POSIX signal interface. Define
# HAVE_POSIX_SIGNALS if so. Also set the output variable HAVE_POSIX_SIGNALS
# to yes or no.
#
# Note that this test only compiles a test program, it doesn't check
# whether the routines actually work. If that becomes a problem, make
# a fancier check.
AC_DEFUN([PGAC_FUNC_POSIX_SIGNALS],
[AC_CACHE_CHECK(for POSIX signal interface, pgac_cv_func_posix_signals,
[AC_TRY_LINK([#include <signal.h>
],
[struct sigaction act, oact;
sigemptyset(&act.sa_mask);
act.sa_flags = SA_RESTART;
sigaction(0, &act, &oact);],
[pgac_cv_func_posix_signals=yes],
[pgac_cv_func_posix_signals=no])])
if test x"$pgac_cv_func_posix_signals" = xyes ; then
AC_DEFINE(HAVE_POSIX_SIGNALS,, [Set to 1 if you have the POSIX signal interface])
fi
HAVE_POSIX_SIGNALS=$pgac_cv_func_posix_signals
AC_SUBST(HAVE_POSIX_SIGNALS)])# PGAC_FUNC_POSIX_SIGNALS
# Macros to detect certain C++ features
# $Header: /cvsroot/pgsql/config/Attic/cxx.m4,v 1.1 2000/06/11 11:39:46 petere Exp $
# PGAC_CLASS_STRING
# -----------------
# Look for class `string'. First look for the <string> header. If this
# is found a <string> header then it's probably safe to assume that
# class string exists. If not, check to make sure that <string.h>
# defines class `string'.
AC_DEFUN([PGAC_CLASS_STRING],
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_CHECK_HEADER(string,
[AC_DEFINE(HAVE_CXX_STRING_HEADER)])
if test x"$ac_cv_header_string" != xyes ; then
AC_CACHE_CHECK([for class string in <string.h>],
[pgac_cv_class_string_in_string_h],
[AC_TRY_COMPILE([#include <stdio.h>
#include <stdlib.h>
#include <string.h>
],
[string foo = "test"],
[pgac_cv_class_string_in_string_h=yes],
[pgac_cv_class_string_in_string_h=no])])
if test x"$pgac_cv_class_string_in_string_h" != xyes ; then
AC_MSG_ERROR([neither <string> nor <string.h> seem to define the C++ class \`string\'])
fi
fi
AC_LANG_RESTORE])# PGAC_CLASS_STRING
# PGAC_CXX_NAMESPACE_STD
# ----------------------
# Check whether the C++ compiler understands `using namespace std'.
#
# Note 1: On at least some compilers, it will not work until you've
# included a header that mentions namespace std. Thus, include the
# usual suspects before trying it.
#
# Note 2: This test does not actually reveal whether the C++ compiler
# properly understands namespaces in all generality. (GNU C++ 2.8.1
# is one that doesn't.) However, we don't care.
AC_DEFUN([PGAC_CXX_NAMESPACE_STD],
[AC_REQUIRE([PGAC_CLASS_STRING])
AC_CACHE_CHECK([for namespace std in C++],
pgac_cv_cxx_namespace_std,
[
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE(
[#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_CXX_STRING_HEADER
#include <string>
#endif
using namespace std;
], [],
[pgac_cv_cxx_namespace_std=yes],
[pgac_cv_cxx_namespace_std=no])
AC_LANG_RESTORE])
if test $pgac_cv_cxx_namespace_std = yes ; then
AC_DEFINE(HAVE_NAMESPACE_STD, 1, [Define to 1 if the C++ compiler understands `using namespace std'])
fi])# PGAC_CXX_NAMESPACE_STD
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -72,16 +72,6 @@ then ...@@ -72,16 +72,6 @@ then
AC_SUBST(TAS) AC_SUBST(TAS)
fi fi
echo "checking echo setting..."
if echo '\c' | grep -s c >/dev/null 2>&1
then
ECHO_N="echo -n"
ECHO_C=""
else
ECHO_N="echo"
ECHO_C='\c'
fi
dnl this part selects the template from the ones in the template directory. dnl this part selects the template from the ones in the template directory.
AC_MSG_CHECKING(setting template to) AC_MSG_CHECKING(setting template to)
...@@ -316,6 +306,7 @@ dnl Find CPP, then check traditional. ...@@ -316,6 +306,7 @@ dnl Find CPP, then check traditional.
dnl Caution: these macros must be called in this order... dnl Caution: these macros must be called in this order...
AC_PROG_CPP AC_PROG_CPP
AC_PROG_GCC_TRADITIONAL AC_PROG_GCC_TRADITIONAL
AC_SUBST(GCC)
if test "$CC" = "gcc" if test "$CC" = "gcc"
then then
...@@ -565,82 +556,28 @@ AC_SUBST(WISH) ...@@ -565,82 +556,28 @@ AC_SUBST(WISH)
AC_SUBST(USE_ODBC) AC_SUBST(USE_ODBC)
AC_SUBST(MULTIBYTE) AC_SUBST(MULTIBYTE)
dnl Check for C++ support (allow override if needed)
dnl XXX: probably should default to HAVECXX='false'
HAVECXX='true'
AC_ARG_WITH(CXX,
[ --with-CXX=compiler use specific C++ compiler
--without-CXX prevent building C++ code ],
[
case "$withval" in
"" | y | ye | yes)
HAVECXX='true'
# allow configure to choose C++ compiler
;;
n | no)
HAVECXX='false'
;;
*)
HAVECXX='true'
CXX="$withval"
;;
esac
])
AC_SUBST(HAVECXX)
if test "$HAVECXX" = 'true' ; then
dnl Even if CXX value was given to us, need to run AC_PROG_CXX ...
AC_PROG_CXX
AC_LANG_CPLUSPLUS
dnl check whether "#include <string>" works on this C++ compiler
AC_MSG_CHECKING([for include <string> in C++])
AC_TRY_COMPILE([#include <stdio.h>
#include <stdlib.h>
#include <string>
], [],
[AC_DEFINE(HAVE_CXX_STRING_HEADER) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
dnl If we found a <string> header then it's probably safe to assume
dnl class string exists. But if not, check to make sure that <string.h>
dnl defines class string; libpq++ can't build without class string.
AC_MSG_CHECKING([for class string in C++])
AC_TRY_COMPILE([#include <stdio.h>
#include <stdlib.h>
#include <string.h>
], [string foo = "test"],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
AC_MSG_WARN([
***
Disabling build of libpq++ because we cannot find class string in the
system's C++ header files.
***])
HAVECXX='false'
])
])
fi
if test "$HAVECXX" = 'true' ; then dnl
dnl check whether "using namespace std" works on this C++ compiler. dnl Optionally build C++ code (i.e., libpq++)
dnl NOTE: on at least some compilers, it will not work until you've dnl
dnl included a header that mentions namespace std. Thus, include AC_MSG_CHECKING(whether to build C++ modules)
dnl the usual suspects before trying it. AC_ARG_WITH(CXX, [ --with-CXX build C++ modules (libpq++)],
AC_MSG_CHECKING([for namespace std in C++]) [if test "x${withval+set}" = xset; then
AC_TRY_COMPILE([#include <stdio.h> AC_MSG_RESULT(yes)
#include <stdlib.h> if test x"$withval" != xyes ; then
#ifdef HAVE_CXX_STRING_HEADER CXX=$withval
#include <string> fi
#endif AC_PROG_CXX
using namespace std; AC_PROG_CXXCPP
], [], PGAC_CLASS_STRING
[AC_DEFINE(HAVE_NAMESPACE_STD) AC_MSG_RESULT(yes)], PGAC_CXX_NAMESPACE_STD
[AC_MSG_RESULT(no)]) else
fi AC_MSG_RESULT(no)
fi],
[AC_MSG_RESULT(no)])
AC_SUBST(with_CXX)
dnl make sure we revert to C compiler, not C++, for subsequent tests
AC_LANG_C
dnl Figure out how to invoke "install" and what install options to use. dnl Figure out how to invoke "install" and what install options to use.
...@@ -667,23 +604,6 @@ AC_PROG_AWK ...@@ -667,23 +604,6 @@ AC_PROG_AWK
AM_MISSING_PROG(AUTOCONF, autoconf, [\${SHELL} \${top_srcdir}/config]) AM_MISSING_PROG(AUTOCONF, autoconf, [\${SHELL} \${top_srcdir}/config])
AM_MISSING_PROG(ACLOCAL, aclocal, [\${SHELL} \${top_srcdir}/config]) AM_MISSING_PROG(ACLOCAL, aclocal, [\${SHELL} \${top_srcdir}/config])
dnl Check the option to echo to inhibit newlines.
ECHO_N_OUT=`echo -n "" | wc -c`
ECHO_C_OUT=`echo "\c" | wc -c`
if test "$ECHO_N_OUT" -eq 0; then
DASH_N='-n'
BACKSLASH_C=
else
if test "ECHO_C_OUT" -eq 0; then
DASH_N=
BACKSLASH_C='\\\\c'
else
AC_MSG_ERROR("echo behaviour undetermined")
fi
fi
AC_SUBST(DASH_N)
AC_SUBST(BACKSLASH_C)
AC_PROG_LEX AC_PROG_LEX
if test "$LEX" = "flex"; then if test "$LEX" = "flex"; then
$LEX --version 2> /dev/null | grep -s '2\.5\.3' > /dev/null 2>&1 $LEX --version 2> /dev/null | grep -s '2\.5\.3' > /dev/null 2>&1
...@@ -709,6 +629,7 @@ AC_PATH_PROG(xargs, xargs) ...@@ -709,6 +629,7 @@ AC_PATH_PROG(xargs, xargs)
AC_PATH_PROGS(GZCAT, gzcat zcat, gzcat) AC_PATH_PROGS(GZCAT, gzcat zcat, gzcat)
AC_CHECK_PROGS(PERL, perl,) AC_CHECK_PROGS(PERL, perl,)
AC_PROG_YACC AC_PROG_YACC
AC_SUBST(YFLAGS)
AC_CHECK_LIB(sfio, main) AC_CHECK_LIB(sfio, main)
...@@ -765,6 +686,7 @@ AC_CHECK_HEADERS(termios.h) ...@@ -765,6 +686,7 @@ AC_CHECK_HEADERS(termios.h)
AC_CHECK_HEADERS(unistd.h) AC_CHECK_HEADERS(unistd.h)
AC_CHECK_HEADERS(values.h) AC_CHECK_HEADERS(values.h)
AC_CHECK_HEADERS(sys/exec.h sys/pstat.h machine/vmparam.h) AC_CHECK_HEADERS(sys/exec.h sys/pstat.h machine/vmparam.h)
AC_CHECK_HEADERS(sys/types.h sys/socket.h)
dnl ODBC headers... dnl ODBC headers...
AC_CHECK_HEADERS(sys/param.h pwd.h) AC_CHECK_HEADERS(sys/param.h pwd.h)
dnl dnl
...@@ -777,51 +699,16 @@ AC_TYPE_UID_T ...@@ -777,51 +699,16 @@ AC_TYPE_UID_T
AC_TYPE_MODE_T AC_TYPE_MODE_T
AC_TYPE_OFF_T AC_TYPE_OFF_T
AC_TYPE_SIZE_T AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
AC_STRUCT_TIMEZONE AC_STRUCT_TIMEZONE
PGAC_C_SIGNED
PGAC_C_VOLATILE
AC_FUNC_ACCEPT_ARGTYPES
AC_MSG_CHECKING(for signed types)
AC_TRY_COMPILE([],
[signed char c; signed short s; signed int i;],
[AC_MSG_RESULT(yes)],
[AC_DEFINE(signed, ) AC_MSG_RESULT(no)])
AC_MSG_CHECKING(for volatile)
AC_TRY_COMPILE([],
[extern volatile int i;],
[AC_MSG_RESULT(yes)],
[AC_DEFINE(volatile, ) AC_MSG_RESULT(no)])
AC_MSG_CHECKING(for type of last arg to accept)
AC_TRY_COMPILE([#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
],
[int a = accept(1, (struct sockaddr *) 0, (size_t *) 0);],
[AC_DEFINE(SOCKET_SIZE_TYPE, size_t) AC_MSG_RESULT(size_t)],
[AC_DEFINE(SOCKET_SIZE_TYPE, int) AC_MSG_RESULT(int)])
dnl Check for any "odd" conditions
AC_MSG_CHECKING(for int timezone)
AC_TRY_LINK([#include <time.h>],
[int res = timezone / 60; ],
[AC_DEFINE(HAVE_INT_TIMEZONE) AC_MSG_RESULT(yes)],
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for gettimeofday args) PGAC_VAR_INT_TIMEZONE
AC_TRY_LINK([#include <sys/time.h>], PGAC_FUNC_GETTIMEOFDAY_1ARG
[struct timeval *tp; struct timezone *tzp; gettimeofday(tp,tzp); ], PGAC_UNION_SEMUN
[AC_DEFINE(HAVE_GETTIMEOFDAY_2_ARGS) AC_MSG_RESULT(2 args)],
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for union semun)
AC_TRY_LINK([#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>],
[union semun semun;],
[AC_DEFINE(HAVE_UNION_SEMUN) AC_MSG_RESULT(yes)],
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for fcntl(F_SETLK)) AC_MSG_CHECKING(for fcntl(F_SETLK))
AC_TRY_LINK([#include <fcntl.h>], AC_TRY_LINK([#include <fcntl.h>],
...@@ -1011,74 +898,13 @@ dnl If there is no native snprintf() or it does not handle the 64-bit type, ...@@ -1011,74 +898,13 @@ dnl If there is no native snprintf() or it does not handle the 64-bit type,
dnl we force our own version of snprintf() to be used instead. dnl we force our own version of snprintf() to be used instead.
dnl Note this test must be run after our initial check for snprintf/vsnprintf. dnl Note this test must be run after our initial check for snprintf/vsnprintf.
HAVE_LONG_INT_64=0 PGAC_TYPE_64BIT_INT([long int])
AC_MSG_CHECKING(whether 'long int' is 64 bits)
AC_TRY_RUN([typedef long int int64;
/* These are globals to discourage the compiler from folding all the
* arithmetic tests down to compile-time constants.
*/
int64 a = 20000001;
int64 b = 40000005;
int does_int64_work()
{
int64 c,d;
if (sizeof(int64) != 8)
return 0; /* doesn't look like the right size */
/* Do perfunctory checks to see if 64-bit arithmetic seems to work */
c = a * b;
d = (c + b) / b;
if (d != a+1)
return 0;
return 1;
}
main() {
exit(! does_int64_work());
}],
[HAVE_LONG_INT_64=1
AC_DEFINE(HAVE_LONG_INT_64)
AC_MSG_RESULT(yes)],
AC_MSG_RESULT(no),
AC_MSG_RESULT(assuming not on target machine))
HAVE_LONG_LONG_INT_64=0
if [[ $HAVE_LONG_INT_64 -eq 0 ]] ; then
AC_MSG_CHECKING(whether 'long long int' is 64 bits)
AC_TRY_RUN([typedef long long int int64;
/* These are globals to discourage the compiler from folding all the
* arithmetic tests down to compile-time constants.
*/
int64 a = 20000001;
int64 b = 40000005;
int does_int64_work()
{
int64 c,d;
if (sizeof(int64) != 8)
return 0; /* doesn't look like the right size */
/* Do perfunctory checks to see if 64-bit arithmetic seems to work */ if test x"$HAVE_LONG_INT_64" = x"no" ; then
c = a * b; PGAC_TYPE_64BIT_INT([long long int])
d = (c + b) / b;
if (d != a+1)
return 0;
return 1;
}
main() {
exit(! does_int64_work());
}],
[HAVE_LONG_LONG_INT_64=1
AC_DEFINE(HAVE_LONG_LONG_INT_64)
AC_MSG_RESULT(yes)],
AC_MSG_RESULT(no),
AC_MSG_RESULT(assuming not on target machine))
fi fi
dnl If we found "long int" is 64 bits, assume snprintf handles it. dnl If we found "long int" is 64 bits, assume snprintf handles it.
dnl If we found we need to use "long long int", better check. dnl If we found we need to use "long long int", better check.
dnl We cope with snprintfs that use either %lld or %qd as the format. dnl We cope with snprintfs that use either %lld or %qd as the format.
...@@ -1173,87 +999,34 @@ AC_DEFINE_UNQUOTED(INT64_FORMAT, $INT64_FORMAT) ...@@ -1173,87 +999,34 @@ AC_DEFINE_UNQUOTED(INT64_FORMAT, $INT64_FORMAT)
dnl Determine memory alignment requirements for the basic C datatypes. dnl Determine memory alignment requirements for the basic C datatypes.
dnl CHECK_ALIGNOF(TYPE) PGAC_CHECK_ALIGNOF(short)
dnl This is modeled on the standard autoconf macro AC_CHECK_SIZEOF, PGAC_CHECK_ALIGNOF(int)
dnl except it finds the alignment requirement of the type instead of the size. PGAC_CHECK_ALIGNOF(long)
dnl The defined symbol is named ALIGNOF_TYPE, where the type name is
dnl converted in the same way as for AC_CHECK_SIZEOF.
dnl If cross-compiling, sizeof(type) is used as a default assumption.
AC_DEFUN(CHECK_ALIGNOF,
[changequote(<<, >>)dnl
dnl The name to #define.
define(<<AC_TYPE_NAME>>, translit(alignof_$1, [a-z *], [A-Z_P]))dnl
dnl The cache variable name.
define(<<AC_CV_NAME>>, translit(ac_cv_alignof_$1, [ *], [_p]))dnl
changequote([, ])dnl
AC_MSG_CHECKING(alignment of $1)
AC_CACHE_VAL(AC_CV_NAME,
[AC_TRY_RUN([#include <stdio.h>
struct { char filler; $1 field; } mystruct;
main()
{
FILE *f=fopen("conftestval", "w");
if (!f) exit(1);
fprintf(f, "%d\n", ((char*) & mystruct.field) - ((char*) & mystruct));
exit(0);
}], AC_CV_NAME=`cat conftestval`,
AC_CV_NAME='sizeof($1)',
AC_CV_NAME='sizeof($1)')])dnl
AC_MSG_RESULT($AC_CV_NAME)
AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
undefine([AC_TYPE_NAME])dnl
undefine([AC_CV_NAME])dnl
])
CHECK_ALIGNOF(short)
CHECK_ALIGNOF(int)
CHECK_ALIGNOF(long)
if [[ $HAVE_LONG_LONG_INT_64 -eq 1 ]] ; then if [[ $HAVE_LONG_LONG_INT_64 -eq 1 ]] ; then
CHECK_ALIGNOF(long long int) PGAC_CHECK_ALIGNOF(long long int)
fi fi
CHECK_ALIGNOF(double) PGAC_CHECK_ALIGNOF(double)
dnl Compute maximum alignment of any basic type. dnl Compute maximum alignment of any basic type.
dnl We assume long's alignment is at least as strong as char, short, or int; dnl We assume long's alignment is at least as strong as char, short, or int;
dnl but we must check long long (if it exists) and double. dnl but we must check long long (if it exists) and double.
if [[ $ac_cv_alignof_double != 'sizeof(double)' ]] ; then if test $pgac_cv_alignof_double != 'sizeof(double)' ; then
MAX_ALIGNOF="$ac_cv_alignof_long" MAX_ALIGNOF=$pgac_cv_alignof_long
if [[ $MAX_ALIGNOF -lt $ac_cv_alignof_double ]] ; then if test $MAX_ALIGNOF -lt $pgac_cv_alignof_double ; then
MAX_ALIGNOF="$ac_cv_alignof_double" MAX_ALIGNOF=$pgac_cv_alignof_double
fi fi
if [[ $HAVE_LONG_LONG_INT_64 -eq 1 ]] ; then if test $HAVE_LONG_LONG_INT_64 -eq 1 && test $MAX_ALIGNOF -lt $pgac_cv_alignof_long_long_int ; then
if [[ $MAX_ALIGNOF -lt $ac_cv_alignof_long_long_int ]] ; then MAX_ALIGNOF="$pgac_cv_alignof_long_long_int"
MAX_ALIGNOF="$ac_cv_alignof_long_long_int"
fi
fi fi
else else
dnl cross-compiling: assume that double's alignment is worst case dnl cross-compiling: assume that double's alignment is worst case
MAX_ALIGNOF="$ac_cv_alignof_double" MAX_ALIGNOF="$pgac_cv_alignof_double"
fi fi
AC_DEFINE_UNQUOTED(MAXIMUM_ALIGNOF, $MAX_ALIGNOF) AC_DEFINE_UNQUOTED(MAXIMUM_ALIGNOF, $MAX_ALIGNOF, [Define as the maximum alignment requirement of any type])
PGAC_FUNC_POSIX_SIGNALS
dnl Check to see if platform has POSIX signal interface.
dnl NOTE: if this test fails then POSIX signals definitely don't work.
dnl It could be that the test compiles but the POSIX routines don't
dnl really work ... in that case the platform-specific port files
dnl can unset USE_POSIX_SIGNALS and HAVE_POSIX_SIGNALS. (The former
dnl goes into config.h, the latter into Makefile.global.)
AC_MSG_CHECKING(for POSIX signal interface)
AC_TRY_LINK([#include <signal.h>],
[struct sigaction act, oact;
sigemptyset(&act.sa_mask);
act.sa_flags = SA_RESTART;
sigaction(0, &act, &oact);],
[AC_DEFINE(USE_POSIX_SIGNALS)
HAVE_POSIX_SIGNALS="1"
AC_MSG_RESULT(yes)],
[HAVE_POSIX_SIGNALS=""
AC_MSG_RESULT(no)])
AC_SUBST(HAVE_POSIX_SIGNALS)
dnl Check for Tcl configuration script tclConfig.sh dnl Check for Tcl configuration script tclConfig.sh
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
# #
# #
# IDENTIFICATION # IDENTIFICATION
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.76 2000/06/10 18:01:36 petere Exp $ # $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.77 2000/06/11 11:39:47 petere Exp $
# #
# NOTES # NOTES
# Essentially all Postgres make files include this file and use the # Essentially all Postgres make files include this file and use the
...@@ -99,9 +99,6 @@ ODBCINST= $(POSTGRESDIR) ...@@ -99,9 +99,6 @@ ODBCINST= $(POSTGRESDIR)
# To disable a feature, comment out the entire definition # To disable a feature, comment out the entire definition
# (that is, prepend '#', don't set it to "0" or "no"). # (that is, prepend '#', don't set it to "0" or "no").
# Compile libpq++
HAVE_Cplusplus=@HAVECXX@
# Comment out ENFORCE_ALIGNMENT if you do NOT want unaligned access to # Comment out ENFORCE_ALIGNMENT if you do NOT want unaligned access to
# multi-byte types to generate a bus error. # multi-byte types to generate a bus error.
ENFORCE_ALIGNMENT= true ENFORCE_ALIGNMENT= true
...@@ -170,22 +167,6 @@ INSTL_EXE_OPTS= @INSTL_EXE_OPTS@ ...@@ -170,22 +167,6 @@ INSTL_EXE_OPTS= @INSTL_EXE_OPTS@
INSTL_LIB_OPTS= @INSTL_LIB_OPTS@ INSTL_LIB_OPTS= @INSTL_LIB_OPTS@
INSTL_SHLIB_OPTS= @INSTL_SHLIB_OPTS@ INSTL_SHLIB_OPTS= @INSTL_SHLIB_OPTS@
##############################################################################
#
# For building shell scripts:
#
# For many ports, these are overridden below.
# DASH_N is what we put before the text on an echo command when we don't
# want a trailing newline. BACKSLASH_C is what we put at the end of the
# string on a echo command when we don't want a trailing newline. On
# some systems, you do echo -n "no newline after this", while on others
# you do echo "no newline after this\c".
DASH_N= @DASH_N@
BACKSLASH_C= @BACKSLASH_C@
#------------------------------------------------------------- #-------------------------------------------------------------
# See the subdirectory template for default settings for these # See the subdirectory template for default settings for these
...@@ -193,6 +174,7 @@ BACKSLASH_C= @BACKSLASH_C@ ...@@ -193,6 +174,7 @@ BACKSLASH_C= @BACKSLASH_C@
CC= @CC@ CC= @CC@
CPP= @CPP@ CPP= @CPP@
YACC= @YACC@ YACC= @YACC@
YFLAGS = @YFLAGS@
LEX= @LEX@ LEX= @LEX@
AROPT= @AROPT@ AROPT= @AROPT@
CFLAGS= -I$(SRCDIR)/include @CPPFLAGS@ @CFLAGS@ CFLAGS= -I$(SRCDIR)/include @CPPFLAGS@ @CFLAGS@
...@@ -275,7 +257,9 @@ ifneq ($(CUSTOM_COPT),) ...@@ -275,7 +257,9 @@ ifneq ($(CUSTOM_COPT),)
COPT= $(CUSTOM_COPT) COPT= $(CUSTOM_COPT)
endif endif
ifeq ($(CC), gcc) GCC = @GCC@
ifeq ($(GCC), yes)
CFLAGS+= -Wall -Wmissing-prototypes -Wmissing-declarations CFLAGS+= -Wall -Wmissing-prototypes -Wmissing-declarations
endif endif
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: pqcomm.c,v 1.96 2000/06/06 16:04:29 petere Exp $ * $Id: pqcomm.c,v 1.97 2000/06/11 11:39:50 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -315,7 +315,7 @@ StreamServerPort(int family, unsigned short portName, int *fdP) ...@@ -315,7 +315,7 @@ StreamServerPort(int family, unsigned short portName, int *fdP)
int int
StreamConnection(int server_fd, Port *port) StreamConnection(int server_fd, Port *port)
{ {
SOCKET_SIZE_TYPE addrlen; ACCEPT_TYPE_ARG3 addrlen;
/* accept connection (and fill in the client (remote) address) */ /* accept connection (and fill in the client (remote) address) */
addrlen = sizeof(port->raddr); addrlen = sizeof(port->raddr);
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/pqsignal.c,v 1.14 2000/01/26 05:56:29 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/libpq/pqsignal.c,v 1.15 2000/06/11 11:39:50 petere Exp $
* *
* NOTES * NOTES
* This shouldn't be in libpq, but the monitor and some other * This shouldn't be in libpq, but the monitor and some other
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* *
* A NOTE ABOUT SIGNAL HANDLING ACROSS THE VARIOUS PLATFORMS. * A NOTE ABOUT SIGNAL HANDLING ACROSS THE VARIOUS PLATFORMS.
* *
* config.h defines the macro USE_POSIX_SIGNALS for some platforms and * config.h defines the macro HAVE_POSIX_SIGNALS for some platforms and
* not for others. This file and pqsignal.h use that macro to decide * not for others. This file and pqsignal.h use that macro to decide
* how to handle signalling. * how to handle signalling.
* *
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
pqsigfunc pqsigfunc
pqsignal(int signo, pqsigfunc func) pqsignal(int signo, pqsigfunc func)
{ {
#if !defined(USE_POSIX_SIGNALS) #if !defined(HAVE_POSIX_SIGNALS)
return signal(signo, func); return signal(signo, func);
#else #else
struct sigaction act, struct sigaction act,
...@@ -61,5 +61,5 @@ pqsignal(int signo, pqsigfunc func) ...@@ -61,5 +61,5 @@ pqsignal(int signo, pqsigfunc func)
if (sigaction(signo, &act, &oact) < 0) if (sigaction(signo, &act, &oact) < 0)
return SIG_ERR; return SIG_ERR;
return oact.sa_handler; return oact.sa_handler;
#endif /* !USE_POSIX_SIGNALS */ #endif /* !HAVE_POSIX_SIGNALS */
} }
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* or in config.h afterwards. Of course, if you edit config.h, then your * or in config.h afterwards. Of course, if you edit config.h, then your
* changes will be overwritten the next time you run configure. * changes will be overwritten the next time you run configure.
* *
* $Id: config.h.in,v 1.117 2000/06/09 16:03:07 momjian Exp $ * $Id: config.h.in,v 1.118 2000/06/11 11:39:58 petere Exp $
*/ */
#ifndef CONFIG_H #ifndef CONFIG_H
...@@ -322,8 +322,8 @@ ...@@ -322,8 +322,8 @@
*/ */
/* Set to 1 if you gettimeofday(a,b) vs gettimeofday(a) */ /* Set to 1 if you gettimeofday(a,b) vs gettimeofday(a) */
#undef HAVE_GETTIMEOFDAY_2_ARGS #undef GETTIMEOFDAY_1ARG
#ifndef HAVE_GETTIMEOFDAY_2_ARGS #ifdef GETTIMEOFDAY_1ARG
# define gettimeofday(a,b) gettimeofday(a) # define gettimeofday(a,b) gettimeofday(a)
#endif #endif
...@@ -512,11 +512,11 @@ extern void srandom(unsigned int seed); ...@@ -512,11 +512,11 @@ extern void srandom(unsigned int seed);
#undef ALIGNOF_DOUBLE #undef ALIGNOF_DOUBLE
#undef MAXIMUM_ALIGNOF #undef MAXIMUM_ALIGNOF
/* Define as the base type of the last arg to accept */ /* Define as the type of the type of the 3rd argument to accept() */
#undef SOCKET_SIZE_TYPE #undef ACCEPT_TYPE_ARG3
/* Define if POSIX signal interface is available */ /* Define if POSIX signal interface is available */
#undef USE_POSIX_SIGNALS #undef HAVE_POSIX_SIGNALS
/* Define if C++ compiler accepts "using namespace std" */ /* Define if C++ compiler accepts "using namespace std" */
#undef HAVE_NAMESPACE_STD #undef HAVE_NAMESPACE_STD
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# #
# Copyright (c) 1994, Regents of the University of California # Copyright (c) 1994, Regents of the University of California
# #
# $Header: /cvsroot/pgsql/src/interfaces/Attic/Makefile.in,v 1.1 2000/06/10 18:01:48 petere Exp $ # $Header: /cvsroot/pgsql/src/interfaces/Attic/Makefile.in,v 1.2 2000/06/11 11:39:59 petere Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -16,14 +16,14 @@ top_builddir = ../.. ...@@ -16,14 +16,14 @@ top_builddir = ../..
USE_TCL = @USE_TCL@ USE_TCL = @USE_TCL@
USE_ODBC = @USE_ODBC@ USE_ODBC = @USE_ODBC@
WITH_CXX = @HAVECXX@ with_CXX = @with_CXX@
with_perl = @with_perl@ with_perl = @with_perl@
with_python = @with_python@ with_python = @with_python@
all install clean dep depend: all install clean dep depend:
$(MAKE) -C libpq $@ $(MAKE) -C libpq $@
$(MAKE) -C ecpg $@ $(MAKE) -C ecpg $@
ifeq ($(WITH_CXX), true) ifeq ($(with_CXX), yes)
$(MAKE) -C libpq++ $@ $(MAKE) -C libpq++ $@
endif endif
$(MAKE) -C libpgeasy $@ $(MAKE) -C libpgeasy $@
...@@ -41,12 +41,8 @@ ifeq ($(USE_ODBC), true) ...@@ -41,12 +41,8 @@ ifeq ($(USE_ODBC), true)
endif endif
distclean maintainer-clean: clean distclean maintainer-clean: clean
ifeq ($(with_perl), yes)
-$(MAKE) -C perl5 $@ -$(MAKE) -C perl5 $@
endif
ifeq ($(with_python), yes)
-$(MAKE) -C python $@ -$(MAKE) -C python $@
endif
rm -f Makefile \ rm -f Makefile \
libpq/Makefile \ libpq/Makefile \
ecpg/lib/Makefile \ ecpg/lib/Makefile \
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.128 2000/05/31 00:28:41 petere Exp $ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.129 2000/06/11 11:40:07 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1076,7 +1076,7 @@ keep_going: /* We will come back to here until there ...@@ -1076,7 +1076,7 @@ keep_going: /* We will come back to here until there
{ {
case CONNECTION_STARTED: case CONNECTION_STARTED:
{ {
SOCKET_SIZE_TYPE laddrlen; ACCEPT_TYPE_ARG3 laddrlen;
#ifndef WIN32 #ifndef WIN32
int optval; int optval;
...@@ -1085,7 +1085,7 @@ keep_going: /* We will come back to here until there ...@@ -1085,7 +1085,7 @@ keep_going: /* We will come back to here until there
char optval; char optval;
#endif #endif
SOCKET_SIZE_TYPE optlen = sizeof(optval); ACCEPT_TYPE_ARG3 optlen = sizeof(optval);
/* /*
* Write ready, since we've made it here, so the * Write ready, since we've made it here, so the
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/pqsignal.c,v 1.11 2000/01/26 05:58:46 momjian Exp $ * $Header: /cvsroot/pgsql/src/interfaces/libpq/pqsignal.c,v 1.12 2000/06/11 11:40:07 petere Exp $
* *
* NOTES * NOTES
* This shouldn't be in libpq, but the monitor and some other * This shouldn't be in libpq, but the monitor and some other
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
pqsigfunc pqsigfunc
pqsignal(int signo, pqsigfunc func) pqsignal(int signo, pqsigfunc func)
{ {
#if !defined(USE_POSIX_SIGNALS) #if !defined(HAVE_POSIX_SIGNALS)
return signal(signo, func); return signal(signo, func);
#else #else
struct sigaction act, struct sigaction act,
...@@ -39,5 +39,5 @@ pqsignal(int signo, pqsigfunc func) ...@@ -39,5 +39,5 @@ pqsignal(int signo, pqsigfunc func)
if (sigaction(signo, &act, &oact) < 0) if (sigaction(signo, &act, &oact) < 0)
return SIG_ERR; return SIG_ERR;
return oact.sa_handler; return oact.sa_handler;
#endif /* !USE_POSIX_SIGNALS */ #endif /* !HAVE_POSIX_SIGNALS */
} }
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#define strcasecmp(a,b) stricmp(a,b) #define strcasecmp(a,b) stricmp(a,b)
#define strncasecmp(a,b,c) _strnicmp(a,b,c) #define strncasecmp(a,b,c) _strnicmp(a,b,c)
#define SOCKET_SIZE_TYPE int #define ACCEPT_TYPE_ARG3 int
/* /*
* Some compat functions * Some compat functions
......
...@@ -7,7 +7,7 @@ LDFLAGS:= -lc $(LDFLAGS) ...@@ -7,7 +7,7 @@ LDFLAGS:= -lc $(LDFLAGS)
# On the other hand, if we don't have POSIX signals, we need to use the # On the other hand, if we don't have POSIX signals, we need to use the
# libBSD signal routines. (HPUX 9 and early HPUX 10 releases don't have # libBSD signal routines. (HPUX 9 and early HPUX 10 releases don't have
# POSIX signals.) Make sure libBSD comes before libc in that case. # POSIX signals.) Make sure libBSD comes before libc in that case.
ifeq ($(HAVE_POSIX_SIGNALS),) ifeq ($(HAVE_POSIX_SIGNALS), no)
LDFLAGS:= -lBSD $(LDFLAGS) LDFLAGS:= -lBSD $(LDFLAGS)
endif endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment