This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java 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]

Patch: FYI: PR libgcj/30606


I'm checking this in.

This changes configure to look for magic_t in magic.h.
This fixes a build bug for platforms that have magic.h but no magic_t,
aka PR 30606.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	PR libgcj/30606:
	* configure, include/config.h.in: Rebuilt.
	* configure.ac: Check for magic_t in magic.h.
	* java/net/natVMURLConnection.cc: Use HAVE_MAGIC_T.

Index: configure.ac
===================================================================
--- configure.ac	(revision 121362)
+++ configure.ac	(working copy)
@@ -1383,6 +1383,11 @@
 AC_HEADER_SYS_WAIT
 
 AC_CHECK_TYPE([ssize_t], [int])
+AC_CHECK_TYPE([magic_t], [
+    AC_DEFINE(HAVE_MAGIC_T, 1, [Define if magic.h declares magic_t])], [], [
+#ifdef HAVE_MAGIC_H
+#include <magic.h>
+#endif])
 
 AC_MSG_CHECKING([for in_addr_t])
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
Index: java/net/natVMURLConnection.cc
===================================================================
--- java/net/natVMURLConnection.cc	(revision 121362)
+++ java/net/natVMURLConnection.cc	(working copy)
@@ -13,7 +13,7 @@
 #include <java/lang/UnsupportedOperationException.h>
 #include <stdio.h>
 
-#if defined (HAVE_MAGIC_H) && defined (USE_LTDL)
+#if defined (HAVE_MAGIC_T) && defined (HAVE_MAGIC_H) && defined (USE_LTDL)
 
 #include <magic.h>
 #include <ltdl.h>
@@ -26,12 +26,12 @@
 static const char * (*p_magic_buffer) (magic_t cookie, const void *buffer,
 				       size_t length);
 
-#endif /* HAVE_MAGIC_H && defined (USE_LTDL) */
+#endif /* HAVE_MAGIC_T && HAVE_MAGIC_H && defined (USE_LTDL) */
 
 void
 java::net::VMURLConnection::init ()
 {
-#if defined (HAVE_MAGIC_H) && defined (USE_LTDL)
+#if defined (HAVE_MAGIC_T) && defined (HAVE_MAGIC_H) && defined (USE_LTDL)
   lt_dlhandle handle = lt_dlopenext ("libmagic.so");
   if (!handle)
     return;
@@ -57,14 +57,14 @@
       p_magic_close (cookie);
       cookie = (magic_t) NULL;
     }
-#endif /* HAVE_MAGIC_H  && defined (USE_LTDL) */
+#endif /* HAVE_MAGIC_T && HAVE_MAGIC_H  && defined (USE_LTDL) */
 }
 
 ::java::lang::String *
 java::net::VMURLConnection::guessContentTypeFromBuffer (jbyteArray bytes,
 							jint valid)
 {
-#if defined (HAVE_MAGIC_H) && defined (USE_LTDL)
+#if defined (HAVE_MAGIC_T) && defined (HAVE_MAGIC_H) && defined (USE_LTDL)
   const char *result;
 
   if (cookie == (magic_t) NULL)
@@ -77,5 +77,5 @@
   return _Jv_NewStringUTF (result);
 #else
   return NULL;
-#endif /* HAVE_MAGIC_H  && defined (USE_LTDL) */
+#endif /* HAVE_MAGIC_T && HAVE_MAGIC_H  && defined (USE_LTDL) */
 }


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