This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa libmudflap] bsd build fixes
Hi,
I did some further digging, and believe I now have explanations (and
suggested changes for everything). ;-)
On Tue, 29 Jul 2003, Frank Ch. Eigler wrote:
> Given the way the HAVE_UNION_SEMUN is computed in configure.in,
> config.h will always have the macro defined to 1 or 0 and thus
> #ifndef will always fail. If "#if ! HAVE_UNION_SEMUN" doesn't
> work for some reason, let's find out why.
Q: Why was HAVE_UNION_SEMUN not set on FreeBSD?
A: #include <sys/types.h> was missing from the configure test.
I have included this in the patch below.
Q: Why was I confused by the original code (and thus broke Linux)?
A: In autoconf, it is common to either use #define HAVE_SOMETHING 1
or not defining HAVE_SOMETHING at all, while #define HAVE_SOMETHING 0
is not commonly use (see the generated config.h for libmudflag, for
example).
I couldn't fully test the patch below and won't be able to install it,
as I don't have such an old version of autoconf available. Generating
configure with autoconf 2.57 and testing on i686-pc-linux-gnu and
i386-unknown-freebsd4.8 produced config.h as I would have expected.
Thanks (and sorry),
Gerald
2003-07-29 Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
* configure.in: Update check for union semun.
Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/Attic/configure.in,v
retrieving revision 1.1.2.17
diff -u -3 -p -r1.1.2.17 configure.in
--- configure.in 29 Jul 2003 18:13:01 -0000 1.1.2.17
+++ configure.in 29 Jul 2003 20:25:59 -0000
@@ -45,9 +45,12 @@ AC_CHECK_FUNCS(backtrace backtrace_symbo
dnl Check for 64-bit stdio calls related to Large File Support
AC_CHECK_FUNCS(fopen64 fseeko64 ftello64 stat64)
-AC_TRY_COMPILE([#include <sys/ipc.h>
+AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/ipc.h>
#include <sys/sem.h>],[union semun foo;], [mf_have_semun=1], [mf_have_semun=0])
-AC_DEFINE_UNQUOTED(HAVE_UNION_SEMUN, $mf_have_semun, [union semun defined in sys/ipc.h or sys/sem.h])
+if test $mf_have_sem = 1
+ AC_DEFINE_UNQUOTED(HAVE_UNION_SEMUN, 1, [union semun defined in sys/ipc.h or sys/sem.h])
+fi
AC_LIBTOOL_DLOPEN
AM_PROG_LIBTOOL