[m-dev.] for review: add threads options to ml

Simon Taylor stayl at cs.mu.OZ.AU
Thu Apr 6 10:25:59 AEST 2000


Estimated hours taken: 1

Add some options to ml for use in linking programs which use Aditi.
The Aditi API library uses threads internally, so programs which use
it must link with the thread libraries.

scripts/ml.in:
	Add option `--use-thread-libs' to link with the thread libraries
	when the Mercury code doesn't use coroutining/parallelism,
	but a C library does.

	Add option `--use-old-osf-thread-libs' to pass
	`-lpthreads -lc_r' to the linker on DEC OSF/1. 
	Linking the Aditi API library fails when no
	options are passed.
	

Index: ml.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/ml.in,v
retrieving revision 1.76
diff -u -u -r1.76 ml.in
--- ml.in	2000/02/07 07:40:15	1.76
+++ ml.in	2000/04/06 00:23:26
@@ -74,6 +74,8 @@
 make_shared_lib=false
 leave_shlib_dirs_relative=false
 user_shlib_dirs=""
+use_thread_libs=false
+use_old_osf_thread_libs=false
 
 # include the file `init_grade_options.sh-subr'
 @INIT_GRADE_OPTIONS@
@@ -148,6 +150,17 @@
 	-g, --c-debug, --no-strip
 		Do not strip C debugging information.
 
+
+Threads options:
+	--use-thread-libs
+		Link with the POSIX thread libraries. This option is useful
+		if a C library being linked with uses threads, but the
+		Mercury code being linked doesn't.
+	--use-old-osf-thread-libs
+		Use \`-lpthreads -lc_r' for linking with the thread libraries
+		on DEC OSF/1. Try this if using the default threads options
+		results in link errors.
+
 $grade_usage"
 
 while : ; do
@@ -270,6 +283,20 @@
 		user_shlib_dirs="$user_shlib_dirs $dir"
 		;;
 
+	--use-thread-libs)
+		use_thread_libs=true
+		;;
+	--no-use-thread-libs)
+		use_thread_libs=false
+		;;
+
+	--use-old-osf-thread-libs)
+		use_old_osf_thread_libs=true
+		;;
+	--no-use-old-osf-thread-libs)
+		use_old_osf_thread_libs=false
+		;;
+
 	# include the file `parse_grade_options.sh-subr'
 	@PARSE_GRADE_OPTIONS@
 
@@ -464,14 +491,22 @@
 	false)  STRIP_OPTS="" ;;
 esac
 
-case $thread_safe in
+case $thread_safe in true)
+	use_thread_libs=true ;;
+esac
+
+case $use_thread_libs in
 	true)
 		case "$FULLARCH" in
  		*-osf*)		# Older versions of OSF may require
 				# "-lpthreads -lc_r" (?), but at least
 				# for OSF 3.2, no special libraries are
 				# needed.
-				THREAD_LIBS="" ;;
+				case $use_old_osf_thread_libs in
+				true)	THREAD_LIBS="-lpthreads -lc_r" ;;
+				false)	THREAD_LIBS="" ;;
+				esac
+				;;
 		*-linux*)	THREAD_LIBS="-lpthread" ;;
 		*-solaris*)	THREAD_LIBS="-lpthread -ldl" ;;
 		*)		echo "$0: warning: don't know which" \
--------------------------------------------------------------------------
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