pcp
[Top] [All Lists]

[PATCH] fix AC_PATH_PROG handling

To: pcp@xxxxxxxxxxx
Subject: [PATCH] fix AC_PATH_PROG handling
From: James Peach <jamespeach@xxxxxxx>
Date: Tue, 25 Mar 2008 20:36:03 -0700
Sender: pcp-bounce@xxxxxxxxxxx
Hi all,

As per the longer explanation at http://oss.sgi.com/archives/xfs/2003-04/msg00115.html , you can't use AC_PATH_PROG on the right hand side of shell logical operation. This patch against Nathan's git tree 1. turns all the uses of logical operations with AC_PATH_PROG into explicit if conditionals 2. adds a default path for AC_PATH_PROG where I had a good idea of what it should be 3. reverts the addition of /opt/local/bin to pcp.env, where it has no business being added to the default path

diff --git a/configure.in b/configure.in
index 3cd5336..d0d26ee 100644
--- a/configure.in
+++ b/configure.in
@@ -163,7 +163,9 @@ dnl output header with cpp defs HAVE_*, etc
 AC_CONFIG_HEADER(src/include/platform_defs.h)

 dnl check if user wants their own C compiler
-test -z "$CC" && AC_PROG_CC
+if test -z "$CC" ; then
+    AC_PROG_CC
+fi
 cc=$CC
 AC_SUBST(cc)

@@ -206,12 +208,16 @@ make=$MAKE
 AC_SUBST(make)

 dnl check if user wants their own C++ compiler
-test -z "$CXX" && AC_PROG_CXX
+if test -z "$CXX" ; then
+    AC_PROG_CXX
+fi
 cxx=$CXX
 AC_SUBST(cxx)

 dnl check if users wants their own CPP
-test -z "$CPP" && AC_PROG_CPP
+if test -z "$CPP" ; then
+    AC_PROG_CPP
+fi
 cpp=$CPP
 AC_SUBST(cpp)

@@ -253,7 +259,9 @@ AC_SUBST(cpp_simple_args)
 AC_MSG_RESULT($cpp_simple $cpp_simple_args)

 dnl check if users wants their own linker
-test -z "$LD" && AC_PATH_PROG(LD, ld, /usr/bin/ld)
+if test -z "$LD" ; then
+    AC_PATH_PROG(LD, ld, /usr/bin/ld)
+fi
 ld=$LD
 AC_SUBST(ld)

@@ -275,7 +283,9 @@ fi
 AC_SUBST(pcp_owner pcp_group)

 dnl check if the tar program is available
-test -z "$TAR" && AC_PATH_PROG(TAR, tar)
+if test -z "$TAR" ; then
+    AC_PATH_PROG(TAR, tar, /usr/bin/tar)
+fi
 if test $target_os = irix -a -x /usr/freeware/bin/tar
 then
     TAR=/usr/freeware/bin/tar
@@ -297,7 +307,9 @@ AC_SUBST(xmessage)

 dnl check if the gzip program is available
 dnl (needed to gzip man pages on some platforms)
-test -z "$ZIP" && AC_PATH_PROG(ZIP, gzip, /bin/gzip)
+if test -z "$ZIP" ; then
+    AC_PATH_PROG(ZIP, gzip, /bin/gzip)
+fi
 test ! -x "$ZIP" && ZIP=/usr/local/bin/gzip
 test ! -x "$ZIP" && ZIP=/usr/freeware/bin/gzip
 test ! -x "$ZIP" && ZIP=/usr/bin/gzip
@@ -306,7 +318,9 @@ AC_SUBST(gzip)

 dnl check if the bzip2 program is available
 dnl (needed to bzip2 man pages on some platforms)
-test -z "$BZIP2" && AC_PATH_PROG(BZIP2, bzip2, /bin/bzip2)
+if test -z "$BZIP2" ; then
+    AC_PATH_PROG(BZIP2, bzip2, /bin/bzip2)
+fi
 test ! -x "$BZIP2" && BZIP2=/usr/local/bin/bzip2
 test ! -x "$BZIP2" && BZIP2=/usr/freeware/bin/bzip2
 test ! -x "$BZIP2" && BZIP2=/usr/bin/bzip2
@@ -340,17 +354,23 @@ fi
 AC_SUBST(package_maker)

 dnl check if the hdiutil program is available
