From 30a4b516c8d591c11f05df38531f46452d930d2b Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sun, 5 Oct 2008 01:42:55 +0200 Subject: a lot of build system updates --- .gitignore | 23 ++++++++ Makefile.am | 20 ++++--- bootstrap.sh | 36 ++++++------ configure.ac | 169 ++++++++++++++++++++++++++++---------------------------- src/Makefile.am | 44 ++++++--------- 5 files changed, 157 insertions(+), 135 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..37396d1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,23 @@ +*.cache +stamp-* +libsydney.pc +libltdl/ +.deps +Makefile +Makefile.in +missing +m4/ +ltmain.sh +libtool +install-sh +aclocal.m4 +compile +config.guess +config.h +config.h.in +*.log +config.sub +config.status +configure +config.rpath +depcomp diff --git a/Makefile.am b/Makefile.am index 25c6325..74417ce 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,20 +1,20 @@ -# $Id$ -# # This file is part of libsydney. # +# Copyright 2007-2008 Lennart Poettering +# # libsydney 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. # # libsydney 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. +# Lesser General Public License for more details. # -# You should have received a copy of the GNU Lesser General Public License -# along with libsydney; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# You should have received a copy of the GNU Lesser General Public +# License along with libsydney. If not, see +# . EXTRA_DIST = bootstrap.sh LGPL SUBDIRS=src @@ -25,6 +25,8 @@ noinst_DATA = pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libsydney.pc +ACLOCAL_AMFLAGS = -I m4 + homepage: all dist doxygen test -d $$HOME/homepage/private mkdir -p $$HOME/homepage/private/projects/libsydney diff --git a/bootstrap.sh b/bootstrap.sh index 42b4ed9..158faa6 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,21 +1,22 @@ #!/bin/bash -# $Id$ # This file is part of libsydney. # +# Copyright 2007-2008 Lennart Poettering +# # libsydney 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. # # libsydney 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. +# Lesser General Public License for more details. # -# You should have received a copy of the GNU Lesser General Public License -# along with libsydney; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# You should have received a copy of the GNU Lesser General Public +# License along with libsydney. If not, see +# . VERSION=1.9 @@ -24,12 +25,12 @@ run_versioned() { local V V=$(echo "$2" | sed -e 's,\.,,g') - + if [ -e "`which $1$V 2> /dev/null`" ] ; then - P="$1$V" + P="$1$V" else if [ -e "`which $1-$2 2> /dev/null`" ] ; then - P="$1-$2" + P="$1-$2" else P="$1" fi @@ -44,21 +45,22 @@ 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 - "$LIBTOOLIZE" -c --force - run_versioned aclocal "$VERSION" - run_versioned autoconf 2.59 -Wall - run_versioned autoheader 2.59 + mkdir -p m4 + "$LIBTOOLIZE" -c --force --ltdl + run_versioned aclocal "$VERSION" -I m4 + run_versioned autoconf 2.62 -Wall + run_versioned autoheader 2.62 run_versioned automake "$VERSION" --copy --foreign --add-missing if test "x$NOCONFIGURE" = "x"; then - CFLAGS="-g -O0" ./configure --sysconfdir=/etc --localstatedir=/var "$@" + CFLAGS="-g -O0" ./configure --sysconfdir=/etc --localstatedir=/var "$@" make clean fi fi diff --git a/configure.ac b/configure.ac index 330e3fa..4d4ee07 100644 --- a/configure.ac +++ b/configure.ac @@ -1,30 +1,31 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. -# $Id$ - # This file is part of libsydney. # +# Copyright 2007-2008 Lennart Poettering +# # libsydney 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. # # libsydney 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. +# Lesser General Public License for more details. # -# You should have received a copy of the GNU Lesser General Public License -# along with libsydney; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# You should have received a copy of the GNU Lesser General Public +# License along with libsydney. If not, see +# . -AC_PREREQ(2.57) +AC_PREREQ(2.62) AC_INIT([libsydney], 0.1, [mzyvoflqarl (at) 0pointer (dot) de]) AC_CONFIG_SRCDIR([src/common.c]) AC_CONFIG_HEADERS([config.h]) -AM_INIT_AUTOMAKE([foreign -Wall]) +AC_CONFIG_MACRO_DIR(m4) +AM_INIT_AUTOMAKE([foreign 1.9 -Wall]) AC_SUBST(PACKAGE_URL, [https://tango.0pointer.de/mailman/listinfo/libsydney-discuss/]) @@ -42,6 +43,7 @@ fi # CC AC_PROG_CC +AC_PROG_CC_C99 AM_PROG_CC_C_O AC_PROG_GCC_TRADITIONAL AC_GNU_SOURCE @@ -50,50 +52,33 @@ AC_GNU_SOURCE AC_PROG_CXX -# GCC flags - -test_gcc_flag() { - AC_LANG_CONFTEST([int main(int argc, char*argv[]) {}]) - $CC -c conftest.c $CFLAGS -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 - - # 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 +DESIRED_FLAGS="-Wall -W -Wextra -pedantic -pipe -Wno-long-long -Wvla -Wno-overlength-strings -Wconversion -Wundef -Wformat -Wlogical-op -Wpacked -Wformat-security -Wmissing-include-dirs -Wformat-nonliteral -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 + CC_CHECK_CFLAGS([$flag], [CFLAGS="$CFLAGS $flag"]) +done #### libtool stuff #### +AC_LTDL_ENABLE_INSTALL +AC_LIBLTDL_INSTALLABLE +AC_LIBTOOL_DLOPEN AC_LIBTOOL_WIN32_DLL AC_PROG_LIBTOOL +AC_SUBST(LTDLINCL) +AC_SUBST(LIBLTDL) +AC_CONFIG_SUBDIRS(libltdl) #### Determine build environment #### os_is_win32=0 case "$host_os" in - mingw*) + mingw*) AC_DEFINE([OS_IS_WIN32], 1, [Build target is Windows.]) os_is_win32=1 - ;; - esac + ;; +esac AM_CONDITIONAL(OS_IS_WIN32, test "x$os_is_win32" = "x1") @@ -150,6 +135,9 @@ AC_CHECK_FUNCS([strerror_r]) # BSD AC_CHECK_FUNCS([lstat]) +# GNU +AC_CHECK_FUNCS([strndup]) + #### POSIX threads #### ACX_PTHREAD @@ -169,7 +157,6 @@ else AC_MSG_RESULT([no]) fi - #### Large File-Support (LFS) #### AC_SYS_LARGEFILE @@ -197,7 +184,7 @@ fi PKG_PROG_PKG_CONFIG -#### OSS support (optional) #### +### OSS support (optional) ### AC_ARG_ENABLE([oss], AC_HELP_STRING([--disable-oss], [Disable optional OSS support]), @@ -211,24 +198,22 @@ AC_ARG_ENABLE([oss], [oss=auto]) if test "x${oss}" != xno ; then - AC_CHECK_HEADERS([sys/soundcard.h], - [ - HAVE_OSS=1 - AC_DEFINE([HAVE_OSS], 1, [Have OSS?]) - ], - [ - HAVE_OSS=0 - if test "x$oss" = xyes ; then - AC_MSG_ERROR([*** OSS support not found]) - fi - ]) + AC_CHECK_HEADERS(soundcard.h sys/soundcard.h machine/soundcard.h) + if test "${ac_cv_header_sys_soundcard_h}" = "yes" || \ + test "${ac_cv_header_soundcard_h}" = "yes" || \ + test "${ac_cv_header_machine_soundcard_h}" = "yes"; then + HAVE_OSS=1 + AC_DEFINE([HAVE_OSS], 1, [Have OSS?]) + else + HAVE_OSS=0 + if test "x$oss" = xyes ; then + AC_MSG_ERROR([*** OSS not found ***]) + fi + fi else HAVE_OSS=0 fi -AC_SUBST(HAVE_OSS) -AM_CONDITIONAL([HAVE_OSS], [test "x$HAVE_OSS" = x1]) - #### ALSA support (optional) #### AC_ARG_ENABLE([alsa], @@ -263,43 +248,46 @@ AC_SUBST(ASOUNDLIB_LIBS) AC_SUBST(HAVE_ALSA) AM_CONDITIONAL([HAVE_ALSA], [test "x$HAVE_ALSA" = x1]) -#### Solaris audio support (optional) #### +### PulseAudio (optional) #### -AC_ARG_ENABLE([solaris], - AC_HELP_STRING([--disable-solaris], [Disable optional Solaris audio support]), +AC_ARG_ENABLE([pulse], + AC_HELP_STRING([--disable-pulse], [Disable optional PulseAudio support]), [ case "${enableval}" in - yes) solaris=yes ;; - no) solaris=no ;; - *) AC_MSG_ERROR(bad value ${enableval} for --disable-solaris) ;; + yes) pulse=yes ;; + no) pulse=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --disable-pulse) ;; esac ], - [solaris=auto]) - -if test "x${solaris}" != xno ; then - AC_CHECK_HEADERS([sys/audio.h], + [pulse=auto]) + +if test "x${pulse}" != xno ; then + + if test -d ../pulseaudio ; then + PULSE_CFLAGS='-I$(top_srcdir)/../pulseaudio/src' + PULSE_LIBS='-L$(top_srcdir)/../pulseaudio/src/.libs -lpulse' + HAVE_PULSE=1 + AC_DEFINE([HAVE_PULSE], 1, [Have PulseAudio?]) + echo "*** Found pulseaudio in ../pulseaudio, using that version ***" + else + PKG_CHECK_MODULES(PULSE, [ libpulse >= 0.9.11 ], [ - HAVE_SOLARIS=1 - AC_DEFINE([HAVE_SOLARIS], 1, [Have Solaris audio?]) + HAVE_PULSE=1 + AC_DEFINE([HAVE_PULSE], 1, [Have PulseAudio?]) ], [ - HAVE_SOLARIS=0 - if test "x$solaris" = xyes ; then - AC_MSG_ERROR([*** Solaris audio support not found]) + HAVE_PULSE=0 + if test "x$pulse" = xyes ; then + AC_MSG_ERROR([*** PulseAudio not found ***]) fi ]) + fi else - HAVE_SOLARIS=0 + HAVE_PULSE=0 fi -AC_SUBST(HAVE_SOLARIS) -AM_CONDITIONAL([HAVE_SOLARIS], [test "x$HAVE_SOLARIS" = x1]) - -### LIBOIL #### - -PKG_CHECK_MODULES(LIBOIL, [ liboil-0.3 >= 0.3.0 ]) -AC_SUBST(LIBOIL_CFLAGS) -AC_SUBST(LIBOIL_LIBS) +AC_SUBST(PULSE_CFLAGS) +AC_SUBST(PULSE_LIBS) ### JACK (optional) #### @@ -332,6 +320,16 @@ AC_SUBST(JACK_LIBS) AC_SUBST(HAVE_JACK) AM_CONDITIONAL([HAVE_JACK], [test "x$HAVE_JACK" = x1]) +### LIBOIL #### + +PKG_CHECK_MODULES(LIBOIL, [ liboil-0.3 >= 0.3.0 ]) +AC_SUBST(LIBOIL_CFLAGS) +AC_SUBST(LIBOIL_LIBS) + +PKG_CHECK_MODULES(LIBSPEEX, [ speexdsp >= 1.2 ]) +AC_SUBST(LIBSPEEX_CFLAGS) +AC_SUBST(LIBSPEEX_LIBS) + ################################### # Output # ################################### @@ -354,6 +352,11 @@ if test "x$HAVE_ALSA" = "x1" ; then ENABLE_ALSA=yes fi +ENABLE_PULSE=no +if test "x$HAVE_PULSE" = "x1" ; then + ENABLE_PULSE=yes +fi + ENABLE_SOLARIS=no if test "x$HAVE_SOLARIS" = "x1" ; then ENABLE_SOLARIS=yes @@ -376,6 +379,6 @@ echo " CXXFLAGS: ${CXXFLAGS} Enable OSS: ${ENABLE_OSS} Enable Alsa: ${ENABLE_ALSA} - Enable Solaris: ${ENABLE_SOLARIS} + Enable PulseAudio: ${ENABLE_PULSE} Enable Jack: ${ENABLE_JACK} " diff --git a/src/Makefile.am b/src/Makefile.am index a465b44..522b4f4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,20 +1,20 @@ -# $Id$ -# # This file is part of libsydney. # +# Copyright 2007-2008 Lennart Poettering +# # libsydney 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. # # libsydney 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. +# Lesser General Public License for more details. # -# You should have received a copy of the GNU Lesser General Public License -# along with libsydney; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# You should have received a copy of the GNU Lesser General Public +# License along with libsydney. If not, see +# . AM_CFLAGS = $(PTHREAD_CFLAGS) AM_CXXFLAGS = $(PTHREAD_CFLAGS) @@ -22,11 +22,14 @@ AM_LIBADD = $(PTHREAD_LIBS) AM_LDADD = $(PTHREAD_LIBS) EXTRA_DIST = \ - meta-name-table.gperf + map-file lib_LTLIBRARIES = \ libsydney.la +include_HEADERS = \ + sydney.h + noinst_PROGRAMS = \ test-bufferq \ test-llist \ @@ -35,6 +38,7 @@ noinst_PROGRAMS = \ # test-asyncq libsydney_la_SOURCES = \ + sydney.h \ common.c common.h \ malloc.c malloc.h \ oss.c oss.h \ @@ -45,23 +49,22 @@ libsydney_la_SOURCES = \ continued-fraction.c continued-fraction.h \ zero.c zero.h \ add.c add.h \ - speex/speex_resampler.c speex/speex_resampler.h speex/arch.h \ resample.c resample.h \ interleave.c interleave.h \ converter.c converter.h \ g711.c g711.h \ mutex-posix.c mutex.h \ thread-posix.c thread.h \ - bufferq.c buffer.h \ - meta-name-table.h + bufferq.c buffer.h # asyncq.c asyncq.h libsydney_la_LIBADD = \ $(AM_LIBADD) \ - $(LIBOIL_LIBS) + $(LIBOIL_LIBS) \ + $(SPEEX_LIBS) libsydney_la_CXXFLAGS = \ $(AM_CXXFLAGS) \ $(LIBOIL_CFLAGS) \ - -DRANDOM_PREFIX=saspeex -DOUTSIDE_SPEEX + $(SPEEX_CFLAGS) test_bufferq_SOURCES = \ test-bufferq.c @@ -93,12 +96,6 @@ test_pull_LDADD = \ # $(AM_LDADD) \ # libsydney.la -BUILT_SOURCES = \ - meta-name-table.h - -meta-name-table.h: meta-name-table.gperf Makefile - gperf -L ANSI-C -t -N sa_lookup_meta_name -H sa_hash_meta_name -p -C < $< | sed -e 's/{""}/{"", 0}/g' > $@ - fixme: find -name '*.c' -exec fgrep -H -A 3 -B 3 -i FIXME \{\} \; @@ -106,10 +103,5 @@ indent: indent -bdfa -brf -kr -nbbo -nbc -ip0 -ppi 4 -cs -nbfde -npsl -br -brs -bap -i4 -bs -cdw -ce -npcs -hnl -cli4 -nut -ci8 < oss.c # astyle --indent=spaces=4 --brackets=attach --indent-switches --max-instatement-indent=40 --pad=oper --unpad=paren --convert-tabs --mode=c < oss.c -update-speex: - wget -O speex/speex_resampler.h http://svn.xiph.org/trunk/speex/include/speex/speex_resampler.h - wget -O speex/speex_resample.c http://svn.xiph.org/trunk/speex/libspeex/resample.c - wget -O speex/arch.h http://svn.xiph.org/trunk/speex/libspeex/arch.h - warn-export: all nm test-bufferq test-llist test-sine test-pull | grep " T " | awk '{print $$3}' | sort | uniq -- cgit