From 8d8fdc5b3ae30ad10b7e49eb6c84506b5c993b5f Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 31 Jul 2013 19:57:39 +0200 Subject: [PATCH] configure: Add pkg-config support for libmpg123. --- configure | 61 ++++++++++++++++++++++++++++++------ configure.ac | 16 +++++++--- dlls/winemp3.acm/Makefile.in | 3 +- 3 files changed, 65 insertions(+), 15 deletions(-) diff --git a/configure b/configure index 29aad5b1d50..a7cd48e3f95 100755 --- a/configure +++ b/configure @@ -640,7 +640,8 @@ BUILTINFLAG EXTRACFLAGS LIBKSTAT LIBOPENAL -LIBMPG123 +MPG123_LIBS +MPG123_CFLAGS TIFF_LIBS TIFF_CFLAGS PNG_LIBS @@ -899,7 +900,9 @@ JPEG_LIBS PNG_CFLAGS PNG_LIBS TIFF_CFLAGS -TIFF_LIBS' +TIFF_LIBS +MPG123_CFLAGS +MPG123_LIBS' # Initialize some variables set by options. @@ -1628,6 +1631,9 @@ Some influential environment variables: PNG_LIBS Linker flags for libpng, overriding pkg-config TIFF_CFLAGS C compiler flags for libtiff, overriding pkg-config TIFF_LIBS Linker flags for libtiff, overriding pkg-config + MPG123_CFLAGS + C compiler flags for libmpg123, overriding pkg-config + MPG123_LIBS Linker flags for libmpg123, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -2735,7 +2741,7 @@ fi # Check whether --with-mpg123 was given. if test "${with_mpg123+set}" = set; then : - withval=$with_mpg123; if test "x$withval" = "xno"; then ac_cv_header_mpg123_h=no; fi + withval=$with_mpg123; fi @@ -5994,7 +6000,6 @@ for ac_header in \ machine/limits.h \ machine/sysarch.h \ mntent.h \ - mpg123.h \ ncurses.h \ netdb.h \ netinet/in.h \ @@ -12156,15 +12161,44 @@ This is an error since --with-tiff was requested." "$LINENO" 5 ;; esac fi -if test "$ac_cv_header_mpg123_h" = "yes" +if test "x$with_mpg123" != "xno" then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mpg123_feed in -lmpg123" >&5 + if test -n "$MPG123_CFLAGS"; then : + +elif test -n "$PKG_CONFIG"; then : + MPG123_CFLAGS=`$PKG_CONFIG --cflags libmpg123 2>/dev/null` +fi + +if test -n "$MPG123_LIBS"; then : + +elif test -n "$PKG_CONFIG"; then : + MPG123_LIBS=`$PKG_CONFIG --libs libmpg123 2>/dev/null` +fi + +MPG123_LIBS=${MPG123_LIBS:-"-lmpg123"} +ac_save_CPPFLAGS=$CPPFLAGS +CPPFLAGS="$CPPFLAGS $MPG123_CFLAGS" +for ac_header in mpg123.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "mpg123.h" "ac_cv_header_mpg123_h" "$ac_includes_default" +if test "x$ac_cv_header_mpg123_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_MPG123_H 1 +_ACEOF + +fi + +done + + if test "$ac_cv_header_mpg123_h" = "yes" + then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mpg123_feed in -lmpg123" >&5 $as_echo_n "checking for mpg123_feed in -lmpg123... " >&6; } if ${ac_cv_lib_mpg123_mpg123_feed+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lmpg123 $LIBS" +LIBS="-lmpg123 $MPG123_LIBS $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -12195,10 +12229,19 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpg123_mpg123_feed" >&5 $as_echo "$ac_cv_lib_mpg123_mpg123_feed" >&6; } if test "x$ac_cv_lib_mpg123_mpg123_feed" = xyes; then : - LIBMPG123="-lmpg123" - + : +else + MPG123_LIBS="" fi + else + MPG123_CFLAGS="" + MPG123_LIBS="" + fi +CPPFLAGS=$ac_save_CPPFLAGS +test -z "$MPG123_CFLAGS" || MPG123_CFLAGS=`echo " $MPG123_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'` +test -z "$MPG123_LIBS" || MPG123_LIBS=`echo " $MPG123_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` + fi if test "x$ac_cv_lib_mpg123_mpg123_feed" != xyes -a x"$ac_cv_header_CoreAudio_CoreAudio_h" != xyes; then : case "x$with_mpg123" in diff --git a/configure.ac b/configure.ac index 0f289877bc1..0e3df611fcd 100644 --- a/configure.ac +++ b/configure.ac @@ -56,8 +56,7 @@ AC_ARG_WITH(hal, AS_HELP_STRING([--without-hal],[do not use HAL (dynamic d AC_ARG_WITH(jpeg, AS_HELP_STRING([--without-jpeg],[do not use JPEG])) AC_ARG_WITH(ldap, AS_HELP_STRING([--without-ldap],[do not use LDAP]), [if test "x$withval" = "xno"; then ac_cv_header_ldap_h=no; ac_cv_header_lber_h=no; fi]) -AC_ARG_WITH(mpg123, AS_HELP_STRING([--without-mpg123],[do not use the mpg123 library]), - [if test "x$withval" = "xno"; then ac_cv_header_mpg123_h=no; fi]) +AC_ARG_WITH(mpg123, AS_HELP_STRING([--without-mpg123],[do not use the mpg123 library])) AC_ARG_WITH(openal, AS_HELP_STRING([--without-openal],[do not use OpenAL]), [if test "x$withval" = "xno"; then ac_cv_header_AL_al_h=no; ac_cv_header_OpenAL_al_h=no; fi]) AC_ARG_WITH(opencl, AS_HELP_STRING([--without-opencl],[do not use OpenCL]), @@ -451,7 +450,6 @@ AC_CHECK_HEADERS(\ machine/limits.h \ machine/sysarch.h \ mntent.h \ - mpg123.h \ ncurses.h \ netdb.h \ netinet/in.h \ @@ -1688,9 +1686,17 @@ WINE_NOTICE_WITH(tiff,[test "x$ac_cv_lib_soname_tiff" = "x"], [libtiff ${notice_platform}development files not found, TIFF won't be supported.]) dnl **** Check for mpg123 **** -if test "$ac_cv_header_mpg123_h" = "yes" +if test "x$with_mpg123" != "xno" then - AC_CHECK_LIB(mpg123,mpg123_feed,[AC_SUBST(LIBMPG123,"-lmpg123")]) + WINE_PACKAGE_FLAGS(MPG123,[libmpg123],[-lmpg123],,, + [AC_CHECK_HEADERS([mpg123.h]) + if test "$ac_cv_header_mpg123_h" = "yes" + then + AC_CHECK_LIB(mpg123,mpg123_feed,[:],[MPG123_LIBS=""],[$MPG123_LIBS]) + else + MPG123_CFLAGS="" + MPG123_LIBS="" + fi]) fi WINE_NOTICE_WITH(mpg123,[test "x$ac_cv_lib_mpg123_mpg123_feed" != xyes -a x"$ac_cv_header_CoreAudio_CoreAudio_h" != xyes], [libmpg123 ${notice_platform}development files not found (or too old), mp3 codec won't be supported.]) diff --git a/dlls/winemp3.acm/Makefile.in b/dlls/winemp3.acm/Makefile.in index 2c372a69778..bceb26f6b42 100644 --- a/dlls/winemp3.acm/Makefile.in +++ b/dlls/winemp3.acm/Makefile.in @@ -1,6 +1,7 @@ MODULE = winemp3.acm IMPORTS = winmm user32 -EXTRALIBS = @LIBMPG123@ @COREAUDIO@ +EXTRAINCL = @MPG123_CFLAGS@ +EXTRALIBS = @MPG123_LIBS@ @COREAUDIO@ C_SRCS = \ mpegl3.c