enable optional inline dependency build

This commit is contained in:
Danny Robson 2016-04-05 11:11:59 +10:00
parent 815e027b24
commit e321b9eee7
4 changed files with 45 additions and 3 deletions

View File

@ -22,6 +22,8 @@ NC_OPTIMISATION
NC_WARNINGS
NC_DEBUGGING
NC_SUBPACKAGE_ENABLE
LT_INIT
AM_INIT_AUTOMAKE([1.14 dist-bzip2 dist-xz foreign subdir-objects])
@ -104,10 +106,11 @@ AC_SUBST(LIBS)
# failure on a clean build
AX_APPEND_FLAG([-include config.h])
NC_SUBPACKAGE_PC([libcruft-util.pc])
AC_CONFIG_FILES([
Doxyfile
Makefile
libcruft-util.pc
])
AC_CONFIG_FILES([test/json-parse], [chmod a+x test/json-parse])

View File

@ -0,0 +1,6 @@
Name: libcruft-util
Description: A simple utility library in C++
URL: http://nerdcruft.net/
Version: @VERSION@
Libs: @abs_top_builddir@/libcruft-util.a @BOOST_LDFLAGS@ @LIBS@
Cflags: -isystem @abs_top_builddir@/fake @BOOST_CPPFLAGS@

View File

@ -7,5 +7,5 @@ Name: libcruft-util
Description: A simple utility library in C++
URL: http://nerdcruft.net/
Version: @VERSION@
Libs: -L${libdir} -lcruft-util @BOOST_LDFLAGS@ @BOOST_FILESYSTEM_LIB@ @BOOST_SYSTEM_LIB@ -lrt
Cflags: -I${includedir}/cruft @BOOST_CPPFLAGS@
Libs: -L${libdir} -lcruft-util @BOOST_LDFLAGS@ @LIBS@
Cflags: -I${includedir} @BOOST_CPPFLAGS@

33
m4/nc_subpackage.m4 Normal file
View File

@ -0,0 +1,33 @@
AC_DEFUN([NC_SUBPACKAGE_PC], [
base=`basename $1 .pc`
AC_CONFIG_FILES([$1:$base$nc_cv_config_pc_postfix.pc.in])
])
AC_DEFUN([NC_SUBPACKAGE_ENABLE],[
AC_ARG_ENABLE([inline], [AS_HELP_STRING([--enable-inline], [enable building for use as an inline dependency])])
AS_IF([test "x$enable_inline" == "xyes"], [
AC_PROG_LN_S
AC_CACHE_VAL([nc_cv_config_pc_postfix], [nc_cv_config_pc_postfix='-inline'])
AC_CONFIG_COMMANDS([fake/cruft], [
dnl make a fake include directory which looks like the typical
dnl installation prefix. we should probably use AC_CONFIG_LINKS
dnl but i'm not proficient enough at m4 to process the globs
dnl correctly.
AS_ECHO(["fake/cruft/$cruft_base"])
AS_MKDIR_P(["fake/cruft"])
$LN_S -nf "$ac_abs_top_srcdir" "fake/cruft/$cruft_base"
AS_IF([test ! -L "fake/cruft/$cruft_base"], [
AC_MSG_ERROR([could not create inline include directory])
])
], [
cruft_base=`echo "${PACKAGE_NAME}" | sed 's/-.*//'`
])
])
])