Linux & shared libraries
Fergus Henderson
fjh at cs.mu.oz.au
Wed Oct 8 03:44:11 AEST 1997
Hi,
I've been wondering what we should do about shared libraries on Linux.
Currently on Linux, shared and non-shared Mercury code are not compatible.
This results in more efficient code for the non-shared case, but is less
convenient.
Anyway the following change is an attempt to address one of the
inconveniences.
scripts/ml.in:
For Linux, make `--make-shared-lib' imply `--mercury-libs shared',
since on Linux the shared and non-shared grades are not compatible.
Index: ml.in
===================================================================
RCS file: /home/staff/zs/imp/mercury/scripts/ml.in,v
retrieving revision 1.32
diff -u -u -r1.32 ml.in
--- ml.in 1997/10/02 16:23:08 1.32
+++ ml.in 1997/10/07 16:14:52
@@ -26,12 +26,12 @@
Specify which version of the standard Mercury libraries to
link with:
--mercury-libs shared
- Link with the shared Mercury libraries (*.so),
+ Link with the shared libraries (*.so),
if possible, otherwise with the static ones.
--mercury-libs static
- Link with the static Mercury libraries (*.a).
+ Link with the static libraries (*.a).
--mercury-libs none
- Don't link in the Mercury libraries.
+ Don't link in the Mercury standard libraries.
-shared, --shared
Similar to \`--mercury-libs shared', but applies to all
libraries, not just the standard Mercury libraries.
@@ -47,7 +47,7 @@
Don't pipe the output of the linker through the Mercury
demangler.
-g, --no-strip
- Do not strip debugging information
+ Do not strip debugging information.
-s <grade>, --grade <grade>
Specify which grade of the Mercury library to link with.
(The default grade is determined by ``configure'.)"
@@ -79,16 +79,7 @@
strip=true
;;
esac
-case $FULLARCH in
- i?86-*-linux*)
- # shared libraries are not the default on Linux
- # -- see README.Linux
- mercury_libs=static
- ;;
- *)
- mercury_libs=shared
- ;;
-esac
+mercury_libs=default
demangle=true
GRADE=$DEFAULT_GRADE
MAYBE_STATIC_OPT=""
@@ -137,14 +128,14 @@
shift ;;
--mercury-libs)
case "$2" in
- shared|static|none)
+ shared|static|none|default)
mercury_libs="$2"
shift; shift ;;
*)
progname=`basename $0`
cat 1>&2 << EOF
-$progname: Error: parameter to \`--mercury-libs' option should be
-$progname: either \`shared', \`static', or \`none', not \`$2'.
+$progname: Error: parameter to \`--mercury-libs' option should be either
+$progname: \`shared', \`static', \`none', or `default', not \`$2'.
$progname: Try `$0 --help' for help.
EOF
exit 1
@@ -153,7 +144,7 @@
;;
-shared|--shared)
MAYBE_STATIC_OPT=""
- case $mercury_libs in static)
+ case $mercury_libs in static|default)
mercury_libs=shared ;;
esac
shift
@@ -173,7 +164,7 @@
MAYBE_STATIC_OPT=-static
;;
esac
- case $mercury_libs in shared)
+ case $mercury_libs in shared|default)
mercury_libs=static ;;
esac
shift
@@ -198,6 +189,21 @@
break ;;
esac
done
+
+case $mercury_libs in default)
+ case $FULLARCH in
+ i?86-*-linux*)
+ # shared libraries are not the default on Linux
+ # -- see README.Linux
+ case $make_shared_lib in
+ false) mercury_libs=static ;;
+ true) mercury_libs=shared ;;
+ esac
+ ;;
+ *)
+ mercury_libs=shared
+ ;;
+esac
case "$GRADE" in
*.gc.prof*)
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
More information about the developers
mailing list