comparison configure.ac @ 4991:97c45e3ad810

implement configure test for whether ndbm.h prototypes are broken -------------------- ChangeLog entries follow: -------------------- ChangeLog addition: 2010-02-06 Ben Wing <ben@xemacs.org> * configure: * configure.ac (AC_LANG): * configure.ac (TAB): Add AC_LANG(C++) defs in a way very similar to AC_LANG(C), inserting our own flags, compiler, etc. When using g++, if we found ndbm, check whether we can compile a file using g++ and ndbm.h, calling some DBM routines. Currently, this fails because the prototypes in ndbm.h are incomplete, omitting the arguments, which doesn't work with g++. When ndbm.h is bad, we don't include it and instead provide our own prototypes; otherwise, we define TRUST_NDBM_H_PROTOTYPES, which signals to use the ones in ndbm.h. src/ChangeLog addition: 2010-02-06 Ben Wing <ben@xemacs.org> * config.h.in: Add undef for TRUST_NDBM_H_PROTOTYPES. * database.c: * database.c (struct): Use TRUST_NDBM_H_PROTOTYPES to determine whether to include ndbm.h or to specify our own prototypes, in place of CYGWIN_HEADERS (or more generally, any random list of systems). * depend: Regenerate.
author Ben Wing <ben@xemacs.org>
date Sat, 06 Feb 2010 03:26:34 -0600
parents cbe181529c34
children 2ade80e8c640
comparison
equal deleted inserted replaced
4983:fbcf988fbb33 4991:97c45e3ad810
11 xe_ldflags='$LDFLAGS $ld_switch_site $ld_switch_machine $ld_switch_system $ld_switch_x_site $ld_switch_run' 11 xe_ldflags='$LDFLAGS $ld_switch_site $ld_switch_machine $ld_switch_system $ld_switch_x_site $ld_switch_run'
12 xe_libs='$ld_call_shared $xe_check_libs $X_EXTRA_LIBS $libs_x $libs_gtk $X_PRE_LIBS $LIBS $libs_machine $libs_system $libs_standard' 12 xe_libs='$ld_call_shared $xe_check_libs $X_EXTRA_LIBS $libs_x $libs_gtk $X_PRE_LIBS $LIBS $libs_machine $libs_system $libs_standard'
13 ac_cpp='$CPP '"$xe_cppflags" 13 ac_cpp='$CPP '"$xe_cppflags"
14 ac_compile='$CC -c $CFLAGS '"$xe_cppflags"' conftest.$ac_ext >&AS_MESSAGE_LOG_FD' 14 ac_compile='$CC -c $CFLAGS '"$xe_cppflags"' conftest.$ac_ext >&AS_MESSAGE_LOG_FD'
15 ac_link='$CC -o conftest$ac_exeext $CFLAGS '"$xe_cppflags $xe_ldflags"' conftest.$ac_ext '"$xe_libs"' >&AS_MESSAGE_LOG_FD' 15 ac_link='$CC -o conftest$ac_exeext $CFLAGS '"$xe_cppflags $xe_ldflags"' conftest.$ac_ext '"$xe_libs"' >&AS_MESSAGE_LOG_FD'
16 ac_compiler_gnu=$ac_cv_c_compiler_gnu
17 ])
18 # AC_LANG(C++)
19 # ----------
20 # Similar to AC_LANG(C) but we use XEMACS_CC, which may be g++.
21 m4_define([AC_LANG(C++)],
22 [ac_ext=c
23 xe_cppflags='$CPPFLAGS $c_switch_site $c_switch_machine $c_switch_system $c_switch_x_site $X_CFLAGS'
24 xe_ldflags='$LDFLAGS $ld_switch_site $ld_switch_machine $ld_switch_system $ld_switch_x_site $ld_switch_run'
25 xe_libs='$ld_call_shared $xe_check_libs $X_EXTRA_LIBS $libs_x $libs_gtk $X_PRE_LIBS $LIBS $libs_machine $libs_system $libs_standard'
26 ac_cpp='$CPP '"$xe_cppflags"
27 ac_compile='$XEMACS_CC -c $CFLAGS '"$xe_cppflags"' conftest.$ac_ext >&AS_MESSAGE_LOG_FD'
28 ac_link='$XEMACS_CC -o conftest$ac_exeext $CFLAGS '"$xe_cppflags $xe_ldflags"' conftest.$ac_ext '"$xe_libs"' >&AS_MESSAGE_LOG_FD'
16 ac_compiler_gnu=$ac_cv_c_compiler_gnu 29 ac_compiler_gnu=$ac_cv_c_compiler_gnu
17 ]) 30 ])
18 dnl 31 dnl
19 dnl ------------------------------------------------------------------------- 32 dnl -------------------------------------------------------------------------
20 dnl Autoconf startup. 33 dnl Autoconf startup.
5080 test -n "$libdbm" && XE_PREPEND("$libdbm", LIBS) 5093 test -n "$libdbm" && XE_PREPEND("$libdbm", LIBS)
5081 if test "$with_database_gdbm" = "yes" -o \ 5094 if test "$with_database_gdbm" = "yes" -o \
5082 "$with_database_dbm" = "yes"; then 5095 "$with_database_dbm" = "yes"; then
5083 AC_DEFINE_UNQUOTED(NDBM_H_FILE,"$ndbm_h_file") 5096 AC_DEFINE_UNQUOTED(NDBM_H_FILE,"$ndbm_h_file")
5084 AC_DEFINE(HAVE_DBM) 5097 AC_DEFINE(HAVE_DBM)
5098 dnl gdbm's ndbm.h has old-style prototypes with missing arguments.
5099 dnl These just don't cut it for c++. So if we're using c++, then
5100 dnl test whether we can make a dbm call, using dbm_close(DBM *).
5101 if test "$XEMACS_CC_GPP" = "yes"; then
5102 AC_MSG_RESULT()
5103 AC_LANG_PUSH(C++)
5104 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include "$ndbm_h_file"],
5105 [dbm_close((DBM *) 0);])],
5106 [AC_MSG_CHECKING(whether ndbm.h is compatible with g++)
5107 AC_MSG_RESULT(yes)
5108 AC_DEFINE(TRUST_NDBM_H_PROTOTYPES)],
5109 [AC_MSG_CHECKING(whether ndbm.h is compatible with g++)
5110 AC_MSG_RESULT(no)])
5111 AC_LANG_POP()
5112 else
5113 AC_DEFINE(TRUST_NDBM_H_PROTOTYPES)
5114 fi
5085 $as_unset ndbm_h_file 5115 $as_unset ndbm_h_file
5086 fi 5116 fi
5087 5117
5088 dnl Check for u_int*_t typedefs. 5118 dnl Check for u_int*_t typedefs.
5089 AC_CHECK_TYPES([u_int8_t, u_int16_t, u_int32_t]) 5119 AC_CHECK_TYPES([u_int8_t, u_int16_t, u_int32_t])