From: stenn Date: Sun, 14 May 2017 10:22:11 +0000 (-0400) Subject: Provide Makefile variables LIBEVENT_{CFLAGS,CPPFLAGS,LDFLAGS} X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1a448088e3aef5b6baf161eb0f6d17e18a77313c;p=libevent Provide Makefile variables LIBEVENT_{CFLAGS,CPPFLAGS,LDFLAGS} This will allow a parent package to specify compiler, CPP, and linker flags to a libevent built as a sub-package. Document this in whatsnew-2.2.txt. Picked-from: #506 Closes: #506 --- diff --git a/Makefile.am b/Makefile.am index 23539767..902d5c19 100644 --- a/Makefile.am +++ b/Makefile.am @@ -231,7 +231,11 @@ NO_UNDEFINED = MAYBE_CORE = endif -GENERIC_LDFLAGS = -version-info $(VERSION_INFO) $(RELEASE) $(NO_UNDEFINED) +AM_CFLAGS = $(LIBEVENT_CFLAGS) +AM_CPPFLAGS = -I$(srcdir)/compat -I$(srcdir)/include -I./include $(SYS_INCLUDES) $(LIBEVENT_CPPFLAGS) +AM_LDFLAGS = $(LIBEVENT_LDFLAGS) + +GENERIC_LDFLAGS = -version-info $(VERSION_INFO) $(RELEASE) $(NO_UNDEFINED) $(AM_LDFLAGS) libevent_la_SOURCES = $(CORE_SRC) $(EXTRAS_SRC) libevent_la_LIBADD = @LTLIBOBJS@ $(SYS_LIBS) @@ -302,8 +306,6 @@ else noinst_HEADERS += $(EVENT1_HDRS) endif -AM_CPPFLAGS = -I$(srcdir)/compat -I$(srcdir)/include -I./include $(SYS_INCLUDES) - verify: check doxygen: FORCE diff --git a/whatsnew-2.2.txt b/whatsnew-2.2.txt index e69de29b..7e09e61f 100644 --- a/whatsnew-2.2.txt +++ b/whatsnew-2.2.txt @@ -0,0 +1,50 @@ +... + +* Building libevent as a sub-project using GNU Auto* tools + +Some projects will choose to include libevent in their source distribution, +and build libevent as a sub-project. This may be effected by putting the +line: + + AC_CONFIG_SUBDIRS([path/to/libevent]) + +in the master configure.ac file for the master project. + +There are cases where the master project will want to pass in additional +flags for CFLAGS, CPPFLAGS, or LDFLAGS. Since these variables are reserved +for the user, and AM_CFLAGS, AM_CPPFLAGS, and AM_LDFLAGS are reserved for +each package, libevent offers the following variables for a master package +to tell libevent that there are additional compile/link values: + + LIBEVENT_CFLAGS + LIBEVENT_CPPFLAGS + LIBEVENT_LDFLAGS + +A master package can set these variables in its configure.ac file. + +Here's an example: + +configure.ac: +... +EXTRA_CFLAGS=... +EXTRA_CPPFLAGS=... +EXTRA_LDFLAGS=... +... +dnl ac_configure_args is undocumented but widely abused, as here, +dnl to modify the defaults of the libevent subpackage, by prefixing +dnl our changes to the child configure arguments already assembled. +dnl User-supplied contradictory choices should prevail thanks to +dnl "last wins". +ac_configure_args=" --disable-openssl${ac_configure_args}" +ac_configure_args=" --disable-shared${ac_configure_args}" +ac_configure_args=" --disable-libevent-regress${ac_configure_args}" +ac_configure_args=" --disable-libevent-install${ac_configure_args}" +ac_configure_args=" --enable-silent-rules${ac_configure_args}" +ac_configure_args=" --enable-function-sections${ac_configure_args}" +ac_configure_args=" LIBEVENT_CFLAGS='${EXTRA_CFLAGS}'${ac_configure_args}" +ac_configure_args=" LIBEVENT_CPPFLAGS='${EXTRA_CPPFLAGS}'${ac_configure_args}" +ac_configure_args=" LIBEVENT_LDFLAGS='${EXTRA_LDFLAGS}'${ac_configure_args}" +AC_CONFIG_SUBDIRS([libevent]) +... + +The space after the initial '"' is significant. \ No newline at end of file