Skip to content

Commit 214ea0b

Browse files
committed
configury update:
- 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.
1 parent 589583f commit 214ea0b

File tree

2 files changed

+51
-46
lines changed

2 files changed

+51
-46
lines changed

configure

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11859,7 +11859,7 @@ fi
1185911859
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_modplug_ModPlug_Load" >&5
1186011860
$as_echo "$ac_cv_lib_modplug_ModPlug_Load" >&6; }
1186111861
if test "x$ac_cv_lib_modplug_ModPlug_Load" = xyes; then :
11862-
have_libmodplug_lib=yes
11862+
have_libmodplug_lib=yes;MODPLUG_LIBS="-lmodplug"
1186311863
fi
1186411864

1186511865

@@ -11907,7 +11907,7 @@ fi
1190711907
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_modplug_ModPlug_Load" >&5
1190811908
$as_echo "$ac_cv_lib_modplug_ModPlug_Load" >&6; }
1190911909
if test "x$ac_cv_lib_modplug_ModPlug_Load" = xyes; then :
11910-
have_libmodplug_lib=yes
11910+
have_libmodplug_lib=yes;MODPLUG_LIBS="-lmodplug"
1191111911
fi
1191211912

1191311913

@@ -11970,6 +11970,8 @@ if test x$enable_music_mod = xyes -a x$enable_music_mod_mikmod = xyes; then
1197011970
libmikmod_min=1
1197111971
libmikmod_rev=10
1197211972
libmikmod_ver="$libmikmod_maj.$libmikmod_min.$libmikmod_rev"
11973+
CFLAGS_SAVED="$CFLAGS"
11974+
LIBS_SAVED="$LIBS"
1197311975
# Extract the first word of "libmikmod-config", so it can be a program name with args.
1197411976
set dummy libmikmod-config; ac_word=$2
1197511977
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -12012,9 +12014,6 @@ fi
1201212014

1201312015

1201412016
if test "$LIBMIKMOD_CONFIG" != "no" ; then
12015-
12016-
CFLAGS_SAVED="$CFLAGS"
12017-
LIBS_SAVED="$LIBS"
1201812017
CFLAGS="$CFLAGS `$LIBMIKMOD_CONFIG --cflags`"
1201912018
LIBS="$LIBS `$LIBMIKMOD_CONFIG --libs`"
1202012019
have_libmikmod=yes
@@ -12045,7 +12044,7 @@ _ACEOF
1204512044
if ac_fn_c_try_run "$LINENO"; then :
1204612045

1204712046
else
12048-
have_libmikmod=no; CFLAGS="$CFLAGS_SAVED"; LIBS="$LIBS_SAVED"
12047+
have_libmikmod=no
1204912048
fi
1205012049
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
1205112050
conftest.$ac_objext conftest.beam conftest.$ac_ext
@@ -12079,6 +12078,8 @@ fi
1207912078
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** Unable to find MikMod library (http://mikmod.raphnet.net/)" >&5
1208012079
$as_echo "$as_me: WARNING: *** Unable to find MikMod library (http://mikmod.raphnet.net/)" >&2;}
1208112080
fi
12081+
LIBS="$LIBS_SAVED"
12082+
CFLAGS="$CFLAGS_SAVED"
1208212083
fi
1208312084

1208412085
if test x$have_libmodplug != xyes -a x$have_libmikmod != xyes ; then
@@ -12263,21 +12264,21 @@ else
1226312264
fi
1226412265

1226512266
if test x$enable_music_ogg = xyes; then
12267+
LIBS_SAVED="$LIBS"
1226612268
if test x$enable_music_ogg_tremor = xyes; then
1226712269
ac_fn_c_check_header_mongrel "$LINENO" "tremor/ivorbisfile.h" "ac_cv_header_tremor_ivorbisfile_h" "$ac_includes_default"
1226812270
if test "x$ac_cv_header_tremor_ivorbisfile_h" = xyes; then :
1226912271
have_tremor_hdr=yes
1227012272
fi
1227112273

