Skip to content

Commit

Permalink
configury update:
Browse files Browse the repository at this point in the history
- if we use PKG_CONFIG to detect a foo lib and it fails and then if we
  manually check the lib and succeed, FOO_LIBS would remain undefined:
  manually set it in that case.  this was the case for libmodplug where
  final linkage used to fail.
- use the OTHER_LIBS argument of AC_CHECK_LIB in vorbis detection, and
  restore LIBS too.
- always restore CFLAGS and LIBS in libmikmod detection.
- remove the mysterious LIBMIKMOD_MUSIC define from libmikmod detection.
  • Loading branch information
sezero committed Oct 14, 2018
1 parent 3fcb2cb commit 6f50d04
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 32 deletions.
52 changes: 28 additions & 24 deletions configure
Expand Up @@ -12743,6 +12743,8 @@ if test x$enable_music_mod = xyes; then
libmikmod_min=1
libmikmod_rev=10
libmikmod_ver="$libmikmod_maj.$libmikmod_min.$libmikmod_rev"
CFLAGS_SAVED="$CFLAGS"
LIBS_SAVED="$LIBS"
# Extract the first word of "libmikmod-config", so it can be a program name with args.
set dummy libmikmod-config; ac_word=$2
{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
Expand Down Expand Up @@ -12785,9 +12787,7 @@ fi


if test "$LIBMIKMOD_CONFIG" != "no" ; then
CFLAGS_SAVED="$CFLAGS"
LIBS_SAVED="$LIBS"
CFLAGS="$CFLAGS -DLIBMIKMOD_MUSIC `$LIBMIKMOD_CONFIG --cflags`"
CFLAGS="$CFLAGS `$LIBMIKMOD_CONFIG --cflags`"
LIBS="$LIBS `$LIBMIKMOD_CONFIG --libs`"
have_libmikmod=yes
{ $as_echo "$as_me:$LINENO: checking for libmikmod - version >= $libmikmod_ver" >&5
Expand Down Expand Up @@ -12847,7 +12847,7 @@ $as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

( exit $ac_status )
have_libmikmod=no; CFLAGS="$CFLAGS_SAVED"; LIBS="$LIBS_SAVED"
have_libmikmod=no
fi
rm -rf conftest.dSYM
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
Expand Down Expand Up @@ -12883,6 +12883,8 @@ fi
{ $as_echo "$as_me:$LINENO: WARNING: *** Unable to find MikMod library (http://mikmod.raphnet.net/)" >&5
$as_echo "$as_me: WARNING: *** Unable to find MikMod library (http://mikmod.raphnet.net/)" >&2;}
fi
LIBS="$LIBS_SAVED"
CFLAGS="$CFLAGS_SAVED"
fi

# Check whether --enable-music-mod-modplug was given.
Expand Down Expand Up @@ -13152,7 +13154,7 @@ fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_modplug_ModPlug_Load" >&5
$as_echo "$ac_cv_lib_modplug_ModPlug_Load" >&6; }
if test "x$ac_cv_lib_modplug_ModPlug_Load" = x""yes; then
have_libmodplug_lib=yes
have_libmodplug_lib=yes;MODPLUG_LIBS="-lmodplug"
fi


Expand Down Expand Up @@ -13355,7 +13357,7 @@ fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_modplug_ModPlug_Load" >&5
$as_echo "$ac_cv_lib_modplug_ModPlug_Load" >&6; }
if test "x$ac_cv_lib_modplug_ModPlug_Load" = x""yes; then
have_libmodplug_lib=yes
have_libmodplug_lib=yes;MODPLUG_LIBS="-lmodplug"
fi


Expand Down Expand Up @@ -13710,6 +13712,7 @@ else
fi

