]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - configure.ac
Merge ../paraslash.fml/paraslash
[paraslash.git] / configure.ac
index 85f4c829b57fd3bd810bf1cbfc2d376d04b44924..efd27d4e518be5782045408b9d4be4cb42b05ce3 100644 (file)
@@ -147,7 +147,6 @@ client_ldflags="$client_ldflags $SSL_LDFLAGS $SSL_LIBS"
 audiod_ldflags="$audiod_ldflags $SSL_LDFLAGS $SSL_LIBS"
 
 ########################################################################### ucred
-
 AC_MSG_CHECKING(for struct ucred)
 AC_TRY_LINK([
        #include <sys/types.h>
@@ -186,7 +185,6 @@ if test ${have_core_audio} = yes; then
        AC_DEFINE(HAVE_CORE_AUDIO, 1, define to 1 on Mac Os X)
 fi
 ########################################################################### gtk2
-
 pkg_modules="gtk+-2.0 >= 2.0.0"
 build_para_krell="yes"
 PKG_CHECK_MODULES(GTK, [$pkg_modules], [], [build_para_krell="no"])
@@ -198,7 +196,6 @@ if test build_para_krell = "yes"; then
 else
        AC_MSG_WARN([can not build para_krell])
 fi
-
 ########################################################################### sdl
 # FIXME
 AC_CHECK_LIB([SDL_image], [SDL_Init], [extras="$extras para_sdl_gui"], [
@@ -209,6 +206,9 @@ AC_CHECK_HEADER(SDL/SDL.h, [],
 
 ########################################################################### mysql
 have_mysql="yes"
+OLD_CPPFLAGS="$CPPFLAGS"
+OLD_LD_FLAGS="$LDFLAGS"
+OLD_LIBS="$LIBS"
 AC_ARG_WITH(mysql_headers, [AC_HELP_STRING(--with-mysql-headers=dir,
        [look for mysql.h also in dir])])
 if test -n "$with_mysql_headers"; then
@@ -237,23 +237,36 @@ if test "$have_mysql" = "yes"; then
 else
        AC_MSG_WARN([cannot build mysql-based audio file selector])
 fi
+CPPFLAGS="$OLD_CPPFLAGS"
+LDFLAGS="$OLD_LDFLAGS"
+LIBS="$OLD_LIBS"
 ########################################################################### ogg
 have_ogg="yes"
-AC_CHECK_LIB([ogg], [ogg_stream_init], [], [
-       have_ogg="no"
-])
-AC_CHECK_LIB([vorbis], [vorbis_info_init], [], [
-       have_ogg="no"
-])
-AC_CHECK_HEADERS([ogg/ogg.h vorbis/codec.h], [], [
-       have_ogg="no"
-])
+OLD_CPPFLAGS="$CPPFLAGS"
+OLD_LD_FLAGS="$LDFLAGS"
+OLD_LIBS="$LIBS"
+AC_ARG_WITH(oggvorbis_headers, [AC_HELP_STRING(--with-oggvorbis-headers=dir,
+       [look for vorbis/codec.h also in dir])])
+if test -n "$with_oggvorbis_headers"; then
+       oggvorbis_cppflags="-I$with_oggvorbis_headers"
+       CPPFLAGS="$CPPFLAGS $oggvorbis_cppflags"
+fi
+AC_ARG_WITH(oggvorbis_libs, [AC_HELP_STRING(--with-oggvorbis-libs=dir,
+       [look for oggvorbis libs also in dir])])
+if test -n "$with_oggvorbis_libs"; then
+       oggvorbis_libs="-L$with_oggvorbis_libs"
+       LDFLAGS="$LDFLAGS $oggvorbis_libs"
+fi
+
+AC_CHECK_LIB([ogg], [ogg_stream_init], [], [ have_ogg="no" ])
+AC_CHECK_LIB([vorbis], [vorbis_info_init], [], [ have_ogg="no" ])
+AC_CHECK_HEADERS([ogg/ogg.h vorbis/codec.h], [], [ have_ogg="no" ])
 if test "$have_ogg" = "yes"; then
        AC_DEFINE(HAVE_OGGVORBIS, 1, define to 1 to turn on ogg vorbis support)
        filters="$filters oggdec"
-       server_ldflags="$server_ldflags -logg -lvorbis -lvorbisfile"
-       filter_ldflags="$filter_ldflags -lvorbis -lvorbisfile"
-       audiod_ldflags="$audiod_ldflags -lvorbis -lvorbisfile"
+       server_ldflags="$server_ldflags $oggvorbis_libs -logg -lvorbis -lvorbisfile"
+       filter_ldflags="$filter_ldflags $oggvorbis_libs -lvorbis -lvorbisfile"
+       audiod_ldflags="$audiod_ldflags $oggvorbis_libs -lvorbis -lvorbisfile"
 
        filter_cmdline_objs="$filter_cmdline_objs oggdec_filter.cmdline"
        audiod_cmdline_objs="$audiod_cmdline_objs oggdec_filter.cmdline"
@@ -265,11 +278,19 @@ if test "$have_ogg" = "yes"; then
        audiod_audio_formats="ogg"
        server_audio_formats="$server_audio_formats ogg"
        filter_filters="$filter_filters oggdec"
+       AC_SUBST(oggvorbis_cppflags)
+       AC_SUBST(oggvorbis_libs)
 else
        AC_MSG_WARN([no ogg vorbis support in para_server/para_filter])
 fi
+CPPFLAGS="$OLD_CPPFLAGS"
+LDFLAGS="$OLD_LDFLAGS"
+LIBS="$OLD_LIBS"
 ########################################################################### faad
 have_faad=yes
+OLD_CPPFLAGS="$CPPFLAGS"
+OLD_LD_FLAGS="$LDFLAGS"
+OLD_LIBS="$LIBS"
 AC_ARG_WITH(faad_headers, [AC_HELP_STRING(--with-faad-headers=dir,
        [look for neaacdec.h also in dir])])
 if test -n "$with_faad_headers"; then
@@ -301,8 +322,15 @@ if test "$have_faad" = "yes"; then
 else
        AC_MSG_WARN([no aac support in para_audiod/para_filter])
 fi
+CPPFLAGS="$OLD_CPPFLAGS"
+LDFLAGS="$OLD_LDFLAGS"
+LIBS="$OLD_LIBS"
 ########################################################################### mad
 have_mad="yes"
+OLD_CPPFLAGS="$CPPFLAGS"
+OLD_LD_FLAGS="$LDFLAGS"
+OLD_LIBS="$LIBS"
+
 AC_ARG_WITH(mad_headers, [AC_HELP_STRING(--with-mad-headers=dir,
        [look for mad.h also in dir])])
 if test -n "$with_mad_headers"; then
@@ -339,8 +367,14 @@ if test -n "$audiod_audio_formats"; then
 else
        AC_MSG_WARN([can not build para_audiod (no supported audio formats)])
 fi
+CPPFLAGS="$OLD_CPPFLAGS"
+LDFLAGS="$OLD_LDFLAGS"
+LIBS="$OLD_LIBS"
 ########################################################################### alsa
 have_alsa="yes"
+OLD_CPPFLAGS="$CPPFLAGS"
+OLD_LD_FLAGS="$LDFLAGS"
+OLD_LIBS="$LIBS"
 msg="=> no alsa support for para_audiod/para_write"
 AC_CHECK_HEADERS([alsa/asoundlib.h], [], [
        AC_MSG_WARN([no alsa/asoundlib $msg])
@@ -360,21 +394,28 @@ if test "$have_alsa" = "yes"; then
        write_ldflags="$write_ldflags -lasound"
        writers="$writers alsa"
 fi
+CPPFLAGS="$OLD_CPPFLAGS"
+LDFLAGS="$OLD_LDFLAGS"
+LIBS="$OLD_LIBS"
 ########################################################################### ortp
 have_ortp="yes"
-AC_ARG_ENABLE(ortp, AC_HELP_STRING([--disable-ortp], [Disable ortp support]),
-       if test x$enableval = xno; then
-               have_ortp=no
-       fi
-)
-if test "$have_ortp" = "yes"; then
-       AC_CHECK_HEADERS([ortp/ortp.h], [], [
-               have_ortp="no"
-       ])
-       AC_CHECK_LIB([ortp], [ortp_init], [], [
-               have_ortp="no"
-       ])
+OLD_CPPFLAGS="$CPPFLAGS"
+OLD_LD_FLAGS="$LDFLAGS"
+OLD_LIBS="$LIBS"
+AC_ARG_WITH(ortp_headers, [AC_HELP_STRING(--with-ortp-headers=dir,
+       [look for ortp/ortp.h also in dir])])
+if test -n "$with_ortp_headers"; then
+       ortp_cppflags="-I$with_ortp_headers"
+       CPPFLAGS="$CPPFLAGS $ortp_cppflags"
+fi
+AC_ARG_WITH(ortp_libs, [AC_HELP_STRING(--with-ortp-libs=dir,
+       [look for libortp also in dir])])
+if test -n "$with_ortp_libs"; then
+       ortp_libs="-L$with_ortp_libs"
+       LDFLAGS="$LDFLAGS $ortp_libs"
 fi
+AC_CHECK_HEADERS([ortp/ortp.h], [], [have_ortp="no"])
+AC_CHECK_LIB([ortp], [ortp_init], [], [have_ortp="no"])
 if test "$have_ortp" = "yes"; then
        recv_cmdline_objs="$recv_cmdline_objs ortp_recv.cmdline"
        recv_errlist_objs="$recv_errlist_objs ortp_recv"
@@ -384,34 +425,39 @@ if test "$have_ortp" = "yes"; then
 
        server_errlist_objs="$server_errlist_objs ortp_send"
 
-       recv_ldflags="$recv_ldflags -lortp"
-       server_ldflags="$server_ldflags -lortp"
-       audiod_ldflags="$audiod_ldflags -lortp"
+       recv_ldflags="$recv_ldflags $ortp_libs -lortp"
+       server_ldflags="$server_ldflags $ortp_libs -lortp"
+       audiod_ldflags="$audiod_ldflags $ortp_libs -lortp"
 
        receivers="$receivers ortp"
        senders="$senders ortp"
        AC_DEFINE(HAVE_ORTP, 1, [define to 1 to turn on ortp support])
-
+       AC_SUBST(ortp_cppflags)
+       AC_SUBST(ortp_libs)
 else
-       AC_MSG_NOTICE([deactivating ortp support])
+       AC_MSG_NOTICE([deactivating ortp sender/receiver])
 fi
-AC_SUBST(GLIB_CFLAGS)
-AC_SUBST(GLIB_LIBS)
-
+CPPFLAGS="$OLD_CPPFLAGS"
+LDFLAGS="$OLD_LDFLAGS"
+LIBS="$OLD_LIBS"
 ########################################################################### zmw
-slide="para_slider"
-msg="can not build para_slider"
-CPPFLAGS="$GTK_CFLAGS"
+build_slider="yes"
+OLD_CPPFLAGS="$CPPFLAGS"
+OLD_LD_FLAGS="$LDFLAGS"
+OLD_LIBS="$LIBS"
+PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.0.4], [], [build_slider="no"])
+CPPFLAGS="$GTK_CFLAGS $GLIB_CFLAGS"
 LDFLAGS="$LDFLAGS $GTK_LIBS"
-AC_CHECK_HEADERS([zmw/zmw.h], [], [
-       AC_MSG_WARN([zero memory widget header files not found, $msg])
-       slide=""
-])
-AC_CHECK_LIB([zmw], [zmw_init], [], [
-       AC_MSG_WARN([zero memory widget library not found, $msg])
-       slide=""
-])
-extras="$extras $slide"
+AC_CHECK_HEADERS([zmw/zmw.h], [], [build_slider="no"])
+AC_CHECK_LIB([zmw], [zmw_init], [], [build_slider="no"])
+if test "$build_slider" = "no"; then
+       AC_MSG_WARN([will not build para_slider])
+else
+       extras="$extras para_slider"
+fi
+CPPFLAGS="$OLD_CPPFLAGS"
+LDFLAGS="$OLD_LDFLAGS"
+LIBS="$OLD_LIBS"
 
 
 
@@ -479,6 +525,11 @@ inits="$(for i in $writers; do printf 'extern void '$i'_write_init(struct writer
 AC_DEFINE_UNQUOTED(DECLARE_WRITER_INITS, $inits, init functions of the supported writers)
 array="$(for i in $writers; do printf '{.init = '$i'_write_init},'; done)"
 AC_DEFINE_UNQUOTED(WRITER_ARRAY, $array, array of supported writers)
+enum="$(for i in $audiod_audio_formats; do printf "AUDIO_FORMAT_${i}, " | tr '[a-z]' '[A-Z]'; done)"
+AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMATS_ENUM, $enum NUM_AUDIO_FORMATS,
+       enum of audio formats supported by audiod)
+names="$(for i in $audiod_audio_formats; do printf \"$i\",' ' ; done)"
+AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMAT_ARRAY, $names, array of audio formats supported by audiod)
 
 gui_cmdline_objs="gui.cmdline"
 gui_errlist_objs="exec close_on_fork signal string stat ringbuffer fd"
@@ -490,7 +541,7 @@ AC_SUBST(gui_objs, add_dot_o($gui_objs))
 
 AC_OUTPUT
 AC_MSG_NOTICE([creating Makefile.deps])
-gcc -MM -MG $mysql_cppflags $faad_cppflags $mad_cppflags *.c > Makefile.deps
+gcc -MM -MG $mysql_cppflags $faad_cppflags $mad_cppflags $ortp_cppflags $oggvorbis_cppflags *.c > Makefile.deps
 AC_MSG_NOTICE([
 paraslash configuration:
 ~~~~~~~~~~~~~~~~~~~~~~~~
@@ -501,4 +552,5 @@ senders supported by para_server/para_send: $senders
 receivers supported by para_audiod/para_recv: $receivers
 filters supported by para_audiod/para_filter: $filters
 writers supported by para_audiod/para_write: $writers
+optional executables: $extras
 ])