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, and
  libopusfile, where final linkage used to fail if dynamic loading was
  disabled.
- use the OTHER_LIBS argument of AC_CHECK_LIB in vorbis detection, and
  restore LIBS too.
- always restore CFLAGS and LIBS in libmikmod detection.
  • Loading branch information
sezero committed Oct 14, 2018
1 parent 557f2fd commit bb9d20a
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 46 deletions.
69 changes: 35 additions & 34 deletions configure
Expand Up @@ -11859,7 +11859,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$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" = xyes; then :
have_libmodplug_lib=yes
have_libmodplug_lib=yes;MODPLUG_LIBS="-lmodplug"
fi


Expand Down Expand Up @@ -11907,7 +11907,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$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" = xyes; then :
have_libmodplug_lib=yes
have_libmodplug_lib=yes;MODPLUG_LIBS="-lmodplug"
fi


Expand Down Expand Up @@ -11970,6 +11970,8 @@ if test x$enable_music_mod = xyes -a x$enable_music_mod_mikmod = 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:${as_lineno-$LINENO}: checking for $ac_word" >&5
Expand Down Expand Up @@ -12012,9 +12014,6 @@ fi


if test "$LIBMIKMOD_CONFIG" != "no" ; then

CFLAGS_SAVED="$CFLAGS"
LIBS_SAVED="$LIBS"
CFLAGS="$CFLAGS `$LIBMIKMOD_CONFIG --cflags`"
LIBS="$LIBS `$LIBMIKMOD_CONFIG --libs`"
have_libmikmod=yes
Expand Down Expand Up @@ -12045,7 +12044,7 @@ _ACEOF
if ac_fn_c_try_run "$LINENO"; then :

else
have_libmikmod=no; CFLAGS="$CFLAGS_SAVED"; LIBS="$LIBS_SAVED"
have_libmikmod=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
Expand Down Expand Up @@ -12079,6 +12078,8 @@ fi
{ $as_echo "$as_me:${as_lineno-$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

if test x$have_libmodplug != xyes -a x$have_libmikmod != xyes ; then
Expand Down Expand Up @@ -12263,21 +12264,21 @@ else
fi

if test x$enable_music_ogg = xyes; then
LIBS_SAVED="$LIBS"
if test x$enable_music_ogg_tremor = xyes; then
ac_fn_c_check_header_mongrel "$LINENO" "tremor/ivorbisfile.h" "ac_cv_header_tremor_ivorbisfile_h" "$ac_includes_default"
if test "x$ac_cv_header_tremor_ivorbisfile_h" = xyes; then :
have_tremor_hdr=yes
fi


as_ac_Lib=`$as_echo "ac_cv_lib_vorbisidec -logg''_ov_open_callbacks" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ov_open_callbacks in -lvorbisidec -logg" >&5
$as_echo_n "checking for ov_open_callbacks in -lvorbisidec -logg... " >&6; }
if eval \${$as_ac_Lib+:} false; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ov_open_callbacks in -lvorbisidec" >&5
$as_echo_n "checking for ov_open_callbacks in -lvorbisidec... " >&6; }
if ${ac_cv_lib_vorbisidec_ov_open_callbacks+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lvorbisidec -logg $LIBS"
LIBS="-lvorbisidec -logg $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
Expand All @@ -12297,18 +12298,17 @@ return ov_open_callbacks ();
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
eval "$as_ac_Lib=yes"
ac_cv_lib_vorbisidec_ov_open_callbacks=yes
else
eval "$as_ac_Lib=no"
ac_cv_lib_vorbisidec_ov_open_callbacks=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
{ $as_echo "$as_me:${as_lineno-$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" = xyes; then :
have_tremor_lib=yes
fi

Expand Down Expand Up @@ -12347,14 +12347,13 @@ if test "x$ac_cv_header_vorbis_vorbisfile_h" = xyes; then :
fi


as_ac_Lib=`$as_echo "ac_cv_lib_vorbisfile -lvorbis -logg -lm''_ov_open_callbacks" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$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 eval \${$as_ac_Lib+:} false; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ov_open_callbacks in -lvorbisfile" >&5
$as_echo_n "checking for ov_open_callbacks in -lvorbisfile... " >&6; }
if ${ac_cv_lib_vorbisfile_ov_open_callbacks+:} false; 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 confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
Expand All @@ -12374,18 +12373,17 @@ return ov_open_callbacks ();
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
eval "$as_ac_Lib=yes"
ac_cv_lib_vorbisfile_ov_open_callbacks=yes
else
eval "$as_ac_Lib=no"
ac_cv_lib_vorbisfile_ov_open_callbacks=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
{ $as_echo "$as_me:${as_lineno-$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" = xyes; then :
have_ogg_lib=yes
fi

Expand Down Expand Up @@ -12418,6 +12416,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 Expand Up @@ -12605,10 +12604,10 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
$as_echo "$have_libmad" >&6; }
if test x$have_libmad = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MP3_MAD"
if test x$enable_music_mp3_mad_gpl_dithering = xyes; then
if test x$enable_music_mp3_mad_gpl_dithering = xyes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** Using GPL libmad and MP3 dithering routines, this build of SDL_mixer is now under the GPL" >&5
$as_echo "$as_me: WARNING: *** Using GPL libmad and MP3 dithering routines, this build of SDL_mixer is now under the GPL" >&2;}
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MP3_MAD_GPL_DITHERING"
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MP3_MAD_GPL_DITHERING"
fi
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmad"
else
Expand Down Expand Up @@ -12729,6 +12728,7 @@ else
fi