if test x$enable_music_ogg = xyes; then
LIBS_SAVED="$LIBS"
if test x$enable_music_ogg_tremor = xyes; then
if test "${ac_cv_header_tremor_ivorbisfile_h+set}" = set; then
{ $as_echo "$as_me:$LINENO: checking for tremor/ivorbisfile.h" >&5
Expand Down Expand Up @@ -13843,13 +13846,13 @@ if test "x$ac_cv_header_tremor_ivorbisfile_h" = x""yes; then
fi


{ $as_echo "$as_me:$LINENO: checking for ov_open_callbacks in -lvorbisidec -logg" >&5
$as_echo_n "checking for ov_open_callbacks in -lvorbisidec -logg... " >&6; }
if test "${ac_cv_lib_vorbisidec__logg_ov_open_callbacks+set}" = set; then
{ $as_echo "$as_me:$LINENO: checking for ov_open_callbacks in -lvorbisidec" >&5
$as_echo_n "checking for ov_open_callbacks in -lvorbisidec... " >&6; }
if test "${ac_cv_lib_vorbisidec_ov_open_callbacks+set}" = set; then
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lvorbisidec -logg $LIBS"
LIBS="-lvorbisidec -logg $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
Expand Down Expand Up @@ -13893,22 +13896,22 @@ $as_echo "$ac_try_echo") >&5
test "$cross_compiling" = yes ||
$as_test_x conftest$ac_exeext
}; then
ac_cv_lib_vorbisidec__logg_ov_open_callbacks=yes
ac_cv_lib_vorbisidec_ov_open_callbacks=yes
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

ac_cv_lib_vorbisidec__logg_ov_open_callbacks=no
ac_cv_lib_vorbisidec_ov_open_callbacks=no
fi

rm -rf conftest.dSYM
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_vorbisidec__logg_ov_open_callbacks" >&5
$as_echo "$ac_cv_lib_vorbisidec__logg_ov_open_callbacks" >&6; }
if test "x$ac_cv_lib_vorbisidec__logg_ov_open_callbacks" = x""yes; then
{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_vorbisidec_ov_open_callbacks" >&5
$as_echo "$ac_cv_lib_vorbisidec_ov_open_callbacks" >&6; }
if test "x$ac_cv_lib_vorbisidec_ov_open_callbacks" = x""yes; then
have_tremor_lib=yes
fi

Expand Down Expand Up @@ -14074,13 +14077,13 @@ if test "x$ac_cv_header_vorbis_vorbisfile_h" = x""yes; then
fi


{ $as_echo "$as_me:$LINENO: checking for ov_open_callbacks in -lvorbisfile -lvorbis -logg -lm" >&5
$as_echo_n "checking for ov_open_callbacks in -lvorbisfile -lvorbis -logg -lm... " >&6; }
if test "${ac_cv_lib_vorbisfile__lvorbis__logg__lm_ov_open_callbacks+set}" = set; then
{ $as_echo "$as_me:$LINENO: checking for ov_open_callbacks in -lvorbisfile" >&5
$as_echo_n "checking for ov_open_callbacks in -lvorbisfile... " >&6; }
if test "${ac_cv_lib_vorbisfile_ov_open_callbacks+set}" = set; then
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lvorbisfile -lvorbis -logg -lm $LIBS"
LIBS="-lvorbisfile -lvorbis -logg -lm $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
Expand Down Expand Up @@ -14124,22 +14127,22 @@ $as_echo "$ac_try_echo") >&5
test "$cross_compiling" = yes ||
$as_test_x conftest$ac_exeext
}; then
ac_cv_lib_vorbisfile__lvorbis__logg__lm_ov_open_callbacks=yes
ac_cv_lib_vorbisfile_ov_open_callbacks=yes
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

ac_cv_lib_vorbisfile__lvorbis__logg__lm_ov_open_callbacks=no
ac_cv_lib_vorbisfile_ov_open_callbacks=no
fi

rm -rf conftest.dSYM
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_vorbisfile__lvorbis__logg__lm_ov_open_callbacks" >&5
$as_echo "$ac_cv_lib_vorbisfile__lvorbis__logg__lm_ov_open_callbacks" >&6; }
if test "x$ac_cv_lib_vorbisfile__lvorbis__logg__lm_ov_open_callbacks" = x""yes; then
{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_vorbisfile_ov_open_callbacks" >&5
$as_echo "$ac_cv_lib_vorbisfile_ov_open_callbacks" >&6; }
if test "x$ac_cv_lib_vorbisfile_ov_open_callbacks" = x""yes; then
have_ogg_lib=yes
fi

Expand Down Expand Up @@ -14173,6 +14176,7 @@ $as_echo "$as_me: WARNING: *** Unable to find Ogg Vorbis library (http://www.xip
$as_echo "$as_me: WARNING: Ogg Vorbis support disabled" >&2;}
fi
fi
LIBS="$LIBS_SAVED"
fi

