summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2008-06-05 22:16:42 +0000
committerLennart Poettering <lennart@poettering.net>2008-06-05 22:16:42 +0000
commitf81be32374c617f6fcb1c8692f1290e7d14ae254 (patch)
tree9795246d4281520d63f1b6a2aebea02a42729038
parent4d2ba5dd19c08e2a7c9728302e24605d9ad9e0bb (diff)
rework build system do support different backends properly
git-svn-id: file:///home/lennart/svn/public/libcanberra/trunk@48 01b60673-d06a-42c0-afdd-89cb8e0f78ac
-rwxr-xr-xbootstrap.sh12
-rw-r--r--configure.ac184
-rw-r--r--src/Makefile.am92
3 files changed, 227 insertions, 61 deletions
diff --git a/bootstrap.sh b/bootstrap.sh
index 4eb0f67..187121b 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -27,12 +27,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
@@ -47,21 +47,21 @@ 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
+ "$LIBTOOLIZE" -c --force --ltdl
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 --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 e8f5a38..707179e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -83,19 +83,25 @@ fi
#### 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")
@@ -156,29 +162,10 @@ AC_CHECK_FUNCS([lstat])
ACX_PTHREAD
-AC_MSG_CHECKING([for PTHREAD_PRIO_INHERIT])
-AC_LANG_CONFTEST([AC_LANG_SOURCE([[
-#include <pthread.h>
-int main() { int i = PTHREAD_PRIO_INHERIT; }]])])
-$PTHREAD_CC conftest.c $PTHREAD_CFLAGS $CFLAGS $PTHREAD_LIBS -o conftest > /dev/null 2> /dev/null
-ret=$?
-rm -f conftest.o conftest
-
-if test $ret -eq 0 ; then
- AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], 1, [Have PTHREAD_PRIO_INHERIT.])
- AC_MSG_RESULT([yes])
-else
- AC_MSG_RESULT([no])
-fi
-
-
#### Large File-Support (LFS) ####
AC_SYS_LARGEFILE
-# Check for open64 to know if the current system does have open64() and similar functions
-AC_CHECK_FUNCS([open64])
-
#### [lib]iconv ####
AM_ICONV
@@ -213,7 +200,7 @@ AC_ARG_ENABLE([alsa],
[alsa=auto])
if test "x${alsa}" != xno ; then
- PKG_CHECK_MODULES(ASOUNDLIB, [ alsa >= 1.0.0 ],
+ PKG_CHECK_MODULES(ALSA, [ alsa >= 1.0.0 ],
[
HAVE_ALSA=1
AC_DEFINE([HAVE_ALSA], 1, [Have ALSA?])
@@ -221,17 +208,15 @@ if test "x${alsa}" != xno ; then
[
HAVE_ALSA=0
if test "x$alsa" = xyes ; then
- AC_MSG_ERROR([*** ALSA support not found])
+ AC_MSG_ERROR([*** ALSA not found ***])
fi
])
else
HAVE_ALSA=0
fi
-AC_SUBST(ASOUNDLIB_CFLAGS)
-AC_SUBST(ASOUNDLIB_LIBS)
-AC_SUBST(HAVE_ALSA)
-AM_CONDITIONAL([HAVE_ALSA], [test "x$HAVE_ALSA" = x1])
+AC_SUBST(ALSA_CFLAGS)
+AC_SUBST(ALSA_LIBS)
### PulseAudio (optional) ####
@@ -251,14 +236,18 @@ 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 -lpulse-mainloop-glib'
+ HAVE_PULSE=1
echo "*** Found pulseaudio in ../pulseaudio, using that version ***"
else
PKG_CHECK_MODULES(PULSE, [ libpulse >= 0.9.11 libpulse-mainloop-glib >= 0.9.11 ],
- HAVE_PULSE=1,
+ [
+ HAVE_PULSE=1,
+ AC_DEFINE([HAVE_ALSA], 1, [Have ALSA?])
+ ],
[
HAVE_PULSE=0
if test "x$pulse" = xyes ; then
- AC_MSG_ERROR([*** PULSE support not found])
+ AC_MSG_ERROR([*** PulseAudio not found ***])
fi
])
fi
@@ -266,17 +255,107 @@ else
HAVE_PULSE=0
fi
-AC_SUBST(PULSE_LIBS)
AC_SUBST(PULSE_CFLAGS)
-AC_SUBST(HAVE_PULSE)
-AM_CONDITIONAL([HAVE_PULSE], [test "x$HAVE_PULSE" = x1])
+AC_SUBST(PULSE_LIBS)
-PKG_CHECK_MODULES(VORBIS, [ vorbisfile ])
-PKG_CHECK_MODULES(GTK, [ gtk+-2.0 ])
+### GTK (optional) ####
+
+AC_ARG_ENABLE([gtk],
+ AC_HELP_STRING([--disable-gtk], [Disable optional GTK+ support]),
+ [
+ case "${enableval}" in
+ yes) gtk=yes ;;
+ no) gtk=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --disable-gtk) ;;
+ esac
+ ],
+ [gtk=auto])
+
+if test "x${gtk}" != xno ; then
+ PKG_CHECK_MODULES(GTK, [ gtk+-2.0 ],
+ [
+ HAVE_GTK=1
+ AC_DEFINE([HAVE_GTK], 1, [Have GTK?])
+
+ GTK_VERSION=`$PKG_CONFIG --variable=gtk_binary_version gtk+-2.0`
+ GTK_MODULES_DIR="${libdir}/gtk-2.0/modules"
+ ],
+ [
+ HAVE_GTK=0
+ if test "x$gtk" = xyes ; then
+ AC_MSG_ERROR([*** GTK not found ***])
+ fi
+ ])
+else
+ HAVE_GTK=0
+fi
-GTK_VERSION=`$PKG_CONFIG --variable=gtk_binary_version gtk+-2.0`
-GTK_MODULES_DIR="${libdir}/gtk-2.0/modules"
+AC_SUBST(GTK_CFLAGS)
+AC_SUBST(GTK_LIBS)
AC_SUBST(GTK_MODULES_DIR)
+AC_SUBST(HAVE_GTK)
+AM_CONDITIONAL([HAVE_GTK], [test "x$HAVE_GTK" = x1])
+
+### Vorbis (mandatory) ###
+
+PKG_CHECK_MODULES(VORBIS, [ vorbisfile ])
+
+### Chose builtin driver ###
+
+ AC_ARG_WITH([builtin],
+ [AS_HELP_STRING([--with-builtin], [Choose builtin driver])],
+ [],
+ [with_builtin=dso])
+
+HAVE_DSO=0
+BUILTIN_DSO=0
+BUILTIN_PULSE=0
+BUILTIN_ALSA=0
+
+case "x$with_builtin" in
+ xpulse)
+ if test "x$HAVE_PULSE" != x1 ; then
+ AC_MSG_ERROR([*** PulseAudio selected for builtin driver, but not enabled. ***])
+ fi
+
+ BUILTIN_PULSE=1
+ HAVE_ALSA=0
+ ;;
+
+ xalsa)
+ if test "x$HAVE_ALSA" != x1 ; then
+ AC_MSG_ERROR([*** ALSA selected for builtin driver, but not enabled. ***])
+ fi
+
+ BUILTIN_ALSA=1
+ HAVE_PULSE=0
+ ;;
+
+ xdso)
+ BUILTIN_DSO=1
+ HAVE_DSO=1
+ AC_DEFINE([HAVE_DSO], 1, [Have DSO?])
+ ;;
+
+ *)
+ AC_MSG_ERROR([*** Unknown driver $with_builtin selected for builtin ***])
+esac
+
+if test "x$HAVE_PULSE" != x1 -a "x$HAVE_ALSA" != x1 ; then
+ AC_MSG_ERROR([*** No backend enabled. ***])
+fi
+
+AC_SUBST(HAVE_DSO)
+AC_SUBST(HAVE_PULSE)
+AC_SUBST(HAVE_ALSA)
+AC_SUBST(BUILTIN_DSO)
+AC_SUBST(BUILTIN_ALSA)
+AC_SUBST(BUILTIN_PULSE)
+AM_CONDITIONAL([HAVE_PULSE], [test "x$HAVE_PULSE" = x1])
+AM_CONDITIONAL([HAVE_ALSA], [test "x$HAVE_ALSA" = x1])
+AM_CONDITIONAL([BUILTIN_DSO], [test "x$BUILTIN_DSO" = x1])
+AM_CONDITIONAL([BUILTIN_PULSE], [test "x$BUILTIN_PULSE" = x1])
+AM_CONDITIONAL([BUILTIN_ALSA], [test "x$BUILTIN_ALSA" = x1])
###################################
# Output #
@@ -286,19 +365,38 @@ AC_CONFIG_FILES([
Makefile
src/Makefile
libcanberra.pc
+libcanberra-gtk.pc
])
AC_OUTPUT
# ==========================================================================
-ENABLE_ALSA=no
-if test "x$HAVE_ALSA" = "x1" ; then
- ENABLE_ALSA=yes
+ENABLE_BUILTIN_DSO=no
+if test "x$BUILTIN_DSO" = "x1" ; then
+ ENABLE_BUILTIN_DSO=yes
fi
ENABLE_PULSE=no
if test "x$HAVE_PULSE" = "x1" ; then
ENABLE_PULSE=yes
fi
+ENABLE_BUILTIN_PULSE=no
+if test "x$BUILTIN_PULSE" = "x1" ; then
+ ENABLE_BUILTIN_PULSE=yes
+fi
+
+ENABLE_ALSA=no
+if test "x$HAVE_ALSA" = "x1" ; then
+ ENABLE_ALSA=yes
+fi
+ENABLE_BUILTIN_ALSA=no
+if test "x$BUILTIN_ALSA" = "x1" ; then
+ ENABLE_BUILTIN_ALSA=yes
+fi
+
+ENABLE_GTK=no
+if test "x$HAVE_GTK" = "x1" ; then
+ ENABLE_GTK=yes
+fi
echo "
---{ $PACKAGE_NAME $VERSION }---
@@ -310,7 +408,11 @@ echo "
CFLAGS: ${CFLAGS}
C++-Compiler: ${CXX}
CXXFLAGS: ${CXXFLAGS}
- Enable ALSA: ${ENABLE_ALSA}
+ Builtin DSO: ${ENABLE_BUILTIN_DSO}
Enable PulseAudio: ${ENABLE_PULSE}
+ Builtin PulseAudio: ${ENABLE_BUILTIN_PULSE}
+ Enable ALSA: ${ENABLE_ALSA}
+ Builtin ALSA: ${ENABLE_BUILTIN_ALSA}
+ Enable GTK+: ${ENABLE_GTK}
GTK Modules Directory: ${GTK_MODULES_DIR}
"
diff --git a/src/Makefile.am b/src/Makefile.am
index f8c1366..393f0b8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -25,11 +25,7 @@ AM_CXXFLAGS = $(PTHREAD_CFLAGS)
AM_LDADD = $(PTHREAD_LIBS)
lib_LTLIBRARIES = \
- libcanberra.la \
- libcanberra-gtk.la
-
-module_LTLIBRARIES = \
- libcanberra-gtk-module.la
+ libcanberra.la
noinst_PROGRAMS = \
test-canberra
@@ -40,7 +36,6 @@ libcanberra_la_SOURCES = \
mutex-posix.c mutex.h \
proplist.c proplist.h \
driver.h \
- pulse.c \
read-sound-file.c read-sound-file.h \
read-vorbis.c read-vorbis.h \
read-wav.c read-wav.h \
@@ -48,33 +43,102 @@ libcanberra_la_SOURCES = \
llist.h \
macro.h \
malloc.c malloc.h
-libcanberra_la_LIBADD = \
- $(PULSE_LIBS) \
- $(VORBIS_LIBS)
libcanberra_la_CFLAGS = \
$(AM_CFLAGS) \
- $(PULSE_CFLAGS) \
$(VORBIS_CFLAGS)
+libcanberra_la_LIBADD = \
+ $(VORBIS_LIBS)
+
+if HAVE_PULSE
+if BUILTIN_PULSE
+
+libcanberra_la_SOURCES += \
+ pulse.c
+libcanberra_la_CFLAGS += \
+ $(PULSE_CFLAGS)
+libcanberra_la_LIBADD += \
+ $(PULSE_LIBS)
+
+else
+
+lib_LTLIBRARIES += \
+ libcanberra-pulse.la
+
+libcanberra_pulse_la_SOURCES = \
+ pulse.c
+libcanberra_pulse_la_CFLAGS = \
+ $(PULSE_CFLAGS)
+libcanberra_pulse_la_LIBADD = \
+ $(PULSE_LIBS)
+
+endif
+endif
+
+if HAVE_ALSA
+if BUILTIN_ALSA
+
+libcanberra_la_SOURCES += \
+ alsa.c
+libcanberra_la_CFLAGS += \
+ $(ALSA_CFLAGS)
+libcanberra_la_LIBADD += \
+ $(ALSA_LIBS)
+
+else
+
+lib_LTLIBRARIES += \
+ libcanberra-alsa.la
+
+libcanberra_alsa_la_SOURCE = \
+ alsa.c
+libcanberra_alsa_la_CFLAGS = \
+ $(ALSA_CFLAGS)
+libcanberra_alsa_la_LIBADD = \
+ $(ALSA_LIBS)
+
+endif
+endif
+
+if BUILTIN_DSO
+
+libcanberra_la_SOURCES += \
+ dso.c
+libcanberra_la_CFLAGS += \
+ $(LTDLINCL)
+libcanberra_la_LIBADD += \
+ $(LIBLTDL)
+
+endif
+
+if HAVE_GTK
+
+lib_LTLIBRARIES += \
+ libcanberra-gtk.la
+
+module_LTLIBRARIES = \
+ libcanberra-gtk-module.la
libcanberra_gtk_la_SOURCES = \
canberra-gtk.h \
canberra-gtk.c
+libcanberra_gtk_la_CFLAGS = \
+ $(GTK_CFLAGS)
libcanberra_gtk_la_LIBADD = \
$(GTK_LIBS) \
libcanberra.la
-libcanberra_gtk_la_CFLAGS = \
- $(GTK_CFLAGS)
libcanberra_gtk_module_la_SOURCES = \
canberra-gtk-module.c
+libcanberra_gtk_module_la_CFLAGS = \
+ $(GTK_CFLAGS)
libcanberra_gtk_module_la_LIBADD = \
$(GTK_LIBS) \
libcanberra.la \
libcanberra-gtk.la
libcanberra_gtk_module_la_LDFLAGS = \
-avoid-version -module -export-dynamic
-libcanberra_gtk_module_la_CFLAGS = \
- $(GTK_CFLAGS)
+
+endif
test_canberra_SOURCES = \
test-canberra.c