configure/make basics
PATCH 1/1 configure/make basics
Hi,
while hacking on a plugin for mmsd to deal with supl push messages, I ran into a few "not so nice" solved things in configure.ac / Makefile.am
1) libtool handling
libtool configuration is meanwhile done using LT_INIT(options) instead of AC_PROC_LIBTOOL and alike
==> because of libtool stores some of the configuration
in the generated libtool shell script, it's reasonable to run LT_INIT as late as possible (painfully learned while writing and porting c++ software for many OS)
2) additional libraries
do no require explicit libraries (like -lresolv), always let a devop in doubt invoke configure with LIBS="-lmyspecialwrapper" to wrap between available libs/functions and requirements
See pkgsrc's nbcompat library for example
Best regards,
Jens
Quoted 1 line
From
f2f5c911c0ac71ae0cdb0d7f54bbc0232ca001a1Mon Sep 17 00:00:00 2001
From: Jens Rehsack <[email protected]>
Date: Mon, 27 Feb 2012 15:41:34 +0100
Subject: [PATCH 2/3] changing depreciated libtool initialization to modern
one
--- Makefile.am | 4 ++++ configure.ac | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-)
Makefile.am +4 -0
@@ -1,6 +1,10 @@ AM_MAKEFLAGS = --no-print-directory +LIBTOOL_DEPS = @LIBTOOL_DEPS@ +libtool: $(LIBTOOL_DEPS) + $(SHELL) ./config.status libtool + gdbus_sources = gdbus/gdbus.h gdbus/mainloop.c gdbus/watch.c \ gdbus/object.c gdbus/polkit.c
configure.ac +8 -2
@@ -31,8 +31,8 @@ AC_PROG_INSTALL m4_define([_LT_AC_TAGCONFIG], []) m4_ifdef([AC_LIBTOOL_TAGS], [AC_LIBTOOL_TAGS([])]) -AC_DISABLE_STATIC -AC_PROG_LIBTOOL +dnl AC_DISABLE_STATIC +dnl AC_PROG_LIBTOOL AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization], [disable code optimization through compiler]), [
@@ -58,6 +58,12 @@ AC_ARG_ENABLE(pie, AC_HELP_STRING([--enable-pie], fi ]) +dnl LT_INIT should be invoked after all compiler flags checks, because +dnl of LT_INIT remembers the RPATH stored in test targets which might +dnl be different for different compiler flags (known issue on AIX) +LT_INIT([dlopen,disable-static]) +AC_SUBST([LIBTOOL_DEPS]) + AC_CHECK_HEADERS(resolv.h, dummy=yes, AC_MSG_ERROR(resolver header files are required)) AC_CHECK_LIB(resolv, ns_initparse, dummy=yes, [
Signature · 1 line
1.7.9.1
Quoted 1 line
From
47383148c76675da9965a4d54e0e1b985da22a6aMon Sep 17 00:00:00 2001
From: Jens Rehsack <[email protected]>
Date: Mon, 27 Feb 2012 16:07:18 +0100
Subject: [PATCH 3/3] let configure find required libs
--- Makefile.am | 2 +- configure.ac | 24 +++++++++++++++++------- 2 files changed, 18 insertions(+), 8 deletions(-)
Makefile.am +1 -1
@@ -28,7 +28,7 @@ src_mmsd_SOURCES = $(gdbus_sources) $(gweb_sources) $(builtin_sources) \ src/push.h src/push.c src/store.h src/store.c \ src/wsputil.h src/wsputil.c src/mmsutil.h src/mmsutil.c -src_mmsd_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ -lresolv -ldl +src_mmsd_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ src_mmsd_LDFLAGS = -Wl,--export-dynamic
configure.ac +17 -7
@@ -64,15 +64,25 @@ dnl be different for different compiler flags (known issue on AIX) LT_INIT([dlopen,disable-static]) AC_SUBST([LIBTOOL_DEPS]) +dnl check how we can use the resolver. while resolv.h comes with bind, +dnl it's probably reasonable to use a combined search macro like +dnl smart-snmpd's ACX_CHECK_LIB_FLAGS AC_CHECK_HEADERS(resolv.h, dummy=yes, AC_MSG_ERROR(resolver header files are required)) -AC_CHECK_LIB(resolv, ns_initparse, dummy=yes, [ - AC_CHECK_LIB(resolv, __ns_initparse, dummy=yes, - AC_MSG_ERROR(resolver library support is required)) -]) - -AC_CHECK_LIB(dl, dlopen, dummy=yes, - AC_MSG_ERROR(dynamic linking loader is required)) +dnl ns_initparse is libresolv internal use only - limited usage intended? +AC_SEARCH_LIBS(ns_initparse, resolv, , + AC_MSG_ERROR(resolver support is required)) +dnl AC_CHECK_LIB(resolv, ns_initparse, dummy=yes, [ +dnl AC_CHECK_LIB(resolv, __ns_initparse, dummy=yes, +dnl AC_MSG_ERROR(resolver library support is required)) +dnl ]) + +dnl search how we can load dynamic libraries +dnl TODO use libltdl, which would work on BeOS (Haiku), Darwin (MacOS X) or +dnl for debugging purposes with libtool's dlpreopen +AC_SEARCH_LIBS(dlopen, dl, , AC_MSG_ERROR(dynamic linking loader is required)) +dnl AC_CHECK_LIB(dl, dlopen, dummy=yes, +dnl AC_MSG_ERROR(dynamic linking loader is required)) PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, dummy=yes, AC_MSG_ERROR(GLib >= 2.16 is required))
Signature · 1 line
1.7.9.1
Hi Jens,
Quoted 4 lines
while hacking on a plugin for mmsd to deal with supl push messages, I ran into a few "not so nice" solved things in configure.ac / Makefile.am
Quoted 13 lines
1) libtool handling
libtool configuration is meanwhile done usingLT_INIT(options)instead ofAC_PROC_LIBTOOLand alike
==> because of libtool stores some of the configuration
in the generated libtool shell script, it's reasonable to runLT_INITas late as possible (painfully learned while writing and porting c++ software for many OS)
2) additional libraries
do no require explicit libraries (like -lresolv), always let a devop in doubt invoke configure with LIBS="-lmyspecialwrapper" to wrap between available libs/functions and requirements
See pkgsrc's nbcompat library for example
one patch per email please and all inline. Thanks.
Regards
Marcel