]> code.delx.au - pulseaudio/blobdiff - configure.ac
Reorganised the source tree. We now have src/ with a couple of subdirs:
[pulseaudio] / configure.ac
index e5e03d0419153a24287046a5c67d2c6827951b15..182a2455cc97b2824f7c4c9cf3791abc500bfa78 100644 (file)
@@ -21,7 +21,7 @@
 
 AC_PREREQ(2.57)
 AC_INIT([polypaudio],[0.8],[mzcbylcnhqvb (at) 0pointer (dot) de])
-AC_CONFIG_SRCDIR([polyp/main.c])
+AC_CONFIG_SRCDIR([src/daemon/main.c])
 AC_CONFIG_HEADERS([config.h])
 AM_INIT_AUTOMAKE([foreign -Wall])
 
@@ -41,15 +41,7 @@ fi
 
 AC_PROG_CC
 AC_PROG_GCC_TRADITIONAL
-
-# If using GCC specify some additional parameters
-if test "x$GCC" = "xyes" ; then
-   CFLAGS="$CFLAGS -pipe -W -Wall -pedantic"
-
-   AC_LANG_CONFTEST([int main() {}])
-   $CC -c conftest.c -std=gnu9x -Wno-unused-parameter $CFLAGS > /dev/null 2> /dev/null && CFLAGS="$CFLAGS -std=gnu9x -Wno-unused-parameter"
-   rm -f conftest.o
-fi
+AC_GNU_SOURCE
 
 # M4
 
@@ -58,6 +50,34 @@ if test "x$M4" = xno ; then
    AC_MSG_ERROR([m4 missing])
 fi
 
+# 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 -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Winline -Wno-unused-parameter"
+
+    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
+
 # LYNX documentation generation
 AC_ARG_ENABLE(lynx,
         AC_HELP_STRING(--disable-lynx,Turn off lynx usage for documentation generation),
@@ -165,13 +185,13 @@ AC_CHECK_DEFINE([INADDR_NONE], [netinet/in.h], [],
 #### Check for libs ####
 
 # ISO
-AC_CHECK_LIB([m], [pow])
+AC_SEARCH_LIBS([pow], [m])
 
 # POSIX
-AC_CHECK_LIB([rt], [sched_setscheduler])
+AC_SEARCH_LIBS([sched_setscheduler], [rt])
 
 # BSD
-AC_CHECK_LIB([socket], [connect])
+AC_SEARCH_LIBS([connect], [socket])
 
 # Non-standard
 
@@ -238,10 +258,21 @@ AC_ARG_WITH(
         AC_HELP_STRING([--without-caps],[Omit support for POSIX capabilities.]))
 
 if test "x${with_caps}" != "xno"; then
-    AC_CHECK_LIB(cap, cap_init, [CAP_LIBS='-lcap'], [CAP_LIBS=''])
+    AC_SEARCH_LIBS([cap_init], [cap])
     AC_CHECK_HEADERS([sys/capability.h])
 fi
-AC_SUBST(CAP_LIBS)
+
+#### pkg-config ####
+
+# Check for pkg-config manually first, as if its not installed the
+# PKG_PROG_PKG_CONFIG macro won't be defined.
+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
 
 #### Sample rate conversion ####
 
@@ -257,13 +288,20 @@ AC_SUBST(LIBSNDFILE_LIBS)
 
 #### OSS support (optional) ####
 
-AC_CHECK_HEADERS([sys/soundcard.h], [HAVE_OSS=1], [HAVE_OSS=0])
+AC_CHECK_HEADERS([sys/soundcard.h], [
+HAVE_OSS=1
+AC_DEFINE([HAVE_OSS], 1, [Have OSS?])
+], [HAVE_OSS=0])
 AC_SUBST(HAVE_OSS)
 AM_CONDITIONAL([HAVE_OSS], [test "x$HAVE_OSS" = x1])
 
+
 #### ALSA support (optional) ####
 
-PKG_CHECK_MODULES(ASOUNDLIB, [ alsa >= 1.0.0 ], [HAVE_ALSA=1], [HAVE_ALSA=0])
+PKG_CHECK_MODULES(ASOUNDLIB, [ alsa >= 1.0.0 ], [
+HAVE_ALSA=1
+AC_DEFINE([HAVE_ALSA], 1, [Have ALSA?])
+], [HAVE_ALSA=0])
 AC_SUBST(ASOUNDLIB_CFLAGS)
 AC_SUBST(ASOUNDLIB_LIBS) 
 AC_SUBST(HAVE_ALSA)
@@ -299,6 +337,11 @@ AC_SUBST(HOWL_LIBS)
 AC_SUBST(HAVE_HOWL)
 AM_CONDITIONAL([HAVE_HOWL], [test "x$HAVE_HOWL" = x1])
 
+
+PKG_CHECK_MODULES(LIBOIL, [ liboil-0.3 >= 0.3.0 ])
+AC_SUBST(LIBOIL_CFLAGS)
+AC_SUBST(LIBOIL_LIBS)
+
 #### Async DNS support (optional) ####
 
 PKG_CHECK_MODULES(LIBASYNCNS, [ libasyncns >= 0.1 ], HAVE_LIBASYNCNS=1, HAVE_LIBASYNCNS=0)
@@ -349,7 +392,7 @@ fi
 
 AC_CONFIG_FILES([
 Makefile
-polyp/Makefile
+src/Makefile
 polyplib.pc
 polyplib-simple.pc
 polyplib-mainloop.pc
@@ -364,7 +407,7 @@ doc/daemon.html
 doc/modules.html
 doxygen/Makefile
 doxygen/doxygen.conf
-polyp/polyplib-version.h
+src/polyp/polyplib-version.h
 doc/FAQ.html
 ])
 AC_OUTPUT