-test -z "$HDIUTIL" && AC_PATH_PROG(HDIUTIL, hdiutil)
+if test -z "$HDIUTIL" ; then
+    AC_PATH_PROG(HDIUTIL, hdiutil, /usr/bin/hdiutil)
+fi
 hdiutil=$HDIUTIL
 AC_SUBST(hdiutil)

 dnl check if the rpmbuild program is available
-test -z "$RPMBUILD" && AC_PATH_PROG(RPMBUILD, rpmbuild)
+if test -z "$RPMBUILD" ; then
+    AC_PATH_PROG(RPMBUILD, rpmbuild)
+fi
 rpmbuild=$RPMBUILD
 AC_SUBST(rpmbuild)

 dnl check if the rpm program is available
-test -z "$RPM" && AC_PATH_PROG(RPM, rpm)
+if test -z "$RPM" ; then
+    AC_PATH_PROG(RPM, rpm, /usr/bin/rpm)
+fi
 rpm=$RPM
 AC_SUBST(rpm)

@@ -381,7 +401,9 @@ gendist=$GENDIST
 AC_SUBST(gendist)

 dnl check if the makedepend program is available
-test -z "$MAKEDEPEND" && AC_PATH_PROG(MAKEDEPEND, makedepend, /bin/ true)
+if test -z "$MAKEDEPEND" ; then
+    AC_PATH_PROG(MAKEDEPEND, makedepend, /bin/true)
+fi
 makedepend=$MAKEDEPEND
 AC_SUBST(makedepend)

@@ -397,7 +419,9 @@ dnl check if symbolic links are supported
 AC_PROG_LN_S

 dnl check if user wants their own lex, yacc
-test -z "$YACC" && AC_PROG_YACC
+if test -z "$YACC" ; then
+    AC_PROG_YACC
+fi
if test "$YACC" = "yacc" -a $target_os = irix -a `uname -a | awk '{print $3}'` = "6.2"
 then
     dnl yacc on IRIX 6.2 or earlier does not support -b flag
@@ -405,12 +429,16 @@ then
 fi
 yacc=$YACC
 AC_SUBST(yacc)
-test -z "$LEX" && AC_PROG_LEX
+if test -z "$LEX" ; then
+    AC_PROG_LEX
+fi
 lex=$LEX
 AC_SUBST(lex)

 dnl check if user wants their own awk, sed and echo
-test -z "$AWK" && AC_PROG_AWK
+if test -z "$AWK" ; then
+    AC_PATH_PROG(AWK, awk, /usr/bin/awk)
+fi
 if test $target_os = irix -a "$AWK" = "gawk"
 then
     dnl always use nawk on IRIX
@@ -423,10 +451,14 @@ test "$AWK" = "mawk" -a -x /usr/bin/awk && AWK=awk
 awk=$AWK
 AC_SUBST(awk)

-test -z "$SED" && AC_PATH_PROG(SED, sed, /bin/sed)
+if test -z "$SED" ; then
+    AC_PATH_PROG(SED, sed, /bin/sed)
+fi
 sed=$SED
 AC_SUBST(sed)
-test -z "$ECHO" && AC_PATH_PROG(ECHO, echo, /bin/echo)
+if test -z "$ECHO" ; then
+    AC_PATH_PROG(ECHO, echo, /bin/echo)
+fi
 echo=$ECHO
 AC_SUBST(echo)

diff --git a/src/include/pcp.env b/src/include/pcp.env
index dc6c96d..ca657fc 100644
--- a/src/include/pcp.env
+++ b/src/include/pcp.env
@@ -63,7 +63,7 @@ PATH=$PATH/usr/sbin:/sbin:/bin:/usr/bin:/etc:$ {PCP_BIN_DIR}:${PCP_BINADM_DIR}:${
 #
 for dir in /usr/bsd /usr/etc /usr/bin/X11 /usr/local/bin \
        /opt/sfw/bin /usr/ccs/bin /cygdrive/c/WINDOWS/system32 \
-       /usr/contrib/bin /opt/local/bin
+       /usr/contrib/bin
 do
     [ -d $dir ] || continue
     echo "$PATH" | egrep ":$dir(:|\$)" >/dev/null && continue


<Prev in Thread] Current Thread [Next in Thread>