This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[PATCH] Fix libgfortran on darwin, hpux and cygwin (PR libfortran/24991)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org, fortran at gcc dot gnu dot org
- Date: Fri, 25 Nov 2005 17:49:15 -0500
- Subject: [PATCH] Fix libgfortran on darwin, hpux and cygwin (PR libfortran/24991)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
Turns out that in libstdc++-v3, some targets are explicitely defining
_GLIBCXX_GTHREAD_USE_WEAK to 0. This patch does the same.
It would be good if weakref support gets fixed for darwin, but if darwin
has pthread_* not in a separate library, there is no point in using weakref
on that platform.
Can anyone test it on darwin, please? I have tested this on x86_64-linux.
Ok for HEAD/4.1 if it succeeds there?
Is the other PR24991 patch,
http://gcc.gnu.org/ml/gcc-patches/2005-11/msg01687.html
ok as well?
2005-11-25 Jakub Jelinek <jakub@redhat.com>
libfortran/24991
* acinclude.m4 (LIBGFOR_CHECK_PRAGMA_WEAK): Rename to...
(LIBGFOR_GTHREAD_WEAK): ... this. Define SUPPORTS_WEAK rather
than HAVE_PRAGMA_WEAK. Define GTHREAD_USE_WEAK to 0 on hosts
that shouldn't use weak in gthr.h.
* configure.ac: Use LIBGFOR_GTHREAD_WEAK instead of
LIBGFOR_CHECK_PRAGMA_WEAK.
* config.h.in: Regenerated.
* configure: Regenerated.
* io/io.h (SUPPORTS_WEAK): Don't define here.
--- libgfortran/configure.ac.jj 2005-11-23 09:57:38.000000000 +0100
+++ libgfortran/configure.ac 2005-11-25 23:39:34.000000000 +0100
@@ -382,7 +382,7 @@ LIBGFOR_CHECK_SYNC_FETCH_AND_ADD
LIBGFOR_CHECK_GTHR_DEFAULT
# Check out #pragma weak.
-LIBGFOR_CHECK_PRAGMA_WEAK
+LIBGFOR_GTHREAD_WEAK
# Various other checks on target
LIBGFOR_CHECK_UNLINK_OPEN_FILE
--- libgfortran/config.h.in.jj 2005-11-19 09:45:44.000000000 +0100
+++ libgfortran/config.h.in 2005-11-25 23:39:45.000000000 +0100
@@ -3,6 +3,9 @@
/* Does gettimeofday take a single argument */
#undef GETTIMEOFDAY_ONE_ARGUMENT
+/* Define to 0 if the target shouldn't use #pragma weak */
+#undef GTHREAD_USE_WEAK
+
/* libm includes acos */
#undef HAVE_ACOS
@@ -465,9 +468,6 @@
/* libm includes powl */
#undef HAVE_POWL
-/* Define to 1 if the target supports #pragma weak */
-#undef HAVE_PRAGMA_WEAK
-
/* libm includes round */
#undef HAVE_ROUND
@@ -684,6 +684,9 @@
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
+/* Define to 1 if the target supports #pragma weak */
+#undef SUPPORTS_WEAK
+
/* Define to 1 if the target is ILP32. */
#undef TARGET_ILP32
--- libgfortran/acinclude.m4.jj 2005-11-23 10:00:19.000000000 +0100
+++ libgfortran/acinclude.m4 2005-11-25 23:42:44.000000000 +0100
@@ -177,7 +177,7 @@ target_thread_file=`$CC -v 2>&1 | sed -n
fi])
dnl Check for pragma weak.
-AC_DEFUN([LIBGFOR_CHECK_PRAGMA_WEAK], [
+AC_DEFUN([LIBGFOR_GTHREAD_WEAK], [
AC_CACHE_CHECK([whether pragma weak works],
have_pragma_weak, [
gfor_save_CFLAGS="$CFLAGS"
@@ -186,9 +186,15 @@ AC_DEFUN([LIBGFOR_CHECK_PRAGMA_WEAK], [
#pragma weak foo], [if (foo) foo ();],
have_pragma_weak=yes, have_pragma_weak=no)])
if test $have_pragma_weak = yes; then
- AC_DEFINE(HAVE_PRAGMA_WEAK, 1,
+ AC_DEFINE(SUPPORTS_WEAK, 1,
[Define to 1 if the target supports #pragma weak])
- fi])
+ fi
+ case "$host" in
+ *-*-darwin* | *-*-hpux* | *-*-cygwin*)
+ AC_DEFINE(GTHREAD_USE_WEAK, 0,
+ [Define to 0 if the target shouldn't use #pragma weak])
+ ;;
+ esac])
dnl Check whether target can unlink a file still open.
AC_DEFUN([LIBGFOR_CHECK_UNLINK_OPEN_FILE], [
--- libgfortran/configure.jj 2005-11-23 10:00:25.000000000 +0100
+++ libgfortran/configure 2005-11-25 23:42:50.000000000 +0100
@@ -20881,10 +20881,19 @@ echo "${ECHO_T}$have_pragma_weak" >&6
if test $have_pragma_weak = yes; then
cat >>confdefs.h <<\_ACEOF
-#define HAVE_PRAGMA_WEAK 1
+#define SUPPORTS_WEAK 1
_ACEOF
fi
+ case "$host" in
+ *-*-darwin* | *-*-hpux* | *-*-cygwin*)
+
+cat >>confdefs.h <<\_ACEOF
+#define GTHREAD_USE_WEAK 0
+_ACEOF
+
+ ;;
+ esac
# Various other checks on target
--- libgfortran/io/io.h.jj 2005-11-23 17:38:59.000000000 +0100
+++ libgfortran/io/io.h 2005-11-25 23:23:44.000000000 +0100
@@ -32,10 +32,6 @@ Boston, MA 02110-1301, USA. */
#include <setjmp.h>
#include "libgfortran.h"
-#ifdef HAVE_PRAGMA_WEAK
-/* Used by gthr.h. */
-#define SUPPORTS_WEAK 1
-#endif
#ifdef _AIX
#undef _LARGE_FILES
Jakub