From ebe00d640b9f57411d41fea038bf6b9fc55795d0 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 28 Jul 2008 20:35:53 +0200 Subject: modernize build system --- Makefile.am | 15 ++++++--------- autogen.sh | 17 +++++++++-------- configure.ac | 52 +++++++++++++++++++++++++++------------------------ libdaemon/Makefile.am | 2 +- 4 files changed, 44 insertions(+), 42 deletions(-) diff --git a/Makefile.am b/Makefile.am index 85d683b..e988050 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,15 +17,15 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 # USA -EXTRA_DIST=bootstrap.sh LICENSE libdaemon.spec +EXTRA_DIST=bootstrap.sh LICENSE SUBDIRS=libdaemon doc examples -MAINTAINERCLEANFILES = libdaemon.spec -noinst_DATA = libdaemon.spec - pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libdaemon.pc +noinst_DATA = +MAINTAINERCLEANFILES= + if USE_LYNX noinst_DATA += README EXTRA_DIST += README @@ -34,7 +34,7 @@ MAINTAINERCLEANFILES += README README: rm -f README $(MAKE) -C doc README - ln -s doc/README README + cd $(srcdir) && ln -s doc/README README endif doxygen: @@ -48,7 +48,4 @@ homepage: dist doxygen ln -sf README.html $$HOME/homepage/private/projects/libdaemon/index.html cp -av doc/reference/ $$HOME/homepage/private/projects/libdaemon/ -distcleancheck: - @: - -.PHONY: homepage distcleancheck +.PHONY: homepage doxygen diff --git a/autogen.sh b/autogen.sh index 6ba0c75..3b30052 100755 --- a/autogen.sh +++ b/autogen.sh @@ -25,12 +25,12 @@ run_versioned() { local V V=$(echo "$2" | sed -e 's,\.,,g') - - if [ -e "`which $1$V`" ] ; then - P="$1$V" + + if [ -e "`which $1$V 2> /dev/null`" ] ; then + P="$1$V" else - if [ -e "`which $1-$2`" ] ; then - P="$1-$2" + if [ -e "`which $1-$2 2> /dev/null`" ] ; then + P="$1-$2" else P="$1" fi @@ -45,22 +45,23 @@ set -ex if [ "x$1" = "xam" ] ; then run_versioned automake "$VERSION" -a -c --foreign ./config.status -else +else rm -rf autom4te.cache rm -f config.cache + touch config.rpath test "x$LIBTOOLIZE" = "x" && LIBTOOLIZE=libtoolize mkdir -p common - run_versioned "$LIBTOOLIZE" 1.5 -c --force + "$LIBTOOLIZE" -c --force run_versioned aclocal "$VERSION" -I common run_versioned autoconf 2.59 -Wall run_versioned autoheader 2.59 run_versioned automake "$VERSION" -a -c --foreign if test "x$NOCONFIGURE" = "x"; then - ./configure "$@" + CFLAGS="-g -O0" ./configure --sysconfdir=/etc --localstatedir=/var "$@" make clean fi fi diff --git a/configure.ac b/configure.ac index 4e9c82d..22366f3 100644 --- a/configure.ac +++ b/configure.ac @@ -21,13 +21,17 @@ # USA AC_PREREQ(2.59) + AC_INIT([libdaemon],[0.12],[mzqnrzba (at) 0pointer (dot) de]) AC_CONFIG_SRCDIR([libdaemon/dfork.c]) AC_CONFIG_HEADERS([config.h]) + AM_INIT_AUTOMAKE([foreign 1.9 -Wall]) AC_SUBST(PACKAGE_URL, [http://0pointer.de/lennart/projects/libdaemon/]) +AC_SUBST(LIBDAEMON_VERSION_INFO, [3:1:3]) + if type -p stow > /dev/null && test -d /usr/local/stow ; then AC_MSG_NOTICE([*** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***]) ac_default_prefix="/usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION}" @@ -40,32 +44,30 @@ AC_PROG_CXX AC_PROG_MAKE_SET AC_PROG_LIBTOOL +test_gcc_flag() { + AC_LANG_CONFTEST([int main(int argc, char*argv[]) {}]) + $CC -c conftest.c $CFLAGS "$1" -o conftest.o > /dev/null 2> /dev/null + ret=$? + rm -f conftest.o + return $ret +} + # If using GCC specify some additional parameters if test "x$GCC" = "xyes" ; then - CFLAGS="$CFLAGS -pipe -W -Wall -pedantic" - - # Test whether sys/signal.h can be included when compiled with -std=c99 - AC_MSG_CHECKING([checking whether sys/signal.h can be included with -std=c99]) - OLDCFLAGS="$CFLAGS" - CFLAGS="-std=c99" - AC_TRY_COMPILE([#include ], - [int main(void) { - struct sigaction sa; - sa.sa_handler = 0; - return 0; - };], use_stdc99=yes, use_stdc99=no) - - if test x"$use_stdc99" = xyes; then - CFLAGS="-std=c99 $OLDCFLAGS" - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - CFLAGS="$OLDCFLAGS" - fi - - AC_LANG_CONFTEST([int main() {}]) - $CC -c conftest.c -Wno-unused-parameter $CFLAGS > /dev/null 2> /dev/null && CFLAGS="$CFLAGS -Wno-unused-parameter" - rm -f conftest.o + # We use gnu99 instead of c99 because many have interpreted the standard + # in a way that int64_t isn't defined on non-64 bit platforms. + DESIRED_FLAGS="-std=gnu99 -Wall -W -Wextra -pedantic -pipe -Wformat -Wold-style-definition -Wdeclaration-after-statement -Wfloat-equal -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wendif-labels -Wpointer-arith -Wcast-align -Wwrite-strings -Winline -Wno-unused-parameter -ffast-math" + + for flag in $DESIRED_FLAGS ; do + AC_MSG_CHECKING([whether $CC accepts $flag]) + if test_gcc_flag $flag ; then + CFLAGS="$CFLAGS $flag" + CXXFLAGS="$CXXFLAGS $flag" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + done fi # Checks for header files. @@ -89,6 +91,8 @@ AC_FUNC_SETPGRP AC_TYPE_SIGNAL AC_TYPE_SIZE_T +AC_SYS_LARGEFILE + # LYNX documentation generation AC_ARG_ENABLE(lynx, AC_HELP_STRING(--disable-lynx,Turn off lynx usage for documentation generation), diff --git a/libdaemon/Makefile.am b/libdaemon/Makefile.am index 05fd80f..6812c3d 100644 --- a/libdaemon/Makefile.am +++ b/libdaemon/Makefile.am @@ -40,4 +40,4 @@ libdaemon_la_SOURCES = \ daemon.h \ $(pkg_include_HEADERS) -libdaemon_la_LDFLAGS = -version-info 3:1:3 +libdaemon_la_LDFLAGS = -version-info $(LIBDAEMON_VERSION_INFO) -- cgit