From ec3ad0d5b3f261743917e870ef3371b0af314010 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 16 Feb 2007 13:51:54 +0000 Subject: assorted build system updates git-svn-id: file:///home/lennart/svn/public/libasyncns/trunk@28 cc0fb855-19ed-0310-866e-8c1d96e4abae --- Makefile.am | 5 +--- autogen.sh | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++ bootstrap.sh | 62 +++++++++++++++++++----------------------------- configure.ac | 56 +++++++++++++++++++++++++++++-------------- libasyncns/Makefile.am | 10 ++++---- 5 files changed, 132 insertions(+), 65 deletions(-) create mode 100755 autogen.sh diff --git a/Makefile.am b/Makefile.am index 209d135..7178652 100644 --- a/Makefile.am +++ b/Makefile.am @@ -39,10 +39,7 @@ homepage: all dist doxygen cp -a doxygen/html/* $$HOME/homepage/private/projects/libasyncns/doxygen ln -sf README.html $$HOME/homepage/private/projects/libasyncns/index.html -distcleancheck: - @: - doxygen: $(MAKE) -C doxygen doxygen -.PHONY: homepage distcleancheck doxygen +.PHONY: homepage doxygen diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..8d8bc2d --- /dev/null +++ b/autogen.sh @@ -0,0 +1,64 @@ +#!/bin/sh +# $Id$ + +# This file is part of libasyncns. +# +# libasyncns is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation; either version 2.1 of the +# License, or (at your option) any later version. +# +# libasyncns 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with libasyncns; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +VERSION=1.9 + +run_versioned() { + local P + local V + + V=$(echo "$2" | sed -e 's,\.,,g') + + if [ -e "`which $1$V`" ] ; then + P="$1$V" + else + if [ -e "`which $1-$2`" ] ; then + P="$1-$2" + else + P="$1" + fi + fi + + shift 2 + "$P" "$@" +} + +set -ex + +if [ "x$1" = "xam" ] ; then + run_versioned automake "$VERSION" -a -c --foreign + ./config.status +else + rm -rf autom4te.cache + rm -f config.cache + + test "x$LIBTOOLIZE" = "x" && LIBTOOLIZE=libtoolize + + run_versioned "$LIBTOOLIZE" 1.5 -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 "$@" + make clean + fi +fi diff --git a/bootstrap.sh b/bootstrap.sh index 5980660..524770a 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,47 +1,33 @@ -#!/bin/bash # $Id$ # This file is part of libasyncns. # # libasyncns is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. +# under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation; either version 2.1 of the +# License, or (at your option) any later version. # # libasyncns 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 -# General Public License for more details. +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. # -# You should have received a copy of the GNU Lesser General Public License -# along with libasyncns; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - -run_versioned() { - local P - type -p "$1-$2" &> /dev/null && P="$1-$2" || local P="$1" - - shift 2 - "$P" "$@" -} - -if [ "x$1" = "xam" ] ; then - set -ex - run_versioned automake 1.7 -a -c --foreign - ./config.status -else - set -ex - - rm -rf autom4te.cache - rm -f config.cache - - run_versioned aclocal 1.7 - libtoolize -c --force - autoheader - run_versioned automake 1.7 -a -c --foreign - autoconf -Wall - - CFLAGS="-g -O0" ./configure --sysconfdir=/etc "$@" - - make clean -fi +# You should have received a copy of the GNU Lesser General Public +# License along with libasyncns; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +FLAGS="--sysconfdir=/etc" + +case `uname -s` in + Darwin) + export LIBTOOLIZE=/opt/local/bin/glibtoolize + export PKG_CONFIG_PATH="/opt/local/lib/pkgconfig" + FLAGS="$FLAGS --prefix=/opt/local" + ;; + FreeBSD) + cp /usr/local/share/aclocal/libtool15.m4 common/ + ;; +esac + +CFLAGS="$CFLAGS -g -O0" exec ./autogen.sh $FLAGS "$@" diff --git a/configure.ac b/configure.ac index ea13552..e1c1dac 100644 --- a/configure.ac +++ b/configure.ac @@ -19,16 +19,15 @@ # along with libasyncns; if not, write to the Free Software Foundation, # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -AC_PREREQ(2.57) -AC_INIT([libasyncns],[0.1],[mznflapaf (at) 0pointer (dot) de]) +AC_PREREQ(2.59) +AC_INIT([libasyncns],[0.2],[mznflapaf (at) 0pointer (dot) de]) AC_CONFIG_SRCDIR([libasyncns/asyncns.c]) AC_CONFIG_HEADERS([config.h]) -AM_INIT_AUTOMAKE([foreign -Wall]) +AM_INIT_AUTOMAKE([foreign 1.9 -Wall]) -AC_SUBST(PA_MAJORMINOR, "$PACKAGE_VERSION") AC_SUBST(PACKAGE_URL, [http://0pointer.de/lennart/projects/libasyncns/]) -AC_SUBST(PA_API_VERSION, 8) +AC_SUBST(LIBASYNCNS_VERSION_INFO, [1:0:1]) 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} ***]) @@ -38,29 +37,59 @@ fi # Checks for programs. AC_PROG_CC AC_PROG_CPP + +AC_GNU_SOURCE + AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET - -# libtool stuff AC_PROG_LIBTOOL +test_gcc_flag() { + AC_LANG_CONFTEST([int main() {}]) + $CC -c conftest.c $CFLAGS $@ > /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 + + DESIRED_FLAGS="-std=c99 -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 -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Winline -Wno-unused-parameter" + + for flag in $DESIRED_FLAGS ; do + AC_MSG_CHECKING([whether $CC accepts $flag]) + if test_gcc_flag $flag ; then + CFLAGS="$CFLAGS $flag" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + done +fi + # Checks for header files. AC_HEADER_STDC AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h stdlib.h string.h sys/socket.h unistd.h sys/prctl.h]) +AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h stdlib.h string.h sys/socket.h unistd.h sys/prctl.h netinet/in.h]) +AC_HEADER_RESOLV # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_PID_T AC_TYPE_SIZE_T +AC_TYPE_SSIZE_T +AC_TYPE_UINT16_T +AC_TYPE_UINT8_T AC_HEADER_TIME + # Checks for library functions. AC_FUNC_FORK AC_FUNC_MALLOC AC_FUNC_SELECT_ARGTYPES AC_TYPE_SIGNAL -AC_CHECK_FUNCS([memset select strndup setresuid setreuid]) +AC_CHECK_FUNCS([memset select strndup setresuid setreuid strerror]) AC_CHECK_LIB(nsl, gethostbyname) AC_CHECK_LIB(socket, connect) @@ -74,15 +103,6 @@ AC_CHECK_FUNC(res_query, , ACX_PTHREAD -# If using GCC specify some additional parameters -if test "x$GCC" = "xyes" ; then - CFLAGS="$CFLAGS -pipe -W -Wall -pedantic" - - AC_LANG_CONFTEST([int main() {}]) - $CC -c conftest.c -std=c99 -Wno-unused-parameter $CFLAGS > /dev/null 2> /dev/null && CFLAGS="$CFLAGS -std=c99 -Wno-unused-parameter" - rm -f conftest.o -fi - # LYNX documentation generation AC_ARG_ENABLE(lynx, AC_HELP_STRING(--disable-lynx,Turn off lynx usage for documentation generation), diff --git a/libasyncns/Makefile.am b/libasyncns/Makefile.am index 98d51e8..099957a 100644 --- a/libasyncns/Makefile.am +++ b/libasyncns/Makefile.am @@ -17,17 +17,17 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA. -AM_CFLAGS=-D_GNU_SOURCE -D__EXTENSIONS__ $(PTHREAD_CFLAGS) -AM_LIBADD=$(PTHREAD_LIBS) -AM_LDADD=$(PTHREAD_LIBS) +AM_CFLAGS=-D__EXTENSIONS__ $(PTHREAD_CFLAGS) lib_LTLIBRARIES=libasyncns.la -libasyncns_la_LIBADD=$(AM_LIBADD) -lresolv libasyncns_la_CC=$(PTHREAD_CC) libasyncns_la_SOURCES=asyncns.c asyncns.h +libasyncns_la_LDFLAGS=-version-info $(LIBASYNCNS_VERSION_INFO) +libasyncns_la_LIBADD=$(PTHREAD_LIBS) noinst_PROGRAMS=asyncns-test +asyncns_test_CC=$(PTHREAD_CC) asyncns_test_SOURCES=asyncns-test.c -asyncns_test_LDADD=$(AM_LDADD) libasyncns.la +asyncns_test_LDADD=libasyncns.la $(PTHREAD_LIBS) include_HEADERS=asyncns.h -- cgit