From 0e47fe1fa6f9c4480959af0cc10a16281b5f29e7 Mon Sep 17 00:00:00 2001 From: "Eric J. Korpela" Date: Wed, 9 Feb 2005 19:39:04 +0000 Subject: [PATCH] -Unfortunately on some 32 bit systems there is a problem with wx-widgets configuring itself for largefile support. On these systems largefile support breaks C++ compiles by defining away many of the C standard library routines that should reside in namespace std::. In order to get around problem first we have to check the largefile support macros. Later we will use the macro SAH_LARGEFILE_BREAKS_CXX to check for the breakage. If if breakage is found LARGEFILE_BREAKS_CXX is defined in config.h. This define is checked in std_fixes.h and the appropriate functions are defined in order to solve the problem. (These functions were already in place) Because these defines affect the behavior of standard library headers, std_fixes.h is being included from config.h -Added AM_CPPFLAGS, AM_CFLAGS, and AM_CXXFLAGS (for flags common to all compiles) so they will be defined in all Makefile.am files. -Put #ifdef _cplusplus around the C++ specific items in std_fixes.h so it may be included from C source files. svn path=/trunk/boinc/; revision=5375 --- Makefile.incl | 7 ++++++- api/Makefile.am | 4 ++-- checkin_notes | 28 ++++++++++++++++++++++++++++ configure.ac | 16 ++++++++++++++++ lib/std_fixes.h | 13 ++++++++----- m4/sah_largefile_breaks_cxx.m4 | 27 +++++++++++++++++++++++++++ 6 files changed, 87 insertions(+), 8 deletions(-) create mode 100644 m4/sah_largefile_breaks_cxx.m4 diff --git a/Makefile.incl b/Makefile.incl index 466cde3715..e74eab65a6 100644 --- a/Makefile.incl +++ b/Makefile.incl @@ -22,7 +22,11 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/sched \ $(MYSQL_CFLAGS) \ $(PTHREAD_CFLAGS) \ - -include $(top_builddir)/config.h + -include $(top_srcdir)/config.h + +AM_CFLAGS = $(AM_CPPFLAGS) +AM_CXXFLAGS = $(AM_CPPFLAGS) +AM_LDFLAGS = # dependencies to make sure libs gets compiled before # programs linking to them: @@ -38,3 +42,4 @@ $(LIBSCHED): LIBBOINC = $(top_builddir)/libboinc.a $(LIBBOINC): cd $(top_builddir)/lib; ${MAKE} libboinc.a + diff --git a/api/Makefile.am b/api/Makefile.am index f4199f8185..5a3c3bc95c 100644 --- a/api/Makefile.am +++ b/api/Makefile.am @@ -3,8 +3,8 @@ include $(top_srcdir)/Makefile.incl -AM_CFLAGS = @GLUT_CFLAGS@ -AM_LDFLAGS = @GLUT_LIBS@ +AM_CFLAGS += @GLUT_CFLAGS@ +AM_LDFLAGS += @GLUT_LIBS@ api_files= \ boinc_api.C diff --git a/checkin_notes b/checkin_notes index e672514131..11773c4e6a 100755 --- a/checkin_notes +++ b/checkin_notes @@ -24333,6 +24333,8 @@ Bruce 8 Feb 2005 sched_config.C sched_config.h + + Bruce 8 Feb 2005 - Turn off ops pages that update the data base. These now issue a message informing the project admin that they need to be explicitly edited to @@ -24359,3 +24361,29 @@ David 9 Feb 2005 client/ app_control.C client_state.h + +Eric K. 9 Feb 2005 + -Unfortunately on some 32 bit systems there is a problem with wx-widgets + configuring itself for largefile support. On these systems largefile + support breaks C++ compiles by defining away many of the C standard library + routines that should reside in namespace std::. In order to get around + problem first we have to check the largefile support macros. Later we will + use the macro SAH_LARGEFILE_BREAKS_CXX to check for the breakage. If + if breakage is found LARGEFILE_BREAKS_CXX is defined in config.h. This + define is checked in std_fixes.h and the appropriate functions are defined + in order to solve the problem. (These functions were already in place) + Because these defines affect the behavior of standard library headers, + std_fixes.h is being included from config.h + -Added AM_CPPFLAGS, AM_CFLAGS, and AM_CXXFLAGS (for flags common to all + compiles) so they will be defined in all Makefile.am files. + -Put #ifdef _cplusplus around the C++ specific items in std_fixes.h so it + may be included from C source files. + + configure.ac + Makefile.incl + m4/ + sah_largefile_breaks_cxx.m4 + api/ + Makefile.am + lib/ + std_fixes.h diff --git a/configure.ac b/configure.ac index 5288a6552c..23fbd34498 100644 --- a/configure.ac +++ b/configure.ac @@ -112,6 +112,18 @@ AC_PROG_MAKE_SET AC_PROG_RANLIB AC_PROG_LN_S +dnl Unfortunately on some 32 bit systems there is a problem with wx-widgets +dnl configuring itself for largefile support. On these systems largefile +dnl support breaks C++ compiles by defining away many of the C standard library +dnl routines that should reside in namespace std::. In order to get around +dnl problem first we have to check the largefile support macros. Later we will +dnl use the macro SAH_LARGEFILE_BREAKS_CXX to check for the breakage. If +dnl if breakage is found LARGEFILE_BREAKS_CXX is defined in config.h. This +dnl define is checked in std_fixes.h and the appropriate functions are defined +dnl in order to solve the problem. +AC_SYS_LARGEFILE + + if test "${enable_server}" = yes; then AC_CHECK_MYSQL if test "${no_mysql}" = yes; then @@ -197,6 +209,9 @@ AH_TOP([ ]) AH_BOTTOM([ +/* include fixes for the most common problems */ +#include "std_fixes.h" + /* end double-inclusion protection for config.h */ #endif /* #ifndef BOINC_CONFIG_H */ ]) @@ -211,6 +226,7 @@ AC_TYPE_SIGNAL AC_CHECK_HEADERS(arpa/inet.h dirent.h fcntl.h malloc.h netdb.h netinet/in.h netinet/tcp.h signal.h strings.h sys/file.h sys/ipc.h sys/mount.h sys/param.h sys/resource.h sys/select.h sys/shm.h sys/socket.h sys/stat.h sys/statvfs.h sys/statfs.h sys/swap.h sys/sysctl.h sys/systeminfo.h sys/time.h sys/types.h sys/utsname.h sys/vmmeter.h sys/wait.h unistd.h utmp.h errno.h procfs.h) AC_LANG_PUSH(C++) +SAH_LARGEFILE_BREAKS_CXX SAH_HEADER_STDCXX SAH_CHECK_NAMESPACES AH_TEMPLATE([HAVE_STD_MIN],[Define to 1 if min is in namespace std::]) diff --git a/lib/std_fixes.h b/lib/std_fixes.h index d6337548b5..7fb7e493c7 100644 --- a/lib/std_fixes.h +++ b/lib/std_fixes.h @@ -20,6 +20,8 @@ #ifndef _STD_FIXES_H_ #define _STD_FIXES_H_ +#ifdef __cplusplus + #ifndef CONFIG_TEST #ifndef HAVE_STD_MIN @@ -34,7 +36,7 @@ inline T min(const T &a, const T &b) { return ((a @@ -70,8 +72,8 @@ o_iterator transform(i_iterator first, i_iterator last, o_iterator res, OP op) { } -#endif -#endif +#endif /* HAVE_STD_TRANSFORM */ +#endif /* CONFIG_TEST */ #if defined(LARGEFILE_BREAKS_CXX) && (defined(_LARGE_FILES) || (_FILE_OFFSET_BITS==64)) @@ -113,5 +115,6 @@ inline int open(const char *filename, int flags, mode_t mode) { return open64(fi inline int creat(const char *filename, mode_t mode) { return creat64(filename,mode); } #endif -#endif +#endif /* __cplusplus */ +#endif /* STD_FIXES_H */ diff --git a/m4/sah_largefile_breaks_cxx.m4 b/m4/sah_largefile_breaks_cxx.m4 new file mode 100644 index 0000000000..15b95cf9a0 --- /dev/null +++ b/m4/sah_largefile_breaks_cxx.m4 @@ -0,0 +1,27 @@ +# SETI_BOINC is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2, or (at your option) any later +# version. + +AC_DEFUN([SAH_LARGEFILE_BREAKS_CXX],[ + AC_MSG_CHECKING([whether largefile support breaks C++]) + AC_LANG_PUSH(C++) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[ + #define CONFIG_TEST + #include + ]], + [[ + std::cout << 1.0 << std::endl; + ]])], + [tmp_res="no"], + [AC_DEFINE([LARGEFILE_BREAKS_CXX],[1], + ["Define to 1 if largefile support causes missing symbols in C++"] ) + tmp_res="yes" + sah_cxx_includes=`echo "#include \"$TOP_BUILD_DIR/lib/std_fixes.h\"" ; echo $sah_cxx_includes` + ] + ) + AC_MSG_RESULT($tmp_res) + AC_LANG_POP +]) +