This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

fixing libmudflap configuration


I too a look at fixing libmudflap configuration, so
it can build (or fail gracefully) on MinGW.

The first problem I encountered was in mf-runtime.c.
The problem there is that mingw has signal.h, but it doesn't
define SIGUSR1.  The attached patch has a suggested fix.

The next problem was the wrappers in mf-hooks2.c including
lots of missing header files.  The patch to configure.in
and mf-hooks2.c is one solution, but perhaps not the right
one.  I'm guessing the intent that (say) WRAP_recv would be
defined iff recv is defined, but I don't understand how
that is supposed to work.

The next problem is somewhat puzzling. Now mf-runtime.c
again fails to compile, this time when building pth/mf-runtime.lo,
though ./mh-runtime.o does compile ok. The problem now is:
/home/bothner/GNU/MinGW/build/crossgcc_build/gcc/xgcc -
In file included from /home/bothner/GNU/MinGW/gcc/libmudflap/mf-runtime.c:68:
/home/bothner/GNU/MinGW/gcc/libmudflap/mf-impl.h:43:2: #error "Cannot build libm
udflapth without pthread.h."


And indeed, mingw doesn't have pthread.h, but I don't know
what the fallback is.
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/

? autom4te.cache
Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/configure.in,v
retrieving revision 1.3
diff -u -p -r1.3 configure.in
--- configure.in	1 Jun 2004 05:21:07 -0000	1.3
+++ configure.in	4 Jun 2004 00:13:47 -0000
@@ -62,7 +62,8 @@ AC_TRY_COMPILE([
 [AC_MSG_RESULT(no)
 enable_shared=no])
 
-AC_CHECK_HEADERS(stdint.h execinfo.h signal.h dlfcn.h)
+AC_CHECK_HEADERS(stdint.h execinfo.h signal.h dlfcn.h \
+  netdb.h sys/ipc.h sys/sem.h sys/wait.h sys/socket.h)
 AC_CHECK_FUNCS(backtrace backtrace_symbols gettimeofday signal)
 
 dnl Check for 64-bit stdio calls related to Large File Support
Index: mf-hooks2.c
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/mf-hooks2.c,v
retrieving revision 1.2
diff -u -p -r1.2 mf-hooks2.c
--- mf-hooks2.c	13 May 2004 06:41:03 -0000	1.2
+++ mf-hooks2.c	4 Jun 2004 00:13:47 -0000
@@ -1206,6 +1206,8 @@ WRAPPER2(struct dirent *, readdir, DIR *
 }
 #endif
 
+#ifdef HAVE_SYS_SOCKET_H
+
 #ifdef WRAP_recv
 #include <sys/socket.h>
 WRAPPER2(int, recv, int s, void *buf, size_t len, int flags)
@@ -1327,6 +1329,8 @@ WRAPPER2(int, connect, int sockfd, const
 }
 #endif
 
+#endif /* HAVE_SYS_SOCKET_H */
+
 #ifdef WRAP_gethostname
 WRAPPER2(int, gethostname, char *name, size_t len)
 {
@@ -1345,6 +1349,8 @@ WRAPPER2(int, sethostname, const char *n
 }
 #endif
 
+#ifdef HAVE_NETDB_H
+
 #ifdef WRAP_gethostbyname
 #include <netdb.h>
 WRAPPER2(struct hostent *, gethostbyname, const char *name)
@@ -1425,6 +1431,10 @@ WRAPPER2(struct hostent *, gethostbyname
 }
 #endif
 
+#endif /* HAVE_NETDB_H */
+
+#ifdef SYS_WAIT_H
+
 #ifdef WRAP_wait
 #include <sys/wait.h>
 WRAPPER2(pid_t, wait, int *status)
@@ -1449,6 +1459,8 @@ WRAPPER2(pid_t, waitpid, pid_t pid, int 
 }
 #endif
 
+#endif /* HAVE_SYS_WAIT_H */
+
 #ifdef WRAP_popen
 WRAPPER2(FILE *, popen, const char *command, const char *mode)
 {
@@ -1651,6 +1663,8 @@ WRAPPER2(void *, dlsym, void *handle, ch
 }
 #endif
 
+#if defined(HAVE_SYS_IPC_H) && defined(HAVE_SYS_SEM_H)
+
 #ifdef WRAP_semop
 #include <sys/ipc.h>
 #include <sys/sem.h>
@@ -1765,3 +1779,5 @@ WRAPPER2(int, shmdt, const void *shmaddr
 }
 #endif
 
+#endif /* defined(HAVE_SYS_IPC_H) && defined(HAVE_SYS_SEM_H) */
+
Index: mf-runtime.c
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/mf-runtime.c,v
retrieving revision 1.3
diff -u -p -r1.3 mf-runtime.c
--- mf-runtime.c	17 May 2004 20:34:18 -0000	1.3
+++ mf-runtime.c	4 Jun 2004 00:13:48 -0000
@@ -296,7 +296,7 @@ options [] =
     {"collect-stats", 
      "collect statistics on mudflap's operation",
      set_option, 1, &__mf_opts.collect_stats},
-#if HAVE_SIGNAL
+#ifdef SIGUSR1
     {"sigusr1-report",
      "print report upon SIGUSR1",
      set_option, 1, &__mf_opts.sigusr1_report},
@@ -2354,7 +2354,7 @@ __mf_sigusr1_respond ()
 {
   static int handler_installed;
 
-#if HAVE_SIGNAL
+#ifdef SIGUSR1
   /* Manage handler */
   if (__mf_opts.sigusr1_report && ! handler_installed)
     {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]