Fix ordering issues with LDFLAGS and LIBS.
authorScott Cantor <cantor.2@osu.edu>
Tue, 15 Nov 2011 04:20:19 +0000 (04:20 +0000)
committerScott Cantor <cantor.2@osu.edu>
Tue, 15 Nov 2011 04:20:19 +0000 (04:20 +0000)
configure.ac

index 7632a13..74d0cb7 100644 (file)
@@ -90,8 +90,19 @@ AC_ARG_WITH(zlib,
         fi
     ]
 )
+
+AC_ARG_WITH(zlib,
+    AS_HELP_STRING([--with-zlib=PATH],[where zlib is installed]),,
+    [with_zlib=/usr])
+if test x_$with_zlib != x_/usr; then
+    CPPFLAGS="-I${with_zlib}/include $CPPFLAGS"
+    LIBS="-L${with_zlib}/lib -lz $LIBS"
+else
+    LIBS="-lz $LIBS"
+fi
+
 AC_CHECK_HEADER([zlib.h],,AC_MSG_ERROR([unable to find zlib header files]))
-AC_CHECK_LIB([z],[deflateInit2_],,AC_MSG_ERROR([unable to link with zlib library]))
+AC_CHECK_LIB([z],[deflateInit2_],[],AC_MSG_ERROR([unable to link with zlib library]))
 
 # OpenSSL settings
 AC_ARG_WITH(openssl,
@@ -175,12 +186,15 @@ fi
 
 # Xerces settings
 AC_ARG_WITH(xerces,
-    AS_HELP_STRING([--with-xerces=PATH],[where xerces-c is installed]),
-    [if test x_$with_xerces != x_/usr; then
-        LDFLAGS="-L${with_xerces}/lib $LDFLAGS"
-        CPPFLAGS="-I${with_xerces}/include $CPPFLAGS"
-    fi])
-LIBS="-lxerces-c $LIBS"
+    AS_HELP_STRING([--with-xerces=PATH],[where xerces-c is installed]),,
+    [with_xerces=/usr])
+if test x_$with_xerces != x_/usr; then
+    CPPFLAGS="-I${with_xerces}/include $CPPFLAGS"
+    LIBS="-L${with_xerces}/lib -lxerces-c $LIBS"
+else
+    LIBS="-lxerces-c $LIBS"
+fi
+
 AC_CHECK_HEADER([xercesc/dom/DOM.hpp],,AC_MSG_ERROR([unable to find xerces header files]))
 AC_MSG_CHECKING([Xerces version])
 AC_PREPROC_IFELSE(
@@ -205,12 +219,14 @@ AC_COMPILE_IFELSE(
 
 # XML-Security settings
 AC_ARG_WITH(xmlsec,
-    AS_HELP_STRING([--with-xmlsec=PATH],[where xmlsec is installed]),
-    [if test x_$with_xmlsec != x_/usr; then
-        LDFLAGS="-L${with_xmlsec}/lib $LDFLAGS"
-        CPPFLAGS="-I${with_xmlsec}/include $CPPFLAGS"
-    fi])
-LIBS="-lxml-security-c $LIBS"
+    AS_HELP_STRING([--with-xmlsec=PATH],[where xmlsec is installed]),,
+    [with_xmlsec=/usr])
+if test x_$with_xmlsec != x_/usr; then
+    CPPFLAGS="-I${with_xmlsec}/include $CPPFLAGS"
+    LIBS="-L${with_xmlsec}/lib -lxml-security-c $LIBS"
+else
+    LIBS="-lxml-security-c $LIBS"
+fi
 AC_CHECK_HEADER([xsec/utils/XSECPlatformUtils.hpp],,AC_MSG_ERROR([unable to find xmlsec header files]))
 AC_MSG_CHECKING([XML-Security version])
 AC_PREPROC_IFELSE(
@@ -229,13 +245,16 @@ int i = 0;
 
 # XML-Tooling settings
 AC_ARG_WITH(xmltooling,
-    AS_HELP_STRING([--with-xmltooling=PATH],[where xmltooling is installed]),
-    [if test x_$with_xmltooling != x_/usr; then
-        LDFLAGS="-L${with_xmltooling}/lib $LDFLAGS"
-        CPPFLAGS="-I${with_xmltooling}/include $CPPFLAGS"
-        DX_INCLUDE="${with_xmltooling}/include"
-    fi])
-LIBS="-lxmltooling $LIBS"
+    AS_HELP_STRING([--with-xmltooling=PATH],[where xmltooling is installed]),,
+    [with_xmltooling=/usr])
+if test x_$with_xmltooling != x_/usr; then
+    CPPFLAGS="-I${with_xmltooling}/include $CPPFLAGS"
+    DX_INCLUDE="${with_xmltooling}/include"
+    LIBS="-L${with_xmltooling}/lib -lxmltooling $LIBS"
+else
+    LIBS="-lxmltooling $LIBS"
+fi
+
 AC_CHECK_HEADER([xmltooling/XMLToolingConfig.h],,AC_MSG_ERROR([unable to find xmltooling header files]))
 
 AC_LINK_IFELSE(