suppressing -lm for g++ links

Fred Fish fnf@ninemoons.com
Fri Jun 26 18:00:00 GMT 1998


BeOS does not have or need -lm.  This is how I fixed it in my current
BeOS port:

Index: ChangeLog
===================================================================
RCS file: /cvsroot/gg/playpen/egcs/gcc/ChangeLog,v
retrieving revision 1.10
diff -c -r1.10 ChangeLog
*** ChangeLog	1998/06/25 18:28:40	1.10
--- ChangeLog	1998/06/27 00:26:53
***************
*** 1,3 ****
--- 1,7 ----
+ Fri Jun 26 15:57:15 1998  Fred Fish  <fnf@ninemoons.com>
+ 
+ 	* config/i386/beos.h (NEED_MATH_LIBRARY): Define to zero.
+ 
  Thu Jun 25 09:23:28 1998  Fred Fish  <fnf@ninemoons.com>
  
  	* config/i386/beos.h (TARGET_DEFAULT): Enable MASK_STICKY_DLLIMPORT
Index: config/i386/beos.h
===================================================================
RCS file: /cvsroot/gg/playpen/egcs/gcc/config/i386/beos.h,v
retrieving revision 1.9
diff -c -r1.9 beos.h
*** beos.h	1998/06/25 18:28:44	1.9
--- beos.h	1998/06/27 00:26:56
***************
*** 396,398 ****
--- 396,401 ----
  #define CC1_SPEC "%{!fbuiltin: -fno-builtin}"
  #undef CC1PLUS_SPEC
  #define CC1PLUS_SPEC "%{!fbuiltin: -fno-builtin}"
+ 
+ /* BeOS does not have or need the math library. */
+ #define NEED_MATH_LIBRARY 0
Index: cp/ChangeLog
===================================================================
RCS file: /cvsroot/gg/playpen/egcs/gcc/cp/ChangeLog,v
retrieving revision 1.2
diff -c -r1.2 ChangeLog
*** ChangeLog	1998/06/25 18:27:16	1.2
--- ChangeLog	1998/06/27 00:26:58
***************
*** 1,3 ****
--- 1,9 ----
+ Fri Jun 26 15:50:40 1998  Fred Fish  <fnf@ninemoons.com>
+ 
+ 	* g++spec.c (NEED_MATH_LIBRARY): Define to 1 if not already defined.
+ 	(lang_specific_driver): Initialize need_math with NEED_MATH_LIBRARY.
+  	(lang_specific_driver): Only add -lm automatically if need_math is nonzero.
+ 
  Sat Jun 20 21:47:00 1998  Alastair J. Houghton <ajh8@doc.ic.ac.uk>
  
  	Changes to better support __attribute__ keyword:
Index: cp/g++spec.c
===================================================================
RCS file: /cvsroot/gg/playpen/egcs/gcc/cp/g++spec.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 g++spec.c
*** g++spec.c	1998/06/02 17:47:00	1.1.1.1
--- g++spec.c	1998/06/27 00:26:58
***************
*** 34,39 ****
--- 34,42 ----
  #ifndef MATH_LIBRARY
  #define MATH_LIBRARY "-lm"
  #endif
+ #ifndef NEED_MATH_LIBRARY
+ #define NEED_MATH_LIBRARY 1	/* Default is pass MATH_LIBRARY to linker */
+ #endif
  
  extern char *xmalloc PROTO((size_t));
  
***************
*** 81,87 ****
    int *args;
  
    /* By default, we throw on the math library.  */
!   int need_math = 1;
  
    /* The total number of arguments with the new stuff.  */
    int argc;
--- 84,90 ----
    int *args;
  
    /* By default, we throw on the math library.  */
!   int need_math = NEED_MATH_LIBRARY;
  
    /* The total number of arguments with the new stuff.  */
    int argc;
***************
*** 241,247 ****
      }
    if (saw_math)
      arglist[j++] = saw_math;
!   else if (library)
      {
        arglist[j++] = MATH_LIBRARY;
        added_libraries++;
--- 244,250 ----
      }
    if (saw_math)
      arglist[j++] = saw_math;
!   else if (library && need_math)
      {
        arglist[j++] = MATH_LIBRARY;
        added_libraries++;




More information about the Gcc-patches mailing list