]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix whitespace shell bugs in configure library detection (#628)
authorAmos Jeffries <yadij@users.noreply.github.com>
Sun, 10 May 2020 10:29:24 +0000 (10:29 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Tue, 12 May 2020 09:47:15 +0000 (09:47 +0000)
Whitespace around shell variable assign and append operators
results in those operations not being performed.
This caused the with_*, *_PATH and *_LIBS variables to not
be set to the correct path when a custom path is used.

Also, lack of condition on the *_CFLAGS assign can pollute
the compiler parameters with non-existent directories.
It should also have been an append like PATH and LIBS to
add the auto-detected value after any user-provided value
instead of overwriting.

Broken since master commit 2453140.

acinclude/squid-util.m4

index 7f5a72e5baaf31396a965843c4252d99e2f1ad24..8cbf814eab97d59fd88a74f8e33ebd5b092835fd 100644 (file)
@@ -171,32 +171,28 @@ dnl 1) binary library name (without 'lib' prefix)
 dnl 2) name of the library for human reading
 dnl 3) prefix used for pkg-check macros
 AC_DEFUN([SQUID_AUTO_LIB],[
-  squid_auto_lib=`echo $1|tr "\-" "_"`
   AC_ARG_WITH([$1],AS_HELP_STRING([--without-$1],[Compile without the $2 library.]),[
     AS_CASE(["$withval"],[yes|no],,[
       AS_IF([test ! -d "$withval"],AC_MSG_ERROR([--with-$1 path does not point to a directory]))
-      set with_$squid_auto_lib = yes
-      AS_IF([test -d "$withval/lib64"],[$3_PATH += "-L$withval/lib64"])
-      AS_IF([test -d "$withval/lib"],[$3_PATH += "-L$withval/lib"])
-      $3_CFLAGS="-I$withval/include"
+      m4_translit([with_$1], [-+.], [___])=yes
+      AS_IF([test -d "$withval/lib64"],[$3_PATH+="-L$withval/lib64"])
+      AS_IF([test -d "$withval/lib"],[$3_PATH+="-L$withval/lib"])
+      AS_IF([test -d "$withval/include"],[$3_CFLAGS+="-I$withval/include"])
     ])
   ])
-  unset squid_auto_lib
 ])
 dnl same as SQUID_AUTO_LIB but for default-disabled libraries
 AC_DEFUN([SQUID_OPTIONAL_LIB],[
-  squid_auto_lib=`echo $1|tr "\-" "_"`
-  set with_$squid_auto_lib = no
   AC_ARG_WITH([$1],AS_HELP_STRING([--with-$1],[Compile with the $2 library.]),[
-    AS_CASE(["$with_$1"],[yes|no],,[
-      AS_IF([test ! -d "$with_$1"],AC_MSG_ERROR([--with-$1 path does not point to a directory]))
-      with_$squid_auto_lib=yes
-      AS_IF([test -d "$withval/lib64"],[$3_PATH += "-L$withval/lib64"])
-      AS_IF([test -d "$withval/lib"],[$3_PATH += "-L$withval/lib"])
-      $3_CFLAGS="-I$withval/include"
+    AS_CASE(["$withval"],[yes|no],,[
+      AS_IF([test ! -d "$withval"],AC_MSG_ERROR([--with-$1 path does not point to a directory]))
+      m4_translit([with_$1], [-+.], [___])=yes
+      AS_IF([test -d "$withval/lib64"],[$3_PATH+="-L$withval/lib64"])
+      AS_IF([test -d "$withval/lib"],[$3_PATH+="-L$withval/lib"])
+      AS_IF([test -d "$withval/include"],[$3_CFLAGS+="-I$withval/include"])
     ])
   ])
-  unset squid_auto_lib
+  AS_IF([test "x$withval" = "x"],[m4_translit([with_$1], [-+.], [___])=no])
 ])
 
 AC_DEFUN([SQUID_EMBED_BUILD_INFO],[