for review: be more lenient on pathnames.

Tyson Dowd trd at cs.mu.OZ.AU
Sat May 23 17:13:51 AEST 1998


Hi,

I made this change, and then realized it wasn't actually causing
a big problem (libc5/libc6 differences were causing the problem
I was experiencing), but since I've made the change, perhaps
it is worthwhile committing anyway.

===

mercury has /bin/mkfifo
hydra (and cyclone, and cat and munta) have /usr/bin/mkfifo

I don't think there is any *really* good reason to have absolute
pathnames for mkfifo (et al) unless they are in non-standard
locations, so here's a fix.

===================================================================


Estimated hours taken: 0.5

Be more lenient with absolute pathnames when configuring mkfifo, mknod
and mktemp.  This allows the same scripts to work on operating
system variants with different locations for these programs.

configure.in:
	Use AC_PROGRAMS_CHECK instead of AC_PROG_PATH, so the path
	of the program is not hardcoded (e.g. mkfifo instead of
	/bin/mkfifo).

	If the path is possibly non-standard (e.g. /etc or /sbin),
	then use AC_PROGRAMS_CHECK first with the standard path, then
	try AC_PROG_PATH with the non-standard path (so we may still
	end up with hardcoded paths, but not in common cases).


Index: configure.in
===================================================================
RCS file: /home/mercury1/repository/mercury/configure.in,v
retrieving revision 1.125
diff -u -r1.125 configure.in
--- configure.in	1998/03/30 05:22:15	1.125
+++ configure.in	1998/05/20 10:27:09
@@ -159,10 +159,17 @@
 #-----------------------------------------------------------------------------#
 MERCURY_MSG("looking for a way to create named pipes...")
 
-save_PATH="$PATH"
-PATH="$PATH:/etc:/usr/etc:/sbin"
-
-AC_PATH_PROG(MKFIFO,mkfifo)
+# Look in normal path first.
+AC_PROGRAMS_CHECK(MKFIFO,mkfifo)
+if test "$MKFIFO" = ""; then
+	# Try a more exotic path.
+	save_PATH="$PATH"
+	PATH="$PATH:/etc:/usr/etc:/sbin"
+	# Use AC_PATH_PROG because this probably won't be in most
+	# user's path, so we will have to hardcode the path.
+	AC_PATH_PROG(MKFIFO,mkfifo)
+	PATH="$save_PATH"
+fi
 if test "$MKFIFO" != ""; then
 	# check that it really works
 	tmp=/tmp/fifo$$
@@ -175,7 +182,13 @@
 	rm -f $tmp
 fi
 if test "$MKFIFO" = ""; then
-	AC_PATH_PROG(MKNOD,mknod)
+	AC_PROGRAMS_CHECK(MKNOD,mknod)
+	if test "$MKNOD" = ""; then
+		save_PATH="$PATH"
+		PATH="$PATH:/etc:/usr/etc:/sbin"
+		AC_PATH_PROG(MKNOD,mknod)
+		PATH="$save_PATH"
+	fi
 	if test "$MKNOD" != ""; then
 		# check that it really works
 		tmp=/tmp/fifo$$
@@ -195,11 +208,10 @@
 test "$MKNOD" = "" && MKNOD=mknod
 AC_SUBST(MKNOD)
 
-PATH="$save_PATH"
 #-----------------------------------------------------------------------------#
 MERCURY_MSG("looking for a way to create temporary files...")
 
-AC_PATH_PROG(MKTEMP,mktemp)
+AC_PROGRAMS_CHECK(MKTEMP,mktemp)
 if test "$MKTEMP" != ""; then
 	# check that it really works
 	TMPFILE=`mktemp /tmp/configure.XXXXXX`


-- 
       Tyson Dowd           # There isn't any reason why Linux can't be
                            # implemented as an enterprise computing solution.
     trd at cs.mu.oz.au        # Find out what you've been missing while you've
http://www.cs.mu.oz.au/~trd # been rebooting Windows NT. -- InfoWorld, 1998.



More information about the developers mailing list