chiark / gitweb /
build: Configure `pkg-config' correctly for static linking.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 14 Jun 2018 10:01:27 +0000 (11:01 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Thu, 14 Jun 2018 10:31:38 +0000 (11:31 +0100)
configure.ac
mLib.pc.in
vars.am

index 9ff83ba0ded47d6dc9e430c8a797bec780ca6bb8..ab8d2a8f02bd1e320275a2cb644cf093aee5a49f 100644 (file)
@@ -50,13 +50,17 @@ AC_DEFINE_UNQUOTED([SRCDIR], ["$(cd $srcdir && pwd)"],
 dnl--------------------------------------------------------------------------
 dnl C programming environment.
 
 dnl--------------------------------------------------------------------------
 dnl C programming environment.
 
+MLIB_LIBS=
+
 dnl Headers.
 AC_CHECK_HEADERS([float.h])
 AC_CHECK_HEADERS([stdint.h])
 
 dnl Libraries.
 dnl Headers.
 AC_CHECK_HEADERS([float.h])
 AC_CHECK_HEADERS([stdint.h])
 
 dnl Libraries.
+mdw_ORIG_LIBS=$LIBS LIBS=$MLIB_LIBS
 AC_SEARCH_LIBS([socket], [socket])
 AC_SEARCH_LIBS([gethostbyname], [nsl resolv])
 AC_SEARCH_LIBS([socket], [socket])
 AC_SEARCH_LIBS([gethostbyname], [nsl resolv])
+MLIB_LIBS=$LIBS LIBS=$mdw_ORIG_LIBS
 
 dnl Functions.
 AC_CHECK_FUNCS([snprintf])
 
 dnl Functions.
 AC_CHECK_FUNCS([snprintf])
@@ -78,6 +82,9 @@ AC_CHECK_MEMBERS([struct msgdr.msg_control],,, [
 dnl Find out whether we're cross-compiling.
 AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
 
 dnl Find out whether we're cross-compiling.
 AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
 
+dnl Set the master library list.
+AC_SUBST([MLIB_LIBS])
+
 dnl--------------------------------------------------------------------------
 dnl Name resolution.
 
 dnl--------------------------------------------------------------------------
 dnl Name resolution.
 
@@ -87,10 +94,12 @@ AC_ARG_WITH([adns],
   [want_adns=$withval],
   [want_adns=auto])
 
   [want_adns=$withval],
   [want_adns=auto])
 
+mdw_ORIG_LIBS=$LIBS LIBS=$MLIB_LIBS
 case $want_adns in
   no) ;;
   *) AC_SEARCH_LIBS([adns_init], [adns], [have_adns=yes], [have_adns=no]) ;;
 esac
 case $want_adns in
   no) ;;
   *) AC_SEARCH_LIBS([adns_init], [adns], [have_adns=yes], [have_adns=no]) ;;
 esac
+MLIB_LIBS=$LIBS LIBS=$mdw_ORIG_LIBS
 case $want_adns,$have_adns in
   yes,no)
     AC_MSG_ERROR([ADNS library not found but explicitly requested])
 case $want_adns,$have_adns in
   yes,no)
     AC_MSG_ERROR([ADNS library not found but explicitly requested])
index 624d60a0dacd66e6d1197feb7de52b2c55589646..3bfdacc039c961345a8785047d0f06742099f92a 100644 (file)
@@ -7,4 +7,5 @@ Name: mLib
 Description: A library of miscellaneous stuff
 Version: @VERSION@
 Libs: -L${libdir} -lmLib
 Description: A library of miscellaneous stuff
 Version: @VERSION@
 Libs: -L${libdir} -lmLib
+Libs.private: @MLIB_LIBS@
 Cflags: -I${includedir}
 Cflags: -I${includedir}
diff --git a/vars.am b/vars.am
index fceef07681f4329ddc2d1593300801748d2dfb95..9870cef014b52a44150196577f2e8331c43f833b 100644 (file)
--- a/vars.am
+++ b/vars.am
@@ -87,7 +87,8 @@ SUBSTITUTIONS = \
        prefix=$(prefix) exec_prefix=$(exec_prefix) \
        libdir=$(libdir) includedir=$(includedir) \
        bindir=$(bindir) sbindir=$(sbindir) \
        prefix=$(prefix) exec_prefix=$(exec_prefix) \
        libdir=$(libdir) includedir=$(includedir) \
        bindir=$(bindir) sbindir=$(sbindir) \
-       PACKAGE=$(PACKAGE) VERSION=$(VERSION)
+       PACKAGE=$(PACKAGE) VERSION=$(VERSION) \
+       MLIB_LIBS="$(MLIB_LIBS)"
 
 V_SUBST                         = $(V_SUBST_@AM_V@)
 V_SUBST_                = $(V_SUBST_@AM_DEFAULT_V@)
 
 V_SUBST                         = $(V_SUBST_@AM_V@)
 V_SUBST_                = $(V_SUBST_@AM_DEFAULT_V@)