[libxml2] Detect libm using libtool's macros



commit 5c71ada83acf30dc7e8ca8fca1f025c7dd014447
Author: David Seifert <soap gentoo org>
Date:   Wed Mar 30 16:51:17 2022 +0200

    Detect libm using libtool's macros

 CMakeLists.txt               |  4 ++--
 Makefile.am                  |  4 ++--
 configure.ac                 | 14 ++------------
 fuzz/Makefile.am             |  2 +-
 libxml-2.0-uninstalled.pc.in |  2 +-
 libxml-2.0.pc.in             |  2 +-
 6 files changed, 9 insertions(+), 19 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f97a0c9b..94dfc1df 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -395,7 +395,7 @@ endif()
 
 if(UNIX)
        target_link_libraries(LibXml2 PRIVATE m)
-       set(M_LIBS "-lm")
+       set(LIBM "-lm")
 endif()
 
 if(WIN32)
@@ -650,7 +650,7 @@ endif()
 set(XML_INCLUDEDIR "-I\${includedir}/libxml2")
 set(XML_LIBDIR "-L\${libdir}")
 set(XML_LIBS "-lxml2")
-set(XML_PRIVATE_LIBS "${Z_LIBS} ${LZMA_LIBS} ${THREAD_LIBS} ${ICONV_LIBS} ${ICU_LIBS} ${M_LIBS}")
+set(XML_PRIVATE_LIBS "${Z_LIBS} ${LZMA_LIBS} ${THREAD_LIBS} ${ICONV_LIBS} ${ICU_LIBS} ${LIBM}")
 
 file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig" "${CMAKE_INSTALL_PREFIX}")
 string(REGEX REPLACE "/$" "" PACKAGE_RELATIVE_PATH "${PACKAGE_RELATIVE_PATH}")
diff --git a/Makefile.am b/Makefile.am
index 83ca13c2..b28b27e6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -23,7 +23,7 @@ bin_PROGRAMS = xmllint xmlcatalog
 bin_SCRIPTS=xml2-config
 
 lib_LTLIBRARIES = libxml2.la
-libxml2_la_LIBADD = $(ICU_LIBS) $(THREAD_LIBS) $(Z_LIBS) $(LZMA_LIBS) $(ICONV_LIBS) $(M_LIBS) 
$(WIN32_EXTRA_LIBADD)
+libxml2_la_LIBADD = $(ICU_LIBS) $(THREAD_LIBS) $(Z_LIBS) $(LZMA_LIBS) $(ICONV_LIBS) $(LIBM) 
$(WIN32_EXTRA_LIBADD)
 
 if USE_VERSION_SCRIPT
 LIBXML2_VERSION_SCRIPT = $(VERSION_SCRIPT_FLAGS)$(srcdir)/libxml2.syms
@@ -54,7 +54,7 @@ libxml2_la_SOURCES = SAX.c entities.c encoding.c error.c parserInternals.c  \
                xmlmodule.c schematron.c xzlib.c
 
 DEPS = $(top_builddir)/libxml2.la
-LDADDS = $(top_builddir)/libxml2.la $(THREAD_LIBS) $(Z_LIBS) $(LZMA_LIBS) $(ICONV_LIBS) $(M_LIBS) 
$(WIN32_EXTRA_LIBADD)
+LDADDS = $(top_builddir)/libxml2.la $(THREAD_LIBS) $(Z_LIBS) $(LZMA_LIBS) $(ICONV_LIBS) $(LIBM) 
$(WIN32_EXTRA_LIBADD)
 
 
 man_MANS = xml2-config.1 libxml.3
diff --git a/configure.ac b/configure.ac
index 01108a51..2b5b6230 100644
--- a/configure.ac
+++ b/configure.ac
@@ -62,6 +62,7 @@ AC_PATH_PROG(XSLTPROC, xsltproc, /usr/bin/xsltproc)
 PKG_PROG_PKG_CONFIG
 
 LT_INIT([disable-static])
+LT_LIB_M
 
 dnl
 dnl if the system support linker version scripts for symbol versioning
@@ -1246,16 +1247,6 @@ iconv (cd, NULL, NULL, NULL, NULL);]])],[
                LIBS="${_libs}"
                LDFLAGS="${_ldflags}"])]))
 fi