1227212274

12273-
as_ac_Lib=`$as_echo "ac_cv_lib_vorbisidec -logg''_ov_open_callbacks" | $as_tr_sh`
12274-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ov_open_callbacks in -lvorbisidec -logg" >&5
12275-
$as_echo_n "checking for ov_open_callbacks in -lvorbisidec -logg... " >&6; }
12276-
if eval \${$as_ac_Lib+:} false; then :
12275+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ov_open_callbacks in -lvorbisidec" >&5
12276+
$as_echo_n "checking for ov_open_callbacks in -lvorbisidec... " >&6; }
12277+
if ${ac_cv_lib_vorbisidec_ov_open_callbacks+:} false; then :
1227712278
$as_echo_n "(cached) " >&6
1227812279
else
1227912280
ac_check_lib_save_LIBS=$LIBS
12280-
LIBS="-lvorbisidec -logg $LIBS"
12281+
LIBS="-lvorbisidec -logg $LIBS"
1228112282
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1228212283
/* end confdefs.h. */
1228312284
@@ -12297,18 +12298,17 @@ return ov_open_callbacks ();
1229712298
}
1229812299
_ACEOF
1229912300
if ac_fn_c_try_link "$LINENO"; then :
12300-
eval "$as_ac_Lib=yes"
12301+
ac_cv_lib_vorbisidec_ov_open_callbacks=yes
1230112302
else
12302-
eval "$as_ac_Lib=no"
12303+
ac_cv_lib_vorbisidec_ov_open_callbacks=no
1230312304
fi
1230412305
rm -f core conftest.err conftest.$ac_objext \
1230512306
conftest$ac_exeext conftest.$ac_ext
1230612307
LIBS=$ac_check_lib_save_LIBS
1230712308
fi
12308-
eval ac_res=\$$as_ac_Lib
12309-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
12310-
$as_echo "$ac_res" >&6; }
12311-
if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
12309+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_vorbisidec_ov_open_callbacks" >&5
12310+
$as_echo "$ac_cv_lib_vorbisidec_ov_open_callbacks" >&6; }
12311+
if test "x$ac_cv_lib_vorbisidec_ov_open_callbacks" = xyes; then :
1231212312
have_tremor_lib=yes
1231312313
fi
1231412314

@@ -12347,14 +12347,13 @@ if test "x$ac_cv_header_vorbis_vorbisfile_h" = xyes; then :
1234712347
fi
1234812348

1234912349

12350-
as_ac_Lib=`$as_echo "ac_cv_lib_vorbisfile -lvorbis -logg -lm''_ov_open_callbacks" | $as_tr_sh`
12351-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ov_open_callbacks in -lvorbisfile -lvorbis -logg -lm" >&5
12352-
$as_echo_n "checking for ov_open_callbacks in -lvorbisfile -lvorbis -logg -lm... " >&6; }
12353-
if eval \${$as_ac_Lib+:} false; then :
12350+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ov_open_callbacks in -lvorbisfile" >&5
12351+
$as_echo_n "checking for ov_open_callbacks in -lvorbisfile... " >&6; }
12352+
if ${ac_cv_lib_vorbisfile_ov_open_callbacks+:} false; then :
1235412353
$as_echo_n "(cached) " >&6
1235512354
else
1235612355
ac_check_lib_save_LIBS=$LIBS
12357-
LIBS="-lvorbisfile -lvorbis -logg -lm $LIBS"
12356+
LIBS="-lvorbisfile -lvorbis -logg -lm $LIBS"
1235812357
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1235912358
/* end confdefs.h. */
1236012359
@@ -12374,18 +12373,17 @@ return ov_open_callbacks ();
1237412373
}
1237512374
_ACEOF
1237612375
if ac_fn_c_try_link "$LINENO"; then :
12377-
eval "$as_ac_Lib=yes"
12376+
ac_cv_lib_vorbisfile_ov_open_callbacks=yes
1237812377
else
12379-
eval "$as_ac_Lib=no"
12378+
ac_cv_lib_vorbisfile_ov_open_callbacks=no
1238012379
fi
1238112380
rm -f core conftest.err conftest.$ac_objext \
1238212381
conftest$ac_exeext conftest.$ac_ext
1238312382
LIBS=$ac_check_lib_save_LIBS
1238412383
fi
12385-
eval ac_res=\$$as_ac_Lib
12386-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
12387-
$as_echo "$ac_res" >&6; }
12388-
if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
12384+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_vorbisfile_ov_open_callbacks" >&5
12385+
$as_echo "$ac_cv_lib_vorbisfile_ov_open_callbacks" >&6; }
12386+
if test "x$ac_cv_lib_vorbisfile_ov_open_callbacks" = xyes; then :
1238912387
have_ogg_lib=yes
1239012388
fi
1239112389

