# HG changeset patch # User Binki # Date 2009-12-06 17:56:47 # Node ID ddb8d81ce0aa534421bf44646a341122429e644b # Parent 726c7e105f83b8117c67b3a58693175536f742e7 separate LDADD and LDFLAGS using PKGCONFIG_OHNOWRAP diff --git a/Makefile.am b/Makefile.am --- a/Makefile.am +++ b/Makefile.am @@ -1,1 +1,3 @@ SUBDIRS = src etc + +ACLOCAL_AMFLAGS = -I m4 diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# Copyright 2008 Nathan Phillip Brink, Ethan Zonca +# Copyright 2009 Nathan Phillip Brink, Ethan Zonca # # This file is a part of DistRen. # @@ -18,6 +18,7 @@ AC_PREREQ(2.61) AC_INIT([distren],[0.0],[http://bugs.ohnopub.net/]) AC_CONFIG_SRCDIR([src/server/distrend.c]) +AC_CONFIG_MACRO_DIR([m4]) AC_PROG_CC AC_PROG_LIBTOOL @@ -54,8 +55,10 @@ AC_DEFINE([_GNU_SOURCE], [1]) PKG_PROG_PKG_CONFIG(0.17.2) -PKG_CHECK_MODULES(DISTLIBS, libconfuse >= 2.5 libcurl libxml-2.0) -PKG_CHECK_MODULES([CHECK], [check >= 0.9.3]) + +PKGCONFIG_OHNOWRAP([DISTLIBS], [libconfuse >= 2.5 libcurl libxml-2.0]) + +PKGCONFIG_OHNOWRAP([CHECK], [check >= 0.9.3]) AC_DEFINE_DIR([SYSCONFDIR], [sysconfdir], [Directory to find configuration files in]) AC_DEFINE_DIR([LOCALSTATEDIR], [localstatedir], [Directory in which the server or client may store its state files and data]) diff --git a/m4/pkgconfig_ohnowrap.m4 b/m4/pkgconfig_ohnowrap.m4 new file mode 100644 --- /dev/null +++ b/m4/pkgconfig_ohnowrap.m4 @@ -0,0 +1,39 @@ +# Copyright 2009 Nathan Phillip Brink +# +# This file is a part of DistRen. +# +# Distren is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# DistRen is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with DistRen. If not, see . +# + +# PKGCONFIG_OHNOWRAP(VARIABLE-PREFIX, MODULES) +# see bug 13912 on freedesktop's bugzilla +# $1 is the var to store stuff in +# $2 is the listing of modules to pass to PKG_CHECK_MODULES +# +# Original code derived from and depending on pkg.m4 distributed with dev-util/pkgconfig-0.23 +# which is Copyright (c) 2004 Scott James Remnant +# +AC_DEFUN([PKGCONFIG_OHNOWRAP], +[dnl +AC_ARG_VAR([$1][_LDADD],[Linker names of libraries to link to for $1])dnl +AC_ARG_VAR([$1][_LDFLAGS],[Linker flags for linking to libraries for $1])dnl + +PKG_CHECK_MODULES([$1], [$2]) + +_PKG_CONFIG([$1][_LDADD], [libs-only], [$2]) +_PKG_CONFIG([$1][_LDFLAGS], [libs-only-other], [$2]) + +$1[]_LDADD=$pkg_cv_[]$1[]_LDADD +$1[]_LDFLAGS=$pkg_cv_[]$1[]_LDFLAGS +]) diff --git a/src/client/Makefile.am b/src/client/Makefile.am --- a/src/client/Makefile.am +++ b/src/client/Makefile.am @@ -1,6 +1,7 @@ bin_PROGRAMS = distren distren_SOURCES = distren.c -distren_LDADD = @DISTLIBS_LIBS@libdistren.la +distren_LDADD = @DISTLIBS_LDADD@ libdistren.la +distren_LDFLAGS = @DISTLIBS_LDFLAGS@ distren_CFLAGS = @DISTLIBS_CFLAGS@ @@ -13,9 +14,9 @@ lib_LTLIBRARIES = libdistren.la libdistren_la_SOURCES = distren.h libdistren.h libdistren.c libdistren_job.c libdistren_unbias.c libdistren_config.c #evidently the following should not be LDADD, but LDFLAGS because automake doesn't like the idea of LDADD for libraries for some reason... or I am very confused -libdistren_la_LIBADD = @DISTLIBS_LIBS@ @top_builddir@/src/common/libdistrencommon.la +libdistren_la_LIBADD = @DISTLIBS_LDADD@ @top_builddir@/src/common/libdistrencommon.la libdistren_la_CFLAGS = @DISTLIBS_CFLAGS@ -I@top_srcdir@/src/common #see http://sources.redhat.com/autobook/autobook/autobook_91.html # either increase the revision number or the interface number each release! -libdistren_la_LDFLAGS = -version-info 0:0:0 +libdistren_la_LDFLAGS = @DISTLIBS_LDFLAGS@ -version-info 0:0:0 diff --git a/src/common/Makefile.am b/src/common/Makefile.am --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -2,9 +2,9 @@ pkglib_LTLIBRARIES = libdistrencommon.la libdistrencommon_la_SOURCES = options.c options.h execio.h execio.c remoteio.h libremoteio.h remoteio.c asprintf.h asprintf.c #evidently the following should not be LDADD, but LDFLAGS because automake doesn't like the idea of LDADD for libraries for some reason... or I am very confused -libdistrencommon_la_LIBADD = @DISTLIBS_LIBS@ +libdistrencommon_la_LIBADD = @DISTLIBS_LDADD@ libdistrencommon_la_CXXFLAGS = @DISTLIBS_CFLAGS@ #see http://sources.redhat.com/autobook/autobook/autobook_91.html # either increase the revision number or the interface number each release! -libdistrencommon_la_LDFLAGS = -version-info 0:0:0 +libdistrencommon_la_LDFLAGS = @DISTLIBS_LDFLAGS@ -version-info 0:0:0 diff --git a/src/server/Makefile.am b/src/server/Makefile.am --- a/src/server/Makefile.am +++ b/src/server/Makefile.am @@ -2,9 +2,11 @@ COMMON_SOURCES = slavefuncs.c slavefunc bin_PROGRAMS = distrend distrenslave distrend_SOURCES = distrend.c distrend.h ${COMMON_SOURCES} user_mgr.c user_mgr.h listen.h listen.c -distrend_LDADD = @DISTLIBS_LIBS@ @top_builddir@/src/common/libdistrencommon.la @LIST_LIBS@ +distrend_LDADD = @top_builddir@/src/common/libdistrencommon.la @DISTLIBS_LDADD@ @LIST_LIBS@ +distrend_LDFLAGS = @DISTLIBS_LDFLAGS@ distrend_CFLAGS = @DISTLIBS_CFLAGS@ -I@top_srcdir@/src/common distrenslave_SOURCES = slave.c ${COMMON_SOURCES} -distrenslave_LDADD = @DISTLIBS_LIBS@ @top_builddir@/src/common/libdistrencommon.la +distrenslave_LDADD = @DISTLIBS_LDADD@ @top_builddir@/src/common/libdistrencommon.la +distrenslave_LDFLAGS = @DISTLIBS_LDFLAGS@ distrenslave_CFLAGS = @DISTLIBS_CFLAGS@ -I@top_srcdir@/src/common