[m-dev.] diff: fix portability problem with `-lm'

Tyson Dowd trd at cs.mu.OZ.AU
Sun Sep 24 18:21:50 AEDT 2000


On 23-Sep-2000, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> On 22-Sep-2000, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > Estimated hours taken: 1
> > 
> > Fix a portability problem: we were assuming that `-lm' would work, but
> > on some systems, e.g. MacOS X (Darwin), it doesn't.
> 
> In my haste to get down to the pub on Friday night,
> I committed that one a little too hastily...
> 
> ----------
> 
> Estimated hours taken: 0.25
> 
> configure.in:
> 	Fix a bug in my previous fix for the `-lm' portability problem.
> 	I was using the wrong syntax for variable references (Make syntax
> 	rather than sh syntax).
> 

Unfortunately this is wrong too.

SHARED_LIBS is used in Mmake.common and scripts/ml

So it has to work both in sh and make.

This is one solution, but I don't like it very much.

Index: configure.in
===================================================================
RCS file: /home/mercury1/repository/mercury/configure.in,v
retrieving revision 1.227
diff -u -r1.227 configure.in
--- configure.in	2000/09/23 12:59:10	1.227
+++ configure.in	2000/09/24 07:13:22
@@ -2018,7 +2018,8 @@
 # see Mmake.common.in for documentation on the meaning of these variables
 LINK_SHARED_OBJ="$CC -shared"
 LINK_SHARED_OBJ_SH="$CC -shared"
-SHARED_LIBS='`gcc -print-libgcc-file-name` $MATH_LIB -lc'
+SHARED_LIBS='`gcc -print-libgcc-file-name` $(MATH_LIB) -lc'
+SHARED_LIBS_SH='`gcc -print-libgcc-file-name` $MATH_LIB -lc'
 EXE_RPATH_OPT="-Wl,-rpath,"
 EXE_RPATH_SEP=" -Wl,-rpath,"
 SHLIB_RPATH_OPT="-Wl,-rpath,"
@@ -2055,7 +2056,8 @@
 		;;
 	sparc-sun-solaris2.*)
 		AC_MSG_RESULT(yes)
-		SHARED_LIBS="$MATH_LIB -lc"	# don't link in libgcc.a
+		SHARED_LIBS="$(MATH_LIB) -lc"	# don't link in libgcc.a
+		SHARED_LIBS_SH="$MATH_LIB -lc"	# don't link in libgcc.a
 		LINK_SHARED_OBJ="$CC -G"
 		LINK_SHARED_OBJ_SH="$CC -G"
 		ERROR_UNDEFINED="-Wl,-z,defs"
@@ -2209,6 +2211,7 @@
 AC_SUBST(EXT_FOR_EXE)
 AC_SUBST(USE_DLLS)
 AC_SUBST(SHARED_LIBS)
+AC_SUBST(SHARED_LIBS_SH)
 AC_SUBST(DEFAULT_RM_C)
 AC_SUBST(LIBRARY_RM_C)
 if test $USE_DLLS = "yes"; then
Index: scripts/ml.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/ml.in,v
retrieving revision 1.84
diff -u -r1.84 ml.in
--- scripts/ml.in	2000/09/22 08:27:30	1.84
+++ scripts/ml.in	2000/09/24 07:13:36
@@ -31,7 +31,7 @@
 LINK_SHARED_OBJ=${MERCURY_LINK_SHARED_OBJ="@LINK_SHARED_OBJ_SH@"}
 SHLIB_RPATH_OPT=${MERCURY_SHLIB_RPATH_OPT="@SHLIB_RPATH_OPT@"}
 SHLIB_RPATH_SEP=${MERCURY_SHLIB_RPATH_SEP="@SHLIB_RPATH_SEP@"}
-SHARED_LIBS=${MERCURY_SHARED_LIBS="@SHARED_LIBS@"}
+SHARED_LIBS=${MERCURY_SHARED_LIBS="@SHARED_LIBS_SH@"}
 TMPDIR=${TMPDIR=/tmp}
 MATH_LIB=${MERCURY_MATH_LIB="@MATH_LIB@"}
 
-- 
       Tyson Dowd           # 
                            #  Surreal humour isn't everyone's cup of fur.
     trd at cs.mu.oz.au        # 
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list