@@ -12418,6 +12416,7 @@ $as_echo "$as_me: WARNING: *** Unable to find Ogg Vorbis library (http://www.xip
1241812416
$as_echo "$as_me: WARNING: Ogg Vorbis support disabled" >&2;}
1241912417
fi
1242012418
fi
12419+
LIBS="$LIBS_SAVED"
1242112420
fi
1242212421

1242312422
libflac_ver=8
@@ -12605,10 +12604,10 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
1260512604
$as_echo "$have_libmad" >&6; }
1260612605
if test x$have_libmad = xyes; then
1260712606
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MP3_MAD"
12608-
if test x$enable_music_mp3_mad_gpl_dithering = xyes; then
12607+
if test x$enable_music_mp3_mad_gpl_dithering = xyes; then
1260912608
{ $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
1261012609
$as_echo "$as_me: WARNING: *** Using GPL libmad and MP3 dithering routines, this build of SDL_mixer is now under the GPL" >&2;}
12611-
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MP3_MAD_GPL_DITHERING"
12610+
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MP3_MAD_GPL_DITHERING"
1261212611
fi
1261312612
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmad"
1261412613
else
@@ -12729,6 +12728,7 @@ else
1272912728
fi
1273012729

1273112730
if test x$enable_music_opus = xyes; then
12731+
LIBS_SAVED="$LIBS"
1273212732

1273312733
pkg_failed=no
1273412734
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OPUSFILE" >&5
@@ -12802,7 +12802,7 @@ if ${ac_cv_lib_opusfile_op_open_callbacks+:} false; then :
1280212802
$as_echo_n "(cached) " >&6
1280312803
else
1280412804
ac_check_lib_save_LIBS=$LIBS
12805-
LIBS="-lopusfile $LIBS"
12805+
LIBS="-lopusfile -lopus -logg -lm $LIBS"
1280612806
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1280712807
/* end confdefs.h. */
1280812808
@@ -12833,7 +12833,7 @@ fi
1283312833
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_opusfile_op_open_callbacks" >&5
1283412834
$as_echo "$ac_cv_lib_opusfile_op_open_callbacks" >&6; }
1283512835
if test "x$ac_cv_lib_opusfile_op_open_callbacks" = xyes; then :
12836-
have_opusfile_lib=yes
12836+
have_opusfile_lib=yes;OPUSFILE_LIBS="-lopusfile -lopus"
1283712837
fi
1283812838

1283912839

@@ -12850,7 +12850,7 @@ if ${ac_cv_lib_opusfile_op_open_callbacks+:} false; then :
1285012850
$as_echo_n "(cached) " >&6
1285112851
else
1285212852
ac_check_lib_save_LIBS=$LIBS
12853-
LIBS="-lopusfile $LIBS"
12853+
LIBS="-lopusfile -lopus -logg -lm $LIBS"
1285412854
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1285512855
/* end confdefs.h. */
1285612856
@@ -12881,7 +12881,7 @@ fi
1288112881
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_opusfile_op_open_callbacks" >&5
1288212882
$as_echo "$ac_cv_lib_opusfile_op_open_callbacks" >&6; }
1288312883
if test "x$ac_cv_lib_opusfile_op_open_callbacks" = xyes; then :
12884-
have_opusfile_lib=yes
12884+
have_opusfile_lib=yes;OPUSFILE_LIBS="-lopusfile -lopus"
1288512885
fi
1288612886

1288712887

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

1289612896
fi
12897+
LIBS="$LIBS_SAVED"
1289712898

1289812899
if test x$have_opusfile_hdr = xyes -a x$have_opusfile_lib = xyes; then
1289912900
have_opusfile=yes

configure.in

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ if test x$enable_dependency_tracking = xyes; then
110110
DEPENDENCY_TRACKING_OPTIONS="-MMD -MT \$@"
111111
fi
112112
fi
113-
113+
114114
case "$host" in
115115
*mingw32ce*)
116116
#VERSION_SOURCES="$srcdir/version.rc"
@@ -248,7 +248,7 @@ if test x$enable_music_mod = xyes -a x$enable_music_mod_modplug = xyes; then
248248
have_libmodplug_lib=yes
249249
], [dnl
250250
AC_CHECK_HEADER([libmodplug/modplug.h], [have_libmodplug_hdr=yes])
251-
AC_CHECK_LIB([modplug], [ModPlug_Load], [have_libmodplug_lib=yes])
251+
AC_CHECK_LIB([modplug], [ModPlug_Load], [have_libmodplug_lib=yes;MODPLUG_LIBS="-lmodplug"])
252252
])
253253

254254
if test x$have_libmodplug_hdr = xyes -a x$have_libmodplug_lib = xyes; then
@@ -291,11 +291,10 @@ if test x$enable_music_mod = xyes -a x$enable_music_mod_mikmod = xyes; then
291291
libmikmod_min=1
292292
libmikmod_rev=10
293293
libmikmod_ver="$libmikmod_maj.$libmikmod_min.$libmikmod_rev"
294+
CFLAGS_SAVED="$CFLAGS"
295+
LIBS_SAVED="$LIBS"
294296
AC_PATH_PROG(LIBMIKMOD_CONFIG, libmikmod-config, no, [$PATH])
295297
if test "$LIBMIKMOD_CONFIG" != "no" ; then
296-
297-
CFLAGS_SAVED="$CFLAGS"
298-
LIBS_SAVED="$LIBS"
299298
CFLAGS="$CFLAGS `$LIBMIKMOD_CONFIG --cflags`"
300299
LIBS="$LIBS `$LIBMIKMOD_CONFIG --libs`"
301300
have_libmikmod=yes
@@ -315,8 +314,7 @@ if(ver>=((maj<<16)|(min<<8)|(rev))) {
315314
printf("no\n*** libmikmod is older than %d.%d.%d, not using.\n",maj,min,rev);
316315
return 1;
317316
}
318-
], [], have_libmikmod=no; CFLAGS="$CFLAGS_SAVED"; LIBS="$LIBS_SAVED",
319-
[echo $ac_n "cross compiling; assumed OK... $ac_c"])
317+
], [], [have_libmikmod=no], [echo $ac_n "cross compiling; assumed OK... $ac_c"])
320318
fi
321319

322320
if test x$have_libmikmod = xyes; then
@@ -344,6 +342,8 @@ return 1;
344342
else
345343
AC_MSG_WARN([*** Unable to find MikMod library (http://mikmod.raphnet.net/)])
346344
fi
345+
LIBS="$LIBS_SAVED"
346+
CFLAGS="$CFLAGS_SAVED"
347347
fi
348348

349349
if test x$have_libmodplug != xyes -a x$have_libmikmod != xyes ; then
@@ -448,9 +448,10 @@ AC_ARG_ENABLE([music-ogg-shared],
448448
AC_HELP_STRING([--enable-music-ogg-shared], [dynamically load Ogg Vorbis library [[default=yes]]]),
449449
[], [enable_music_ogg_shared=yes])
450450
if test x$enable_music_ogg = xyes; then
451+
LIBS_SAVED="$LIBS"
451452
if test x$enable_music_ogg_tremor = xyes; then
452453
AC_CHECK_HEADER([tremor/ivorbisfile.h], [have_tremor_hdr=yes])
453-
AC_CHECK_LIB([vorbisidec -logg], [ov_open_callbacks], [have_tremor_lib=yes])
454+
AC_CHECK_LIB([vorbisidec], [ov_open_callbacks], [have_tremor_lib=yes], [], [-logg])
454455
if test x$have_tremor_hdr = xyes -a x$have_tremor_lib = xyes; then
455456
case "$host" in
456457
*-*-darwin*)
@@ -479,7 +480,7 @@ if test x$enable_music_ogg = xyes; then
479480
fi
480481
else
481482
AC_CHECK_HEADER([vorbis/vorbisfile.h], [have_ogg_hdr=yes])
482-
AC_CHECK_LIB([vorbisfile -lvorbis -logg -lm], [ov_open_callbacks], [have_ogg_lib=yes])
483+
AC_CHECK_LIB([vorbisfile], [ov_open_callbacks], [have_ogg_lib=yes], [], [-lvorbis -logg -lm])
483484
if test x$have_ogg_hdr = xyes -a x$have_ogg_lib = xyes; then
484485
case "$host" in
485486
*-*-darwin*)
@@ -507,6 +508,7 @@ if test x$enable_music_ogg = xyes; then
507508
AC_MSG_WARN([Ogg Vorbis support disabled])
508509
fi
509510
fi
511+
LIBS="$LIBS_SAVED"
510512
fi
511513

512514
libflac_ver=8
@@ -590,9 +592,9 @@ if test x$enable_music_mp3 = xyes -a x$enable_music_mp3_mad_gpl = xyes; then
590592
AC_MSG_RESULT($have_libmad)
591593
if test x$have_libmad = xyes; then
592594
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MP3_MAD"
593-
if test x$enable_music_mp3_mad_gpl_dithering = xyes; then
595+
if test x$enable_music_mp3_mad_gpl_dithering = xyes; then
594596
AC_MSG_WARN([*** Using GPL libmad and MP3 dithering routines, this build of SDL_mixer is now under the GPL])
595-
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MP3_MAD_GPL_DITHERING"
597+
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MP3_MAD_GPL_DITHERING"
596598
fi
597599
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmad"
598600
else
@@ -649,13 +651,15 @@ AC_ARG_ENABLE([music-opus-shared],
649651
AC_HELP_STRING([--enable-music-opus-shared], [dynamically load opusfile library [[default=yes]]]),
650652
[], [enable_music_opus_shared=yes])
651653
if test x$enable_music_opus = xyes; then
654+
LIBS_SAVED="$LIBS"
652655
PKG_CHECK_MODULES([OPUSFILE], [opusfile >= 0.2], [dnl
653656
have_opusfile_hdr=yes
654657
have_opusfile_lib=yes
655658
], [dnl
656659
AC_CHECK_HEADER([opus/opusfile.h], [have_opusfile_hdr=yes])
657-
AC_CHECK_LIB([opusfile], [op_open_callbacks], [have_opusfile_lib=yes])
660+
AC_CHECK_LIB([opusfile], [op_open_callbacks], [have_opusfile_lib=yes;OPUSFILE_LIBS="-lopusfile -lopus"], [], [-lopus -logg -lm])
658661
])
662+
LIBS="$LIBS_SAVED"
659663

660664
if test x$have_opusfile_hdr = xyes -a x$have_opusfile_lib = xyes; then
661665
have_opusfile=yes

0 commit comments

Comments
 (0)