From ca9eb8617c7a00079d6abe2223102c080dd81302 Mon Sep 17 00:00:00 2001 From: Conrad Kostecki Date: Sat, 26 Sep 2020 22:42:49 +0200 Subject: m4_ax_check_zlib.m4: fix compilation with clang If -L/usr/lib is being included, this will break compiling on 64-bit with clang. Signed-off-by: Conrad Kostecki --- configure | 23 +++++++++++++---------- m4_ax_check_zlib.m4 | 18 +++++++++++------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/configure b/configure index 76f7845..fc647be 100755 --- a/configure +++ b/configure @@ -2261,7 +2261,7 @@ ac_config_headers="$ac_config_headers config.h" # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_check_zlib.html +# https://www.gnu.org/software/autoconf-archive/ax_check_zlib.html # =========================================================================== # # SYNOPSIS @@ -2284,10 +2284,10 @@ ac_config_headers="$ac_config_headers config.h" # If both header file and library are found, shell commands # 'action-if-found' is run. If 'action-if-found' is not specified, the # default action appends '-I${ZLIB_HOME}/include' to CPFLAGS, appends -# '-L$ZLIB_HOME}/lib' to LDFLAGS, prepends '-lz' to LIBS, and calls -# AC_DEFINE(HAVE_LIBZ). You should use autoheader to include a definition -# for this symbol in a config.h file. Sample usage in a C/C++ source is as -# follows: +# '-L${ZLIB_HOME}/lib' to LDFLAGS (BUT ONLY IF ZLIB_HOME IS NOT EXACTLY +# "/usr"), prepends '-lz' to LIBS, and calls AC_DEFINE(HAVE_LIBZ). +# You should use autoheader to include a definition for this symbol in a +# config.h file. Sample usage in a C/C++ source is as follows: # # #ifdef HAVE_LIBZ # #include @@ -2309,7 +2309,7 @@ ac_config_headers="$ac_config_headers config.h" # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -2324,7 +2324,7 @@ ac_config_headers="$ac_config_headers config.h" # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 14 +#serial 16.0.0.1 # This is what autoupdate's m4 run will expand. It fires # the warning (with _au_warn_XXX), outputs it into the @@ -4079,10 +4079,11 @@ then ZLIB_OLD_LDFLAGS=$LDFLAGS ZLIB_OLD_CPPFLAGS=$CPPFLAGS if test -n "${ZLIB_HOME}"; then - LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib" + if test "${ZLIB_HOME}" != "/usr"; then + LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib" + fi CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include" fi - ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -4152,7 +4153,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include" - LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib" + if test "${ZLIB_HOME}" != "/usr"; then + LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib" + fi LIBS="-lz $LIBS" $as_echo "#define HAVE_LIBZ 1" >>confdefs.h diff --git a/m4_ax_check_zlib.m4 b/m4_ax_check_zlib.m4 index 1a16843..9cde57d 100644 --- a/m4_ax_check_zlib.m4 +++ b/m4_ax_check_zlib.m4 @@ -22,10 +22,10 @@ # If both header file and library are found, shell commands # 'action-if-found' is run. If 'action-if-found' is not specified, the # default action appends '-I${ZLIB_HOME}/include' to CPFLAGS, appends -# '-L$ZLIB_HOME}/lib' to LDFLAGS, prepends '-lz' to LIBS, and calls -# AC_DEFINE(HAVE_LIBZ). You should use autoheader to include a definition -# for this symbol in a config.h file. Sample usage in a C/C++ source is as -# follows: +# '-L${ZLIB_HOME}/lib' to LDFLAGS (BUT ONLY IF ZLIB_HOME IS NOT EXACTLY +# "/usr"), prepends '-lz' to LIBS, and calls AC_DEFINE(HAVE_LIBZ). +# You should use autoheader to include a definition for this symbol in a +# config.h file. Sample usage in a C/C++ source is as follows: # # #ifdef HAVE_LIBZ # #include @@ -62,7 +62,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 16 +#serial 16.0.0.1 AU_ALIAS([CHECK_ZLIB], [AX_CHECK_ZLIB]) AC_DEFUN([AX_CHECK_ZLIB], @@ -105,7 +105,9 @@ then ZLIB_OLD_LDFLAGS=$LDFLAGS ZLIB_OLD_CPPFLAGS=$CPPFLAGS if test -n "${ZLIB_HOME}"; then - LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib" + if test "${ZLIB_HOME}" != "/usr"; then + LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib" + fi CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include" fi AC_LANG_PUSH([C]) @@ -119,7 +121,9 @@ then # m4_ifblank([$1],[ CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include" - LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib" + if test "${ZLIB_HOME}" != "/usr"; then + LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib" + fi LIBS="-lz $LIBS" AC_DEFINE([HAVE_LIBZ], [1], [Define to 1 if you have `z' library (-lz)]) -- cgit v1.2.3