if test x$enable_music_opus = xyes; then
LIBS_SAVED="$LIBS"

pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OPUSFILE" >&5
Expand Down Expand Up @@ -12802,7 +12802,7 @@ if ${ac_cv_lib_opusfile_op_open_callbacks+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lopusfile $LIBS"
LIBS="-lopusfile -lopus -logg -lm $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
Expand Down Expand Up @@ -12833,7 +12833,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_opusfile_op_open_callbacks" >&5
$as_echo "$ac_cv_lib_opusfile_op_open_callbacks" >&6; }
if test "x$ac_cv_lib_opusfile_op_open_callbacks" = xyes; then :
have_opusfile_lib=yes
have_opusfile_lib=yes;OPUSFILE_LIBS="-lopusfile -lopus"
fi


Expand All @@ -12850,7 +12850,7 @@ if ${ac_cv_lib_opusfile_op_open_callbacks+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lopusfile $LIBS"
LIBS="-lopusfile -lopus -logg -lm $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
Expand Down Expand Up @@ -12881,7 +12881,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_opusfile_op_open_callbacks" >&5
$as_echo "$ac_cv_lib_opusfile_op_open_callbacks" >&6; }
if test "x$ac_cv_lib_opusfile_op_open_callbacks" = xyes; then :
have_opusfile_lib=yes
have_opusfile_lib=yes;OPUSFILE_LIBS="-lopusfile -lopus"
fi


Expand All @@ -12894,6 +12894,7 @@ $as_echo "yes" >&6; }
have_opusfile_lib=yes

fi
LIBS="$LIBS_SAVED"

if test x$have_opusfile_hdr = xyes -a x$have_opusfile_lib = xyes; then
have_opusfile=yes
Expand Down
28 changes: 16 additions & 12 deletions configure.in
Expand Up @@ -110,7 +110,7 @@ if test x$enable_dependency_tracking = xyes; then
DEPENDENCY_TRACKING_OPTIONS="-MMD -MT \$@"
fi
fi

case "$host" in
*mingw32ce*)
#VERSION_SOURCES="$srcdir/version.rc"
Expand Down Expand Up @@ -248,7 +248,7 @@ if test x$enable_music_mod = xyes -a 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 @@ -291,11 +291,10 @@ if test x$enable_music_mod = xyes -a x$enable_music_mod_mikmod = 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 `$LIBMIKMOD_CONFIG --cflags`"
LIBS="$LIBS `$LIBMIKMOD_CONFIG --libs`"
have_libmikmod=yes
Expand All @@ -315,8 +314,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 @@ -344,6 +342,8 @@ return 1;
else
AC_MSG_WARN([*** Unable to find MikMod library (http://mikmod.raphnet.net/)])
fi
LIBS="$LIBS_SAVED"
CFLAGS="$CFLAGS_SAVED"
fi

if test x$have_libmodplug != xyes -a x$have_libmikmod != xyes ; then
Expand Down Expand Up @@ -448,9 +448,10 @@ AC_ARG_ENABLE([music-ogg-shared],
AC_HELP_STRING([--enable-music-ogg-shared], [dynamically load Ogg Vorbis library [[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 @@ -479,7 +480,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 @@ -507,6 +508,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 Expand Up @@ -590,9 +592,9 @@ if test x$enable_music_mp3 = xyes -a x$enable_music_mp3_mad_gpl = xyes; then
AC_MSG_RESULT($have_libmad)
if test x$have_libmad = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MP3_MAD"
if test x$enable_music_mp3_mad_gpl_dithering = xyes; then
if test x$enable_music_mp3_mad_gpl_dithering = xyes; then
AC_MSG_WARN([*** Using GPL libmad and MP3 dithering routines, this build of SDL_mixer is now under the GPL])
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MP3_MAD_GPL_DITHERING"
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MP3_MAD_GPL_DITHERING"
fi
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmad"
else
Expand Down Expand Up @@ -649,13 +651,15 @@ AC_ARG_ENABLE([music-opus-shared],
AC_HELP_STRING([--enable-music-opus-shared], [dynamically load opusfile library [[default=yes]]]),
[], [enable_music_opus_shared=yes])
if test x$enable_music_opus = xyes; then
LIBS_SAVED="$LIBS"
PKG_CHECK_MODULES([OPUSFILE], [opusfile >= 0.2], [dnl
have_opusfile_hdr=yes
have_opusfile_lib=yes
], [dnl
AC_CHECK_HEADER([opus/opusfile.h], [have_opusfile_hdr=yes])
AC_CHECK_LIB([opusfile], [op_open_callbacks], [have_opusfile_lib=yes])
AC_CHECK_LIB([opusfile], [op_open_callbacks], [have_opusfile_lib=yes;OPUSFILE_LIBS="-lopusfile -lopus"], [], [-lopus -logg -lm])
])
LIBS="$LIBS_SAVED"

if test x$have_opusfile_hdr = xyes -a x$have_opusfile_lib = xyes; then
have_opusfile=yes
Expand Down

0 comments on commit bb9d20a

Please sign in to comment.