Skip to content

Commit 5fc7fc7

Browse files
committed
Polish SQUID_AUTO_LIB and SQUID_OPTIONAL_LIB macros
Generate the third parameter value from the first. Remove from all callers.
1 parent b591feb commit 5fc7fc7

File tree

3 files changed

+32
-29
lines changed

3 files changed

+32
-29
lines changed

acinclude/squid-util.m4

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -253,28 +253,31 @@ dnl 1) binary library name (without 'lib' prefix)
253253
dnl 2) name of the library for human reading
254254
dnl 3) prefix used for pkg-check macros
255255
AC_DEFUN([SQUID_AUTO_LIB],[
256-
AC_ARG_WITH([$1],AS_HELP_STRING([--without-$1],[Compile without the $2 library.]),[
256+
AC_PREREQ([2.61])
257+
m4_pushdef([VARIABLE], m4_toupper(m4_translit([LIB$1],[-+.],[___])))
258+
m4_pushdef([OPTION], m4_ifdef([OPTOUT],[--with[]OPTOUT[]-$1],[--with-$1]))
259+
m4_pushdef([WITHVAR], m4_translit([with_$1],[-+.],[___]))
260+
AC_ARG_WITH([$1],AS_HELP_STRING([OPTION],[Compile without the $2 library.]),[
257261
AS_CASE(["$withval"],[yes|no],,[
258262
AS_IF([test ! -d "$withval"],AC_MSG_ERROR([--with-$1 path does not point to a directory]))
259-
m4_translit([with_$1], [-+.], [___])=yes
260-
AS_IF([test -d "$withval/lib64"],[$3_PATH+="-L$withval/lib64"])
261-
AS_IF([test -d "$withval/lib"],[$3_PATH+="-L$withval/lib"])
262-
AS_IF([test -d "$withval/include"],[$3_CFLAGS+="-I$withval/include"])
263+
WITHVAR=yes
264+
AS_IF([test -d "$withval/lib64"],[VARIABLE[]_PATH+="-L$withval/lib64"])
265+
AS_IF([test -d "$withval/lib"],[VARIABLE[]_PATH+="-L$withval/lib"])
266+
AS_IF([test -d "$withval/include"],[VARIABLE[]_CFLAGS+="-I$withval/include"])
263267
])
264268
])
269+
m4_popdef([WITHVAR])
270+
m4_popdef([VARIABLE])
265271
])
266272
dnl same as SQUID_AUTO_LIB but for default-disabled libraries
267273
AC_DEFUN([SQUID_OPTIONAL_LIB],[
268-
AC_ARG_WITH([$1],AS_HELP_STRING([--with-$1],[Compile with the $2 library.]),[
269-
AS_CASE(["$withval"],[yes|no],,[
270-
AS_IF([test ! -d "$withval"],AC_MSG_ERROR([--with-$1 path does not point to a directory]))
271-
m4_translit([with_$1], [-+.], [___])=yes
272-
AS_IF([test -d "$withval/lib64"],[$3_PATH+="-L$withval/lib64"])
273-
AS_IF([test -d "$withval/lib"],[$3_PATH+="-L$withval/lib"])
274-
AS_IF([test -d "$withval/include"],[$3_CFLAGS+="-I$withval/include"])
275-
])
276-
])
277-
AS_IF([test "x$withval" = "x"],[m4_translit([with_$1], [-+.], [___])=no])
274+
AC_REQUIRE([SQUID_AUTO_LIB])
275+
m4_pushdef([OPTOUT], [out])
276+
m4_pushdef([RESULT], m4_translit([with_$1],[-+.],[___]))
277+
SQUID_AUTO_LIB([$1],[$2])
278+
AS_IF([test "x$[]RESULT" = "x"],[RESULT=no])
279+
m4_popdef([RESULT])
280+
m4_popdef([OPTOUT])
278281
])
279282

280283
AC_DEFUN([SQUID_EMBED_BUILD_INFO],[

acinclude/tdb.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
dnl check for --with-tdb option
99
AC_DEFUN_ONCE([SQUID_CHECK_LIBTDB],[
10-
SQUID_AUTO_LIB(tdb,[Samba TrivialDB],[LIBTDB])
10+
SQUID_AUTO_LIB(tdb,[Samba TrivialDB])
1111
SQUID_CHECK_LIB_WORKS(tdb,[
1212
SQUID_STATE_SAVE(squid_libtdb_state)
1313
LIBS="$LIBS $LIBTDB_PATH"

configure.ac

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ AS_IF([test "x$libatomic_checker_result" = "xno"],[
440440
SQUID_STATE_ROLLBACK(LIBATOMIC)
441441
AC_SUBST(ATOMICLIB)
442442

443-
SQUID_AUTO_LIB(psapi,[Windows PSAPI.dll],[LIBPSAPI])
443+
SQUID_AUTO_LIB(psapi,[Windows PSAPI.dll])
444444
SQUID_CHECK_LIB_WORKS(psapi,[
445445
CPPFLAGS="$LIBPSAPI_CFLAGS $CPPFLAGS"
446446
LIBS="$LIBPSAPI_PATH $LIBS"
@@ -1026,7 +1026,7 @@ AM_CONDITIONAL(ENABLE_HTCP, [test "x$enable_htcp" = "xyes"])
10261026
AC_MSG_NOTICE([HTCP support enabled: $enable_htcp])
10271027

10281028
# Cryptograhic libraries
1029-
SQUID_AUTO_LIB(nettle,[Nettle crypto],[LIBNETTLE])
1029+
SQUID_AUTO_LIB(nettle,[Nettle crypto])
10301030
SQUID_CHECK_LIB_WORKS(nettle,[
10311031
PKG_CHECK_MODULES([LIBNETTLE],[nettle >= 3.4],[
10321032
CPPFLAGS="$LIBNETTLE_CFLAGS $CPPFLAGS"
@@ -1043,7 +1043,7 @@ dnl Solaris10 provides MD5 natively through libmd5
10431043
AC_CHECK_LIB(md5, MD5Init, [CRYPTLIB="$CRYPTLIB -lmd5"])
10441044
AC_SUBST(CRYPTLIB)
10451045

1046-
SQUID_AUTO_LIB(gnutls,[GnuTLS crypto],[LIBGNUTLS])
1046+
SQUID_AUTO_LIB(gnutls,[GnuTLS crypto])
10471047
SQUID_CHECK_LIB_WORKS(gnutls,[
10481048
PKG_CHECK_MODULES([LIBGNUTLS],[gnutls >= 3.4.0],[
10491049
CPPFLAGS="$LIBGNUTLS_CFLAGS $CPPFLAGS"
@@ -1053,7 +1053,7 @@ SQUID_CHECK_LIB_WORKS(gnutls,[
10531053

10541054
SSLLIB=""
10551055
dnl User may specify OpenSSL is needed from a non-standard location
1056-
SQUID_OPTIONAL_LIB(openssl,[OpenSSL],[LIBOPENSSL])
1056+
SQUID_OPTIONAL_LIB(openssl,[OpenSSL])
10571057
AH_TEMPLATE(USE_OPENSSL,[OpenSSL support is available])
10581058
## OpenSSL is default disable due to licensing issues on some OS
10591059
AS_IF([test "x$with_openssl" = "xyes"],[
@@ -1137,7 +1137,7 @@ AM_CONDITIONAL(ENABLE_SSL,[ test "x$with_openssl" = "xyes" ])
11371137
AC_SUBST(SSLLIB)
11381138

11391139
# Kerberos support libraries: MIT
1140-
SQUID_AUTO_LIB(mit-krb5,[MIT Kerberos],[LIB_KRB5])
1140+
SQUID_AUTO_LIB(mit-krb5,[MIT Kerberos])
11411141
AH_TEMPLATE(USE_APPLE_KRB5,[Apple Kerberos support is available])
11421142
AH_TEMPLATE(USE_SOLARIS_KRB5,[Solaris Kerberos support is available])
11431143
SQUID_CHECK_LIB_WORKS(mit-krb5,[
@@ -1164,7 +1164,7 @@ SQUID_CHECK_LIB_WORKS(mit-krb5,[
11641164
])
11651165

11661166
# Kerberos support libraries: Heimdal
1167-
SQUID_AUTO_LIB(heimdal-krb5,[Heimdal Kerberos],[LIBHEIMDAL_KRB5])
1167+
SQUID_AUTO_LIB(heimdal-krb5,[Heimdal Kerberos])
11681168
SQUID_CHECK_LIB_WORKS(heimdal-krb5,[
11691169
AS_IF([test "x$LIBMIT_KRB5_LIBS" = "x"],[
11701170
PKG_CHECK_MODULES([LIBHEIMDAL_KRB5],[heimdal-krb5 heimdal-gssapi],[
@@ -1180,7 +1180,7 @@ SQUID_CHECK_LIB_WORKS(heimdal-krb5,[
11801180
])
11811181

11821182
# Kerberos support libraries: GNU GSS
1183-
SQUID_AUTO_LIB(gss,[GNU gss],[LIBGSS])
1183+
SQUID_AUTO_LIB(gss,[GNU gss])
11841184
SQUID_CHECK_LIB_WORKS(gss,[
11851185
AS_IF([test "x$LIBMIT_KRB5_LIBS" = "x" -a "x$LIBHEIMDAL_KRB5_LIBS" = "x"],[
11861186
PKG_CHECK_MODULES([LIBGSS],[gss],[
@@ -1197,7 +1197,7 @@ SQUID_CHECK_LIB_WORKS(gss,[
11971197
])
11981198
])
11991199

1200-
SQUID_AUTO_LIB(ldap,[LDAP],[LIBLDAP])
1200+
SQUID_AUTO_LIB(ldap,[LDAP])
12011201
SQUID_CHECK_LIB_WORKS(ldap,[
12021202
PKG_CHECK_MODULES([LIBLDAP],[ldap],[:],[:])
12031203
AS_IF([test "$squid_host_os" = "mingw" -a "x$LIBLDAP_LIBS" = "x"],[
@@ -1215,15 +1215,15 @@ SQUID_CHECK_LIB_WORKS(ldap,[
12151215
SQUID_CHECK_LDAP_API
12161216
])
12171217

1218-
SQUID_AUTO_LIB(sasl,[Cyrus SASL],[LIBSASL])
1218+
SQUID_AUTO_LIB(sasl,[Cyrus SASL])
12191219
SQUID_CHECK_LIB_WORKS([sasl],[
12201220
PKG_CHECK_MODULES([LIBSASL],[libsasl2],[:],[:])
12211221
CPPFLAGS="$LIBSASL_CFLAGS $CPPFLAGS"
12221222
LIBS="$LIBSASL_LIBS $LIBS"
12231223
AC_CHECK_HEADERS([sasl/sasl.h sasl.h])
12241224
])
12251225

1226-
SQUID_AUTO_LIB(systemd,[systemd API for start-up notification],[LIBSYSTEMD])
1226+
SQUID_AUTO_LIB(systemd,[systemd API for start-up notification])
12271227
SQUID_CHECK_LIB_WORKS(systemd,[
12281228
LIBS="$LIBS $LIBSYSTEMD_PATH"
12291229
PKG_CHECK_MODULES(LIBSYSTEMD,[libsystemd >= 209],[
@@ -1416,7 +1416,7 @@ AC_MSG_NOTICE([Linux Netfilter support requested: ${enable_linux_netfilter:=auto
14161416

14171417

14181418
dnl Look for libnetfilter_conntrack options (needed for QOS netfilter marking)
1419-
SQUID_AUTO_LIB(netfilter-conntrack,[Netfilter conntrack],[LIBNETFILTER_CONNTRACK])
1419+
SQUID_AUTO_LIB(netfilter-conntrack,[Netfilter conntrack])
14201420
SQUID_CHECK_LIB_WORKS(netfilter-conntrack,[
14211421
PKG_CHECK_MODULES([LIBNETFILTER_CONNTRACK],[libnetfilter_conntrack],[:],[:])
14221422
CPPFLAGS="$LIBNETFILTER_CONNTRACK_CFLAGS $CPPFLAGS"
@@ -1743,7 +1743,7 @@ SQUID_DEFINE_BOOL(X_ACCELERATOR_VARY,${enable_x_accelerator_vary:=no},
17431743
[Enable support for the X-Accelerator-Vary HTTP header])
17441744
AC_MSG_NOTICE([X-Accelerator-Vary support enabled: $enable_x_accelerator_vary])
17451745

1746-
SQUID_AUTO_LIB(cppunit,[cppunit test framework],[LIBCPPUNIT])
1746+
SQUID_AUTO_LIB(cppunit,[cppunit test framework])
17471747
SQUID_CHECK_LIB_WORKS(cppunit,[
17481748
PKG_CHECK_MODULES([LIBCPPUNIT],[cppunit],[
17491749
squid_cv_cppunit_version="`pkg-config --modversion cppunit`"
@@ -1965,7 +1965,7 @@ AC_CHECK_TYPE(cpu_set_t,
19651965
dnl Check for special functions
19661966
AC_FUNC_ALLOCA
19671967

1968-
SQUID_AUTO_LIB(cap,[Linux capabilities],[LIBCAP])
1968+
SQUID_AUTO_LIB(cap,[Linux capabilities])
19691969
SQUID_CHECK_LIB_WORKS(cap,[
19701970
PKG_CHECK_MODULES([LIBCAP],[libcap >= 2.09],[:],[:])
19711971
CPPFLAGS="$LIBCAP_CFLAGS $CPPFLAGS"

0 commit comments

Comments
 (0)