From f5721fe1301fc638f00d30c898add876bb05cd76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BChler?= Date: Tue, 10 Mar 2009 19:17:16 +0100 Subject: [PATCH] Add autotools support --- .gitignore | 9 +++++++ Makefile.am | 14 ++++++++++ autogen.sh | 24 +++++++++++++++++ configure.ac | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 121 insertions(+) create mode 100644 Makefile.am create mode 100755 autogen.sh create mode 100644 configure.ac diff --git a/.gitignore b/.gitignore index 2d67d6e..36978bd 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,12 @@ build *~ *.o +Makefile.in +aclocal.m4 +autom4te.cache +autoscan.log +config.h.in +configure +depcomp +install-sh +missing diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..d008a3a --- /dev/null +++ b/Makefile.am @@ -0,0 +1,14 @@ + +AM_CFLAGS=$(GLIB_CFLAGS) +spawn_fcgi_LDADD=$(GLIB_LIBS) + +EXTRA_DIST=autogen.sh spawn-fcgi.1 CMakeLists.txt config.h.cmake +man1_MANS=spawn-fcgi.1 + +bin_PROGRAMS=spawn-fcgi + +if PAM_LIMITS +spawn_fcgi_SOURCES=spawn-fcgi.c pam_limits.c +else +spawn_fcgi_SOURCES=spawn-fcgi.c +endif diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..7673deb --- /dev/null +++ b/autogen.sh @@ -0,0 +1,24 @@ +#!/bin/sh +# Run this to generate all the initial makefiles, etc. + +ACLOCAL=${ACLOCAL:-aclocal} +AUTOHEADER=${AUTOHEADER:-autoheader} +AUTOMAKE=${AUTOMAKE:-automake} +AUTOMAKE_FLAGS="--add-missing --copy" +AUTOCONF=${AUTOCONF:-autoconf} + +ARGV0=$0 + +set -e + + +run() { + echo "$ARGV0: running \`$@'" + $@ +} + +run $ACLOCAL $ACLOCAL_FLAGS +run $AUTOHEADER +run $AUTOMAKE $AUTOMAKE_FLAGS +run $AUTOCONF +echo "Now type './configure ...' and 'make' to compile." diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..337e230 --- /dev/null +++ b/configure.ac @@ -0,0 +1,74 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ(2.61) +AC_INIT([spawn-fcgi], [2.0.0], []) +AC_CONFIG_SRCDIR([spawn-fcgi.c]) +AC_CONFIG_HEADER([config.h]) + +AM_INIT_AUTOMAKE([-Wall -Werror foreign]) + +# Checks for programs. +AC_PROG_CC +AC_PROG_MAKE_SET +AC_PROG_INSTALL + +# Checks for libraries. + +# glib-2.0 +PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16.0, [ + AC_DEFINE([HAVE_GLIB_H], [1], [glib.h]) +],[AC_MSG_ERROR("glib-2.0 >= 2.16.0 not found")]) + +# Checks for header files. +AC_HEADER_STDC +AC_HEADER_SYS_WAIT +AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h stdlib.h string.h syslog.h unistd.h utmp.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_TYPE_UID_T +AC_TYPE_PID_T +AC_TYPE_SIZE_T +AC_HEADER_TIME + +# Checks for library functions. +AC_FUNC_CHOWN +AC_FUNC_FORK +AC_FUNC_SELECT_ARGTYPES +AC_FUNC_STAT +AC_CHECK_FUNCS([dup2 memset putenv select socket strchr strerror strtol strtoul strtoull]) + +# pam limits? +AC_ARG_ENABLE(pam-limits, + AC_HELP_STRING([--enable-pam-limits],[enable pam limits]), + [case "${enableval}" in + yes) pamlimits=yes ;; + no) pamlimits=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-pam-limits) ;; + esac],[pamlimits=yes]) + +AM_CONDITIONAL(PAM_LIMITS, test "x$pamlimits" = xyes) +if test "x$pamlimits" = xyes; then + AC_DEFINE([USE_LIMITS], [1], [pam limits]) +fi + +# check for extra compiler options (warning options) +if test "${GCC}" = "yes"; then + CFLAGS="${CFLAGS} -Wall -W -Wshadow -pedantic -std=gnu99" +fi + +AC_ARG_ENABLE(extra-warnings, + AC_HELP_STRING([--enable-extra-warnings],[enable extra warnings (gcc specific)]), + [case "${enableval}" in + yes) extrawarnings=true ;; + no) extrawarnings=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-extra-warnings) ;; + esac],[extrawarnings=false]) + +if test x$extrawarnings = xtrue; then + CFLAGS="${CFLAGS} -g -O2 -g2 -Wall -Wmissing-declarations -Wdeclaration-after-statement -Wno-pointer-sign -Wcast-align -Winline -Wsign-compare -Wnested-externs -Wpointer-arith -Wl,--as-needed -Wformat-security" +fi + +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT