[PATCH] libmx and Darwin

Andrew Pinski apinski@apple.com
Thu Jun 24 09:53:00 GMT 2004


It was decided that libmx (by Apple) should be automatically linked in 
for every
language and not just C++ and fortran.  This patch does not and removes 
the check
in libstdc++ for libmx and the one in libgfortran because they are no 
longer needed
and are just redundant.


OK? Bootstrapped on powerpc-apple-darwin7.4.0 and 
powerpc-apple-darwin6.x.
I do not know why there was an undefine for LIB_SPEC as this had to 
effect at all.

Thanks,
Andrew Pinski

gcc/ChangeLog:
	* config/darwin7.h (MATH_LIBRARY): Remove.
	(LIB_SPEC): Define.
	* config/darwin.h (MATH_LIBRARY): Define always to empty.
	(LIB_SPEC): Only define if not already defined.

libstdc++/ChangeLog:
	* linkage.m4: Remove check for libmx.	
	* configure: Regenerate.

libgfortran/ChangeLog:
	* configure.ac: Remove check for libmx.
	* configure: Regenerate.


Index: config/darwin7.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/darwin7.h,v
retrieving revision 1.1
diff -u -p -r1.1 darwin7.h
--- config/darwin7.h	23 Apr 2004 17:56:07 -0000	1.1
+++ config/darwin7.h	24 Jun 2004 05:33:01 -0000
@@ -22,7 +22,8 @@ Boston, MA 02111-1307, USA.  */
  /* Darwin 7.0 and above have C99 functions.   */
  #define TARGET_C99_FUNCTIONS 1

-/* But for some reason they are located in libmx so have it
-   be included when asked for and automatically when linking
-   with gfortran and g++.   */
-#define MATH_LIBRARY "-lmx"
+/* Machine dependent libraries, include libmx when compiling on Darwin 
7.0
+   and above.  */
+
+#undef	LIB_SPEC
+#define LIB_SPEC "%{!static:-lSystem -lmx}"
Index: config/darwin.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/darwin.h,v
retrieving revision 1.81
diff -u -p -r1.81 darwin.h
--- config/darwin.h	3 Jun 2004 23:15:00 -0000	1.81
+++ config/darwin.h	24 Jun 2004 05:33:01 -0000
@@ -39,13 +39,8 @@ Boston, MA 02111-1307, USA.  */

  #define OBJECT_FORMAT_MACHO

-/* Suppress g++ attempt to link in the math library automatically.
-   (Some Darwin versions have a libm, but they seem to cause problems
-   for C++ executables.) This needs to be -lmx for Darwin 7.0 and
-   above.  */
-#ifndef MATH_LIBRARY
+/* Suppress g++ attempt to link in the math library automatically. */
  #define MATH_LIBRARY ""
-#endif

  /* We have atexit.  */

@@ -276,10 +271,12 @@ Boston, MA 02111-1307, USA.  */
     %{dylinker} %{Mach} "


-/* Machine dependent libraries.  */
+/* Machine dependent libraries but do not redefine it if we already on 
7.0 and
+   above as it needs to link with libmx also.  */

-#undef	LIB_SPEC
+#ifndef	LIB_SPEC
  #define LIB_SPEC "%{!static:-lSystem}"
+#endif

  /* We specify crt0.o as -lcrt0.o so that ld will search the library 
path.  */

Index: linkage.m4
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/linkage.m4,v
retrieving revision 1.8
diff -u -p -r1.8 linkage.m4
--- linkage.m4	9 Jun 2004 07:26:28 -0000	1.8
+++ linkage.m4	24 Jun 2004 05:31:15 -0000
@@ -380,11 +380,6 @@ AC_DEFUN([GLIBCXX_CHECK_MATH_SUPPORT], [
    ac_save_LIBS="$LIBS"
    LIBS="$LIBS $libm"

-  dnl Check libmx
-  AC_CHECK_LIB(mx, sqrtf, libmx="-lmx")
-  dnl ac_save_LIBS="$LIBS"
-  LIBS="$LIBS $libmx"
-
    dnl Check to see if certain C math functions exist.
    GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(isinf)
    GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(isnan)

Index: configure.ac
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/configure.ac,v
retrieving revision 1.3
diff -u -p -r1.3 configure.ac
--- configure.ac	13 Jun 2004 22:58:30 -0000	1.3
+++ configure.ac	24 Jun 2004 05:35:15 -0000
@@ -160,9 +160,6 @@ AC_CHECK_HEADER([complex.h],[AC_DEFINE([
  # Check for complex math functions
  AC_CHECK_LIB([m],[csin],[need_math="no"],[need_math="yes"])

-# Check for complex math functions in -lmx also
-AC_CHECK_LIB([mx],[csin],[need_math="no"],[need_math="yes"])
-
  # Check for library functions.
  AC_CHECK_FUNCS(getrusage times)



More information about the Gcc-patches mailing list