From 76d8d4f503805618f883915b72f02e10b26aefb8 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 4 Sep 2007 03:22:40 +0200 Subject: Add autoconfization --- Makefile | 8 ------ Makefile.am | 10 +++++++ bootstrap.sh | 63 +++++++++++++++++++++++++++++++++++++++++ configure.ac | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 165 insertions(+), 8 deletions(-) delete mode 100644 Makefile create mode 100644 Makefile.am create mode 100755 bootstrap.sh create mode 100644 configure.ac diff --git a/Makefile b/Makefile deleted file mode 100644 index ed66e29..0000000 --- a/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -CFLAGS=-O0 -Wall -Wextra -W `pkg-config --cflags libpulse` -g -LIBS=-lssl `pkg-config --libs libpulse` - -libflashsupport.so: flashsupport.c - $(CC) -shared $(CFLAGS) $(LIBS) $< -o $@ - -clean: - rm -f *.so diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..2b8f245 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,10 @@ + + +AM_LDFLAGS=-avoid-version -module -export-dynamic + +lib_LTLIBRARIES = libflashsupport.la + +libflashsupport_la_SOURCES = flashsupport.c +libflashsupport_la_LIBADD = $(AM_LIBADD) $(PULSE_LIBS) $(LIBSSL_LIBS) +libflashsupport_la_CFLAGS = $(AM_CFLAGS) $(PULSE_CFLAGS) $(LIBSSL_CFLAGS) + diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100755 index 0000000..f8e4e82 --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +# This file is part of libflashsupport-pulse. +# +# libflashsupport-pulse 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. +# +# libflashsupport-pulse 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. +# +# You should have received a copy of the GNU Lesser General Public +# License along with libflashsupport-pulse; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +# 02111-1307 USA. + +VERSION=1.9 + +run_versioned() { + local P + local V + + V=$(echo "$2" | sed -e 's,\.,,g') + + if [ -e "`which $1$V 2> /dev/null`" ] ; then + P="$1$V" + else + if [ -e "`which $1-$2 2> /dev/null`" ] ; 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 + + "$LIBTOOLIZE" -c --force + run_versioned aclocal "$VERSION" + run_versioned autoconf 2.59 -Wall + run_versioned autoheader 2.59 + run_versioned automake "$VERSION" --copy --foreign --add-missing + + if test "x$NOCONFIGURE" = "x"; then + CFLAGS="-g -O0" ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var "$@" + make clean + fi +fi diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..e4dfb15 --- /dev/null +++ b/configure.ac @@ -0,0 +1,92 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +# This file is part of libflashsupport-pulse. +# +# libflashsupport-pulse 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. +# +# libflashsupport-pulse 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. +# +# You should have received a copy of the GNU Lesser General Public +# License along with libflashsupport-pulse; 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([libflashsupport-pulse], 0, [mzcbylcnhqvb (at) 0pointer (dot) de]) +AC_CONFIG_SRCDIR([flashsupport.c]) +AC_CONFIG_HEADERS([config.h]) +AM_INIT_AUTOMAKE([foreign -Wall]) + +AC_PROG_CC +AM_PROG_CC_C_O +AC_PROG_GCC_TRADITIONAL +AC_GNU_SOURCE + +# GCC flags + +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 + + # 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" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + done +fi + +AM_DISABLE_STATIC +AC_PROG_LIBTOOL + +AC_HEADER_STDC + +AC_CHECK_PROG(have_pkg_config, pkg-config, yes, no) + +if test x"$have_pkg_config" = "xno"; then + AC_MSG_ERROR(pkg-config is required to install this program) +fi + +PKG_PROG_PKG_CONFIG + +if test -d ../pulseaudio ; then + PULSE_CFLAGS='-I$(top_srcdir)/../pulseaudio/src' + PULSE_LIBS='-L$(top_srcdir)/../pulseaudio/src/.libs -lpulse' + echo "*** Found pulseaudio in ../pulseaudio, using that version ***" +else + PKG_CHECK_MODULES(PULSE, [ libpulse >= 0.9.7 ]) +fi + +AC_SUBST(PULSE_LIBS) +AC_SUBST(PULSE_CFLAGS) + +PKG_CHECK_MODULES(LIBSSL, [ libssl ]) + +AC_SUBST(LIBSSL_LIBS) +AC_SUBST(LIBSSL_CFLAGS) + +AC_CONFIG_FILES([Makefile]) + +AC_OUTPUT -- cgit