]> git.sur5r.net Git - openldap/blobdiff - aclocal.m4
Use more robust AC_PROG_SHTOOL instead of homegrown check
[openldap] / aclocal.m4
index 287901eef133882feaf8b3171b511d0613cbcc79..efb9cab081933a708d445ec3510adb5ee26e6a75 100644 (file)
@@ -26,6 +26,44 @@ dnl
 divert(-1)
 builtin(include, build/openldap.m4)dnl
 
+
+AC_DEFUN(AC_PROG_SHTOOL,[dnl
+AC_PREREQ(2.13)dnl
+AC_MSG_CHECKING([for GNU shtool])
+AC_CACHE_VAL(ac_cv_shtool,[dnl
+#   canonicalize and split path string
+ac_paths="`echo .:$ac_aux_dir:$PATH |\
+           sed -e 's%/*:%:%g' -e 's%/*$%%' \
+               -e 's/^:/.:/' -e 's/::/:.:/g' -e 's/:$/:./' \
+               -e 's/:/ /g'`"
+#   iterate over $PATH but prefer CWD
+ac_cv_shtool=""
+for ac_path in $ac_paths; do
+    if test -f "$ac_path/shtool" && test ! -d "$ac_path/shtool"; then
+        ac_cv_shtool="$ac_path/shtool"
+        break
+    fi
+done
+#   check for existance
+if test ".$ac_cv_shtool" = .; then
+    AC_MSG_ERROR([no shtool found in .:$PATH])
+fi
+#   check deeper
+ac_rc=`($ac_cv_shtool --version) </dev/null 2>/dev/null | grep 'GNU shtool'`
+if test ".$ac_rc" = .; then
+    ac_cv_shtool="${CONFIG_SHELL-/bin/sh} $ac_cv_shtool"
+    ac_rc=`($ac_cv_shtool --version) </dev/null 2>/dev/null | grep 'GNU shtool'`
+    if test ".$ac_rc" = .; then
+        AC_MSG_ERROR([$ac_cv_shtool seems not to be GNU shtool])
+    fi
+fi
+])dnl
+AC_MSG_RESULT([$ac_cv_shtool])
+SHTOOL="$ac_cv_shtool"
+AC_SUBST(SHTOOL)
+])
+
+
 # libtool.m4 - Configure libtool for the host system. -*-Shell-script-*-
 
 # serial 46 AC_PROG_LIBTOOL