-case "$host" in
-       *mingw*) M_LIBS=""
-       ;;
-       *beos*) M_LIBS=""
-       ;;
-        *haiku*) M_LIBS=""
-        ;;
-       *) M_LIBS="-lm"
-       ;;
-esac
 AC_SUBST(WITH_ICONV)
 
 WITH_ICU=0
@@ -1317,7 +1308,7 @@ else
     fi
 fi
 XML_LIBS="-lxml2"
-XML_PRIVATE_LIBS="$Z_LIBS $LZMA_LIBS $THREAD_LIBS $ICONV_LIBS $ICU_LIBS $M_LIBS $LIBS"
+XML_PRIVATE_LIBS="$Z_LIBS $LZMA_LIBS $THREAD_LIBS $ICONV_LIBS $ICU_LIBS $LIBM $LIBS"
 XML_LIBTOOLLIBS="libxml2.la"
 AC_SUBST(WITH_ICU)
 
@@ -1466,7 +1457,6 @@ AC_SUBST(ICONV_LIBS)
 AC_SUBST(ICU_LIBS)
 AC_SUBST(XML_INCLUDEDIR)
 
-AC_SUBST(M_LIBS)
 AC_SUBST(RDL_LIBS)
 
 dnl for the spec file
diff --git a/fuzz/Makefile.am b/fuzz/Makefile.am
index 69410bc5..3284aab7 100644
--- a/fuzz/Makefile.am
+++ b/fuzz/Makefile.am
@@ -6,7 +6,7 @@ EXTRA_DIST = html.dict regexp.dict schema.dict xml.dict xpath.dict \
 CLEANFILES = $(EXTRA_PROGRAMS)
 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
 DEPENDENCIES = $(top_builddir)/libxml2.la
-LDADD = $(top_builddir)/libxml2.la $(THREAD_LIBS) $(Z_LIBS) $(LZMA_LIBS) $(ICONV_LIBS) $(M_LIBS) 
$(WIN32_EXTRA_LIBADD)
+LDADD = $(top_builddir)/libxml2.la $(THREAD_LIBS) $(Z_LIBS) $(LZMA_LIBS) $(ICONV_LIBS) $(LIBM) 
$(WIN32_EXTRA_LIBADD)
 
 XML_MAX_LEN = 80000
 # Single quotes to avoid wildcard expansion by the shell
diff --git a/libxml-2.0-uninstalled.pc.in b/libxml-2.0-uninstalled.pc.in
index 60b886b3..d8ba2966 100644
--- a/libxml-2.0-uninstalled.pc.in
+++ b/libxml-2.0-uninstalled.pc.in
@@ -8,5 +8,5 @@ Name: libXML
 Version: @VERSION@
 Description: libXML library version2.
 Requires:
-Libs: -L${libdir} -lxml2 @ICU_LIBS@ @THREAD_LIBS@ @Z_LIBS@ @LZMA_LIBS@ @ICONV_LIBS@ @M_LIBS@ @LIBS@
+Libs: -L${libdir} -lxml2 @ICU_LIBS@ @THREAD_LIBS@ @Z_LIBS@ @LZMA_LIBS@ @ICONV_LIBS@ @LIBM@ @LIBS@
 Cflags: -I${includedir} @XML_INCLUDEDIR@ @XML_CFLAGS@
diff --git a/libxml-2.0.pc.in b/libxml-2.0.pc.in
index 2653a7c5..a10c8696 100644
--- a/libxml-2.0.pc.in
+++ b/libxml-2.0.pc.in
@@ -9,5 +9,5 @@ Version: @VERSION@
 Description: libXML library version2.
 Requires:
 Libs: -L${libdir} -lxml2
-Libs.private: @ICU_LIBS@ @THREAD_LIBS@ @Z_LIBS@ @LZMA_LIBS@ @ICONV_LIBS@ @M_LIBS@ @WIN32_EXTRA_LIBADD@ @LIBS@
+Libs.private: @ICU_LIBS@ @THREAD_LIBS@ @Z_LIBS@ @LZMA_LIBS@ @ICONV_LIBS@ @LIBM@ @WIN32_EXTRA_LIBADD@ @LIBS@
 Cflags: @XML_INCLUDEDIR@ @XML_CFLAGS@


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]