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 --- configure.ac | 169 ++++++++++++++++++++++++++++++----------------------------- 1 file changed, 86 insertions(+), 83 deletions(-) (limited to 'configure.ac') 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} " -- cgit