common/autoconf/basics.m4
changeset 32920 5bea8a04f0a5
parent 32716 d3203fd9e447
child 32921 8e0250dfa145
--- a/common/autoconf/basics.m4	Wed Jul 05 20:52:37 2017 +0200
+++ b/common/autoconf/basics.m4	Wed Oct 07 11:58:03 2015 +0200
@@ -288,7 +288,7 @@
   # Publish this variable in the help.
   AC_ARG_VAR($1, [Override default value for $1])
 
-  if test "x[$]$1" = x; then
+  if [[ -z "${$1+x}" ]]; then
     # The variable is not set by user, try to locate tool using the code snippet
     $2
   else
@@ -312,25 +312,32 @@
       # for unknown variables in the end.
       CONFIGURE_OVERRIDDEN_VARIABLES="$try_remove_var"
 
-      # Check if the provided tool contains a complete path.
-      tool_specified="[$]$1"
-      tool_basename="${tool_specified##*/}"
-      if test "x$tool_basename" = "x$tool_specified"; then
-        # A command without a complete path is provided, search $PATH.
-        AC_MSG_NOTICE([Will search for user supplied tool $1=$tool_basename])
-        AC_PATH_PROG($1, $tool_basename)
-        if test "x[$]$1" = x; then
-          AC_MSG_ERROR([User supplied tool $tool_basename could not be found])
+      # Check if we try to supply an empty value
+      if test "x[$]$1" = x; then
+        AC_MSG_NOTICE([Setting user supplied tool $1= (no value)])
+        AC_MSG_CHECKING([for $1])
+        AC_MSG_RESULT([disabled])
+      else
+        # Check if the provided tool contains a complete path.
+        tool_specified="[$]$1"
+        tool_basename="${tool_specified##*/}"
+        if test "x$tool_basename" = "x$tool_specified"; then
+          # A command without a complete path is provided, search $PATH.
+          AC_MSG_NOTICE([Will search for user supplied tool $1=$tool_basename])
+          AC_PATH_PROG($1, $tool_basename)
+          if test "x[$]$1" = x; then
+            AC_MSG_ERROR([User supplied tool $tool_basename could not be found])
+          fi
+        else
+          # Otherwise we believe it is a complete path. Use it as it is.
+          AC_MSG_NOTICE([Will use user supplied tool $1=$tool_specified])
+          AC_MSG_CHECKING([for $1])
+          if test ! -x "$tool_specified"; then
+            AC_MSG_RESULT([not found])
+            AC_MSG_ERROR([User supplied tool $1=$tool_specified does not exist or is not executable])
+          fi
+          AC_MSG_RESULT([$tool_specified])
         fi
-      else
-        # Otherwise we believe it is a complete path. Use it as it is.
-        AC_MSG_NOTICE([Will use user supplied tool $1=$tool_specified])
-        AC_MSG_CHECKING([for $1])
-        if test ! -x "$tool_specified"; then
-          AC_MSG_RESULT([not found])
-          AC_MSG_ERROR([User supplied tool $1=$tool_specified does not exist or is not executable])
-        fi
-        AC_MSG_RESULT([$tool_specified])
       fi
     fi
   fi
@@ -437,6 +444,7 @@
   BASIC_PATH_PROGS(READLINK, [greadlink readlink])
   BASIC_PATH_PROGS(DF, df)
   BASIC_PATH_PROGS(CPIO, [cpio bsdcpio])
+  BASIC_PATH_PROGS(NICE, nice)
 ])
 
 # Setup basic configuration paths, and platform-specific stuff related to PATHs.