libflac_ver=8
Expand Down
19 changes: 11 additions & 8 deletions configure.in
Expand Up @@ -250,11 +250,11 @@ if test x$enable_music_mod = xyes; then
libmikmod_min=1
libmikmod_rev=10
libmikmod_ver="$libmikmod_maj.$libmikmod_min.$libmikmod_rev"
CFLAGS_SAVED="$CFLAGS"
LIBS_SAVED="$LIBS"
AC_PATH_PROG(LIBMIKMOD_CONFIG, libmikmod-config, no, [$PATH])
if test "$LIBMIKMOD_CONFIG" != "no" ; then
CFLAGS_SAVED="$CFLAGS"
LIBS_SAVED="$LIBS"
CFLAGS="$CFLAGS -DLIBMIKMOD_MUSIC `$LIBMIKMOD_CONFIG --cflags`"
CFLAGS="$CFLAGS `$LIBMIKMOD_CONFIG --cflags`"
LIBS="$LIBS `$LIBMIKMOD_CONFIG --libs`"
have_libmikmod=yes
AC_MSG_CHECKING([for libmikmod - version >= $libmikmod_ver])
Expand All @@ -273,8 +273,7 @@ if(ver>=((maj<<16)|(min<<8)|(rev))) {
printf("no\n*** libmikmod is older than %d.%d.%d, not using.\n",maj,min,rev);
return 1;
}
], [], have_libmikmod=no; CFLAGS="$CFLAGS_SAVED"; LIBS="$LIBS_SAVED",
[echo $ac_n "cross compiling; assumed OK... $ac_c"])
], [], [have_libmikmod=no], [echo $ac_n "cross compiling; assumed OK... $ac_c"])
fi

if test x$have_libmikmod = xyes; then
Expand Down Expand Up @@ -303,6 +302,8 @@ return 1;
else
AC_MSG_WARN([*** Unable to find MikMod library (http://mikmod.raphnet.net/)])
fi
LIBS="$LIBS_SAVED"
CFLAGS="$CFLAGS_SAVED"
fi

AC_ARG_ENABLE([music-mod-modplug],
Expand All @@ -314,7 +315,7 @@ if test x$enable_music_mod_modplug = xyes; then
have_libmodplug_lib=yes
], [dnl
AC_CHECK_HEADER([libmodplug/modplug.h], [have_libmodplug_hdr=yes])
AC_CHECK_LIB([modplug], [ModPlug_Load], [have_libmodplug_lib=yes])
AC_CHECK_LIB([modplug], [ModPlug_Load], [have_libmodplug_lib=yes;MODPLUG_LIBS="-lmodplug"])
])

if test x$have_libmodplug_hdr = xyes -a x$have_libmodplug_lib = xyes; then
Expand Down Expand Up @@ -423,9 +424,10 @@ AC_ARG_ENABLE([music-ogg-shared],
AC_HELP_STRING([--enable-music-ogg-shared], [dynamically load Ogg Vorbis support [[default=yes]]]),
[], [enable_music_ogg_shared=yes])
if test x$enable_music_ogg = xyes; then
LIBS_SAVED="$LIBS"
if test x$enable_music_ogg_tremor = xyes; then
AC_CHECK_HEADER([tremor/ivorbisfile.h], [have_tremor_hdr=yes])
AC_CHECK_LIB([vorbisidec -logg], [ov_open_callbacks], [have_tremor_lib=yes])
AC_CHECK_LIB([vorbisidec], [ov_open_callbacks], [have_tremor_lib=yes], [], [-logg])
if test x$have_tremor_hdr = xyes -a x$have_tremor_lib = xyes; then
case "$host" in
*-*-darwin*)
Expand Down Expand Up @@ -455,7 +457,7 @@ if test x$enable_music_ogg = xyes; then
fi
else
AC_CHECK_HEADER([vorbis/vorbisfile.h], [have_ogg_hdr=yes])
AC_CHECK_LIB([vorbisfile -lvorbis -logg -lm], [ov_open_callbacks], [have_ogg_lib=yes])
AC_CHECK_LIB([vorbisfile], [ov_open_callbacks], [have_ogg_lib=yes], [], [-lvorbis -logg -lm])
if test x$have_ogg_hdr = xyes -a x$have_ogg_lib = xyes; then
case "$host" in
*-*-darwin*)
Expand Down Expand Up @@ -484,6 +486,7 @@ if test x$enable_music_ogg = xyes; then
AC_MSG_WARN([Ogg Vorbis support disabled])
fi
fi
LIBS="$LIBS_SAVED"
fi

libflac_ver=8
Expand Down

0 comments on commit 6f50d04

Please sign in to comment.