]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - configure.ac
build: Convert libid3tag detection to new macros.
[paraslash.git] / configure.ac
index 7224e4e6cc415f5555105b5795e74da3a546d05b..66b4787e4e945e9d7ebfb3a6566f0f77254affce 100644 (file)
@@ -326,75 +326,21 @@ AC_CHECK_LIB([faad], [NeAACDecOpen], [], HAVE_FAAD=no)
 LIB_SUBST_FLAGS(faad)
 UNSTASH_FLAGS
 ########################################################################### mad
-have_mad="yes"
-OLD_CPPFLAGS="$CPPFLAGS"
-OLD_LDFLAGS="$LDFLAGS"
-OLD_LIBS="$LIBS"
-
-AC_ARG_WITH(mad_headers, [AS_HELP_STRING(--with-mad-headers=dir,
-       [look for mad.h also in dir])])
-if test -n "$with_mad_headers"; then
-       mad_cppflags="-I$with_mad_headers"
-       CPPFLAGS="$CPPFLAGS $mad_cppflags"
-fi
-AC_ARG_WITH(mad_libs, [AS_HELP_STRING(--with-mad-libs=dir,
-       [look for libmad also in dir])])
-if test -n "$with_mad_libs"; then
-       mad_libs="-L$with_mad_libs"
-       LDFLAGS="$LDFLAGS $mad_libs"
-fi
-AC_CHECK_HEADERS([mad.h], [], [
-       have_mad="no"
-])
-AC_CHECK_LIB([mad], [mad_stream_init], [], [
-       have_mad="no"
-])
-if test "$have_mad" = "yes"; then
-       AC_DEFINE(HAVE_MAD, 1, define to 1 if you want to build the mp3dec filter)
-       AC_SUBST(mad_cppflags)
-       mad_ldflags="$mad_libs -lmad"
-       AC_SUBST(mad_ldflags)
-else
-       AC_MSG_WARN([no mp3dec support in para_audiod/para_filter])
-fi
-CPPFLAGS="$OLD_CPPFLAGS"
-LDFLAGS="$OLD_LDFLAGS"
-LIBS="$OLD_LIBS"
+STASH_FLAGS
+LIB_ARG_WITH([mad], [-lmad])
+HAVE_MAD=yes
+AC_CHECK_HEADER(mad.h, [], HAVE_MAD=no)
+AC_CHECK_LIB([mad], [mad_stream_init], [], HAVE_MAD=no)
+LIB_SUBST_FLAGS(mad)
+UNSTASH_FLAGS
 ###################################################################### libid3tag
-OLD_CPPFLAGS="$CPPFLAGS"
-OLD_LDFLAGS="$LDFLAGS"
-OLD_LIBS="$LIBS"
-
-have_libid3tag="yes"
-AC_ARG_WITH(id3tag_headers, [AS_HELP_STRING(--with-id3tag-headers=dir,
-       [look for id3tag header files also in dir])])
-if test -n "$with_id3tag_headers"; then
-       id3tag_cppflags="-I$with_id3tag_headers"
-       CPPFLAGS="$CPPFLAGS $id3tag_cppflags"
-fi
-AC_ARG_WITH(id3tag_libs, [AS_HELP_STRING(--with-id3tag-libs=dir,
-       [look for id3tag libs also in dir])])
-if test -n "$with_id3tag_libs"; then
-       id3tag_libs="-L$with_id3tag_libs"
-       LDFLAGS="$LDFLAGS $id3tag_libs"
-fi
-
-AC_MSG_CHECKING(for libid3tag)
-AC_LINK_IFELSE([AC_LANG_PROGRAM([[
-       #include <id3tag.h>
-]], [[
-       struct id3_tag t = {.flags = 0};
-]])],[],[have_libid3tag=no])
-AC_MSG_RESULT($have_libid3tag)
-
-if test ${have_libid3tag} = yes; then
-       AC_DEFINE(HAVE_LIBID3TAG, 1, define to 1 you have libid3tag)
-       AC_SUBST(id3tag_cppflags)
-       AC_SUBST(id3tag_ldflags, "$id3tag_libs -lid3tag -lz")
-fi
-CPPFLAGS="$OLD_CPPFLAGS"
-LDFLAGS="$OLD_LDFLAGS"
-LIBS="$OLD_LIBS"
+STASH_FLAGS
+LIB_ARG_WITH([id3tag], [-lid3tag -lz])
+HAVE_ID3TAG=yes
+AC_CHECK_HEADER(id3tag.h, [], HAVE_ID3TAG=no)
+AC_CHECK_LIB([id3tag], [id3_file_fdopen], [], HAVE_ID3TAG=no)
+LIB_SUBST_FLAGS(id3tag)
+UNSTASH_FLAGS
 ########################################################################### flac
 OLD_CPPFLAGS="$CPPFLAGS"
 OLD_LDFLAGS="$LDFLAGS"
@@ -821,7 +767,7 @@ if test -n "$CRYPTOLIB"; then
                audiod_errlist_objs="$audiod_errlist_objs aacdec_filter aac_common"
                audiod_audio_formats="$audiod_audio_formats aac"
        fi
-       if test "$have_mad" = "yes"; then
+       if test $HAVE_MAD = yes; then
                audiod_audio_formats="$audiod_audio_formats mp3"
                audiod_cmdline_objs="$audiod_cmdline_objs mp3dec_filter"
                audiod_errlist_objs="$audiod_errlist_objs mp3dec_filter"
@@ -989,7 +935,7 @@ if test $HAVE_FAAD = yes; then
        filter_errlist_objs="$filter_errlist_objs aacdec_filter aac_common"
        filters="$filters aacdec"
 fi
-if test "$have_mad" = "yes"; then
+if test $HAVE_MAD = yes; then
        filter_cmdline_objs="$filter_cmdline_objs mp3dec_filter"
        filter_errlist_objs="$filter_errlist_objs mp3dec_filter"
        filters="$filters mp3dec"
@@ -1172,7 +1118,7 @@ NEED_OPUS_OBJECTS &&
 if test $HAVE_FAAD = yes; then
        play_errlist_objs="$play_errlist_objs aacdec_filter aac_afh aac_common"
 fi
-if test "$have_mad" = "yes"; then
+if test $HAVE_MAD = yes; then
        play_cmdline_objs="$play_cmdline_objs mp3dec_filter"
        play_errlist_objs="$play_errlist_objs mp3dec_filter"
 fi
@@ -1367,7 +1313,7 @@ crypto lib: ${CRYPTOLIB:-[none]}
 unix socket credentials: $have_ucred
 readline (interactive CLIs): $have_readline
 audio formats handlers: $audio_format_handlers
-id3 version2 support: $have_libid3tag
+id3 version 2 support: $HAVE_ID3TAG
 filters: $filters
 writers: $writers