From 1d125e316b35a214559dd9877ebccc60b0e0f7f8 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Tue, 19 Oct 2010 11:00:49 +0200 Subject: build: just use autoreconf This is the recommended way to regenerate the GNU build system files these days. Signed-off-by: Jan Engelhardt --- autogen.sh | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/autogen.sh b/autogen.sh index d65b0b7..72240f7 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,18 +1,4 @@ #!/bin/sh -run () -{ - echo "running: $*" - eval $* - - if test $? != 0 ; then - echo "error: while running '$*'" - exit 1 - fi -} - -run aclocal -run autoheader -run libtoolize -f -run automake -a -run autoconf +autoreconf -fi +rm -Rf autom4te.cache -- cgit v1.2.3 From 9bff2f93cbea33842229b6c2f150cb76ff53d8e0 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Tue, 19 Oct 2010 11:02:26 +0200 Subject: build: resolve autoreconf/libtoolize suggestions libtoolize: Consider adding "AC_CONFIG_MACRO_DIR([m4])" to configure.ac and libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree. libtoolize: Consider adding "-I m4" to ACLOCAL_AMFLAGS in Makefile.am. Signed-off-by: Jan Engelhardt --- Makefile.am | 2 ++ configure.ac | 1 + m4/.gitignore | 2 ++ 3 files changed, 5 insertions(+) create mode 100644 m4/.gitignore diff --git a/Makefile.am b/Makefile.am index 7225f86..acd3d14 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,7 @@ ## Process this file with automake to produce Makefile.in +ACLOCAL_AMFLAGS = -I m4 + include $(top_srcdir)/Make_global.am if ! WITH_KBUILDDIR diff --git a/configure.ac b/configure.ac index 7622ac4..34f0889 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,7 @@ dnl Boilerplate AC_INIT([ipset], [5.0], [kadlec@blackhole.kfki.hu]) AC_CANONICAL_SYSTEM +AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADER([config.h]) AM_INIT_AUTOMAKE([-Wall -Werror foreign]) diff --git a/m4/.gitignore b/m4/.gitignore new file mode 100644 index 0000000..64d9bbc --- /dev/null +++ b/m4/.gitignore @@ -0,0 +1,2 @@ +/libtool.m4 +/lt*.m4 -- cgit v1.2.3 From d6484ee2f3b256ec2a011bad383175388fd4ee05 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Tue, 19 Oct 2010 12:51:38 +0200 Subject: build: add separate option for kernel source directory The build directory is not necessarily the same as the source directory. Signed-off-by: Jan Engelhardt --- configure.ac | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index 34f0889..906ef84 100644 --- a/configure.ac +++ b/configure.ac @@ -13,10 +13,14 @@ esac dnl Additional arguments dnl Kernel build directory or source tree -AC_ARG_WITH([kernel], - AS_HELP_STRING([--with-kernel=PATH], - [Path to kernel source/build directory]), - [KBUILDDIR="$withval";]) +AC_ARG_WITH([kbuild], + AS_HELP_STRING([--with-kbuild=PATH], + [Path to kernel build directory]), + [KBUILDDIR="$withval";]) +AC_ARG_WITH([ksource], + AS_HELP_STRING([--with-ksource=PATH], + [Path to kernel source directory]), + [KSOURCEDIR="$withval";]) AM_CONDITIONAL(WITH_KBUILDDIR, test "$KBUILDDIR" != "") AC_SUBST(KBUILDDIR) @@ -28,9 +32,10 @@ else kbuilddir="/lib/modules/`uname -r`/build" fi -if test ! -e "$kbuilddir/include/linux/netfilter/nfnetlink.h" -then - AC_MSG_ERROR([Invalid kernel build directory $kbuilddir]) +if test -n "$KSOURCEDIR"; then + ksourcedir="$KSOURCEDIR" +else + ksourcedir="/lib/modules/$(uname -r)/source" fi if test ! -e "$kbuilddir/.config" @@ -46,11 +51,11 @@ then fi dnl Check kernel dependencies: nfnetlink.h -NFNL_CB_CONST="`./check_const $kbuilddir/include/linux/netfilter/nfnetlink.h`" +NFNL_CB_CONST="`./check_const $ksourcedir/include/linux/netfilter/nfnetlink.h`" AC_SUBST(NFNL_CB_CONST) dnl Check kernel dependencies: netlink.h -NETLINK_DUMP_CONST="`./check_const $kbuilddir/include/linux/netlink.h`" +NETLINK_DUMP_CONST="`./check_const $ksourcedir/include/linux/netlink.h`" AC_SUBST(NETLINK_DUMP_CONST) dnl Maximal number of sets supported by the kernel, default 256 -- cgit v1.2.3 From 7607e809e947dbdc89de84cbad960e5aa0accc91 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Tue, 19 Oct 2010 16:02:04 +0200 Subject: build: use libmnl's pkgconfig files libmnl installs .pc files that we can directly use and which are preferable over AC_CHECK_LIB. Also make sure that libipset.so is linked with libmnl, otherwise linking errors can ensue when a program tries to link to libipset. Furthermore, remove the now-unused LIBS variable. Signed-off-by: Jan Engelhardt --- configure.ac | 5 +---- lib/Makefile.am | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 906ef84..99129ea 100644 --- a/configure.ac +++ b/configure.ac @@ -109,10 +109,7 @@ AC_PROG_INSTALL AC_PROG_LN_S dnl Checks for libraries -AC_CHECK_LIB([mnl], [mnl_socket_open]) -if test x"${ac_cv_lib_mnl_mnl_socket_open}" = xno; then - AC_MSG_ERROR(libmnl not found) -fi +PKG_CHECK_MODULES([libmnl], [libmnl >= 1]) dnl Checks for header files diff --git a/lib/Makefile.am b/lib/Makefile.am index bf4e133..74f36e8 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,11 +1,11 @@ include $(top_srcdir)/Make_global.am -AM_CFLAGS += -fPIC -LIBS = +AM_CFLAGS += -fPIC ${libmnl_CFLAGS} lib_LTLIBRARIES = libipset.la libipset_la_LDFLAGS = -version-info $(LIBVERSION) +libipset_la_LIBADD = ${libmnl_LIBS} libipset_la_SOURCES = \ data.c \ mnl.c \ -- cgit v1.2.3 From 91c7437c25066cc94bf81be18a6f94c0c83bfb6c Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Tue, 19 Oct 2010 17:54:33 +0200 Subject: build: remove manual -fPIC flag libtool will take care of adding -fPIC as needed. In fact, static libraries are often not desired to be compiled with -fPIC. Signed-off-by: Jan Engelhardt --- lib/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Makefile.am b/lib/Makefile.am index 74f36e8..79b81db 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,6 +1,6 @@ include $(top_srcdir)/Make_global.am -AM_CFLAGS += -fPIC ${libmnl_CFLAGS} +AM_CFLAGS += ${libmnl_CFLAGS} lib_LTLIBRARIES = libipset.la -- cgit v1.2.3 From 6fd3b2350dae31d16166d66e7e143f78b5d5b6e3 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Tue, 19 Oct 2010 18:01:19 +0200 Subject: build: use subdir-objects and CC_C_O Signed-off-by: Jan Engelhardt --- configure.ac | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 99129ea..b86ec14 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_INIT([ipset], [5.0], [kadlec@blackhole.kfki.hu]) AC_CANONICAL_SYSTEM AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADER([config.h]) -AM_INIT_AUTOMAKE([-Wall -Werror foreign]) +AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects]) dnl Shortcut: Linux supported alone case $target in @@ -104,6 +104,7 @@ AM_CONDITIONAL([DISABLE_EXTRA_FLAGS], [test "x$extra_flags" = xno]) dnl Checks for programs AC_PROG_CC +AM_PROG_CC_C_O AC_PROG_LIBTOOL AC_PROG_INSTALL AC_PROG_LN_S -- cgit v1.2.3 From 554784c070ba034a2a5dae867480f91ec242a27a Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Tue, 19 Oct 2010 18:03:03 +0200 Subject: build: run autoupdate AC_CANONICAL_SYSTEM is deprecated in favor of calling one or more of AC_CANONICAL_{BUILD,HOST,TARGET}. Since configure.ac only uses $target, only AC_CANONICAL_TARGET is needed. Signed-off-by: Jan Engelhardt --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index b86ec14..0bff332 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ dnl Boilerplate AC_INIT([ipset], [5.0], [kadlec@blackhole.kfki.hu]) -AC_CANONICAL_SYSTEM +AC_CANONICAL_TARGET AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADER([config.h]) AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects]) @@ -105,7 +105,7 @@ AM_CONDITIONAL([DISABLE_EXTRA_FLAGS], [test "x$extra_flags" = xno]) dnl Checks for programs AC_PROG_CC AM_PROG_CC_C_O -AC_PROG_LIBTOOL +LT_INIT AC_PROG_INSTALL AC_PROG_LN_S -- cgit v1.2.3 From a2297acbaed4174f27a7caef98f2d84f9bde8c5c Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Tue, 19 Oct 2010 18:05:29 +0200 Subject: Add .gitignore files Signed-off-by: Jan Engelhardt --- .gitignore | 20 ++++++++++++++++++++ src/.gitignore | 1 + 2 files changed, 21 insertions(+) create mode 100644 .gitignore create mode 100644 src/.gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9f6660e --- /dev/null +++ b/.gitignore @@ -0,0 +1,20 @@ +*~ +*.la +*.lo +*.o +.deps +.libs +Makefile +Makefile.in + +/aclocal.m4 +/autom4te.cache +/compile +/config.* +/configure +/depcomp +/install-sh +/libtool +/ltmain.sh +/missing +/stamp-h1 diff --git a/src/.gitignore b/src/.gitignore new file mode 100644 index 0000000..6166aba --- /dev/null +++ b/src/.gitignore @@ -0,0 +1 @@ +/ipset -- cgit v1.2.3