configury update:
authorOzkan Sezer <sezeroz@gmail.com>
Sun, 14 Oct 2018 14:04:24 +0300
changeset 91002a340e4c6b6
parent 906 ecf275e9b512
child 912 eafae213d7a2
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.
configure
configure.in
     1.1 --- a/configure	Sat Oct 13 17:20:29 2018 +0300
     1.2 +++ b/configure	Sun Oct 14 14:04:24 2018 +0300
     1.3 @@ -11859,7 +11859,7 @@
     1.4  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_modplug_ModPlug_Load" >&5
     1.5  $as_echo "$ac_cv_lib_modplug_ModPlug_Load" >&6; }
     1.6  if test "x$ac_cv_lib_modplug_ModPlug_Load" = xyes; then :
     1.7 -  have_libmodplug_lib=yes
     1.8 +  have_libmodplug_lib=yes;MODPLUG_LIBS="-lmodplug"
     1.9  fi
    1.10  
    1.11  
    1.12 @@ -11907,7 +11907,7 @@
    1.13  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_modplug_ModPlug_Load" >&5
    1.14  $as_echo "$ac_cv_lib_modplug_ModPlug_Load" >&6; }
    1.15  if test "x$ac_cv_lib_modplug_ModPlug_Load" = xyes; then :
    1.16 -  have_libmodplug_lib=yes
    1.17 +  have_libmodplug_lib=yes;MODPLUG_LIBS="-lmodplug"
    1.18  fi
    1.19  
    1.20  
    1.21 @@ -11970,6 +11970,8 @@
    1.22      libmikmod_min=1
    1.23      libmikmod_rev=10
    1.24      libmikmod_ver="$libmikmod_maj.$libmikmod_min.$libmikmod_rev"
    1.25 +    CFLAGS_SAVED="$CFLAGS"
    1.26 +    LIBS_SAVED="$LIBS"
    1.27      # Extract the first word of "libmikmod-config", so it can be a program name with args.
    1.28  set dummy libmikmod-config; ac_word=$2
    1.29  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    1.30 @@ -12012,9 +12014,6 @@
    1.31  
    1.32  
    1.33      if test "$LIBMIKMOD_CONFIG" != "no" ; then
    1.34 -
    1.35 -        CFLAGS_SAVED="$CFLAGS"
    1.36 -        LIBS_SAVED="$LIBS"
    1.37          CFLAGS="$CFLAGS `$LIBMIKMOD_CONFIG --cflags`"
    1.38          LIBS="$LIBS `$LIBMIKMOD_CONFIG --libs`"
    1.39          have_libmikmod=yes
    1.40 @@ -12045,7 +12044,7 @@
    1.41  if ac_fn_c_try_run "$LINENO"; then :
    1.42  
    1.43  else
    1.44 -  have_libmikmod=no; CFLAGS="$CFLAGS_SAVED"; LIBS="$LIBS_SAVED"
    1.45 +  have_libmikmod=no
    1.46  fi
    1.47  rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
    1.48    conftest.$ac_objext conftest.beam conftest.$ac_ext
    1.49 @@ -12079,6 +12078,8 @@
    1.50          { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** Unable to find MikMod library (http://mikmod.raphnet.net/)" >&5
    1.51  $as_echo "$as_me: WARNING: *** Unable to find MikMod library (http://mikmod.raphnet.net/)" >&2;}
    1.52      fi
    1.53 +    LIBS="$LIBS_SAVED"
    1.54 +    CFLAGS="$CFLAGS_SAVED"
    1.55  fi
    1.56  
    1.57  if test x$have_libmodplug != xyes -a x$have_libmikmod != xyes ; then
    1.58 @@ -12263,6 +12264,7 @@
    1.59  fi
    1.60  
    1.61  if test x$enable_music_ogg = xyes; then
    1.62 +    LIBS_SAVED="$LIBS"
    1.63      if test x$enable_music_ogg_tremor = xyes; then
    1.64          ac_fn_c_check_header_mongrel "$LINENO" "tremor/ivorbisfile.h" "ac_cv_header_tremor_ivorbisfile_h" "$ac_includes_default"
    1.65  if test "x$ac_cv_header_tremor_ivorbisfile_h" = xyes; then :
    1.66 @@ -12270,14 +12272,13 @@
    1.67  fi
    1.68  
    1.69  
    1.70 -        as_ac_Lib=`$as_echo "ac_cv_lib_vorbisidec -logg''_ov_open_callbacks" | $as_tr_sh`
    1.71 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ov_open_callbacks in -lvorbisidec -logg" >&5
    1.72 -$as_echo_n "checking for ov_open_callbacks in -lvorbisidec -logg... " >&6; }
    1.73 -if eval \${$as_ac_Lib+:} false; then :
    1.74 +        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ov_open_callbacks in -lvorbisidec" >&5
    1.75 +$as_echo_n "checking for ov_open_callbacks in -lvorbisidec... " >&6; }
    1.76 +if ${ac_cv_lib_vorbisidec_ov_open_callbacks+:} false; then :
    1.77    $as_echo_n "(cached) " >&6
    1.78  else
    1.79    ac_check_lib_save_LIBS=$LIBS
    1.80 -LIBS="-lvorbisidec -logg  $LIBS"
    1.81 +LIBS="-lvorbisidec -logg $LIBS"
    1.82  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    1.83  /* end confdefs.h.  */
    1.84  
    1.85 @@ -12297,18 +12298,17 @@
    1.86  }
    1.87  _ACEOF
    1.88  if ac_fn_c_try_link "$LINENO"; then :
    1.89 -  eval "$as_ac_Lib=yes"
    1.90 -else
    1.91 -  eval "$as_ac_Lib=no"
    1.92 +  ac_cv_lib_vorbisidec_ov_open_callbacks=yes
    1.93 +else
    1.94 +  ac_cv_lib_vorbisidec_ov_open_callbacks=no
    1.95  fi
    1.96  rm -f core conftest.err conftest.$ac_objext \
    1.97      conftest$ac_exeext conftest.$ac_ext
    1.98  LIBS=$ac_check_lib_save_LIBS
    1.99  fi
   1.100 -eval ac_res=\$$as_ac_Lib
   1.101 -	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
   1.102 -$as_echo "$ac_res" >&6; }
   1.103 -if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   1.104 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_vorbisidec_ov_open_callbacks" >&5
   1.105 +$as_echo "$ac_cv_lib_vorbisidec_ov_open_callbacks" >&6; }
   1.106 +if test "x$ac_cv_lib_vorbisidec_ov_open_callbacks" = xyes; then :
   1.107    have_tremor_lib=yes
   1.108  fi
   1.109  
   1.110 @@ -12347,14 +12347,13 @@
   1.111  fi
   1.112  
   1.113  
   1.114 -        as_ac_Lib=`$as_echo "ac_cv_lib_vorbisfile -lvorbis -logg -lm''_ov_open_callbacks" | $as_tr_sh`
   1.115 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ov_open_callbacks in -lvorbisfile -lvorbis -logg -lm" >&5
   1.116 -$as_echo_n "checking for ov_open_callbacks in -lvorbisfile -lvorbis -logg -lm... " >&6; }
   1.117 -if eval \${$as_ac_Lib+:} false; then :
   1.118 +        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ov_open_callbacks in -lvorbisfile" >&5
   1.119 +$as_echo_n "checking for ov_open_callbacks in -lvorbisfile... " >&6; }
   1.120 +if ${ac_cv_lib_vorbisfile_ov_open_callbacks+:} false; then :
   1.121    $as_echo_n "(cached) " >&6
   1.122  else
   1.123    ac_check_lib_save_LIBS=$LIBS
   1.124 -LIBS="-lvorbisfile -lvorbis -logg -lm  $LIBS"
   1.125 +LIBS="-lvorbisfile -lvorbis -logg -lm $LIBS"
   1.126  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
   1.127  /* end confdefs.h.  */
   1.128  
   1.129 @@ -12374,18 +12373,17 @@
   1.130  }
   1.131  _ACEOF
   1.132  if ac_fn_c_try_link "$LINENO"; then :
   1.133 -  eval "$as_ac_Lib=yes"
   1.134 -else
   1.135 -  eval "$as_ac_Lib=no"
   1.136 +  ac_cv_lib_vorbisfile_ov_open_callbacks=yes
   1.137 +else
   1.138 +  ac_cv_lib_vorbisfile_ov_open_callbacks=no
   1.139  fi
   1.140  rm -f core conftest.err conftest.$ac_objext \
   1.141      conftest$ac_exeext conftest.$ac_ext
   1.142  LIBS=$ac_check_lib_save_LIBS
   1.143  fi
   1.144 -eval ac_res=\$$as_ac_Lib
   1.145 -	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
   1.146 -$as_echo "$ac_res" >&6; }
   1.147 -if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   1.148 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_vorbisfile_ov_open_callbacks" >&5
   1.149 +$as_echo "$ac_cv_lib_vorbisfile_ov_open_callbacks" >&6; }
   1.150 +if test "x$ac_cv_lib_vorbisfile_ov_open_callbacks" = xyes; then :
   1.151    have_ogg_lib=yes
   1.152  fi
   1.153  
   1.154 @@ -12418,6 +12416,7 @@
   1.155  $as_echo "$as_me: WARNING: Ogg Vorbis support disabled" >&2;}
   1.156          fi
   1.157      fi
   1.158 +    LIBS="$LIBS_SAVED"
   1.159  fi
   1.160  
   1.161  libflac_ver=8
   1.162 @@ -12605,10 +12604,10 @@
   1.163  $as_echo "$have_libmad" >&6; }
   1.164      if test x$have_libmad = xyes; then
   1.165          EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MP3_MAD"
   1.166 -		if test x$enable_music_mp3_mad_gpl_dithering = xyes; then
   1.167 +        if test x$enable_music_mp3_mad_gpl_dithering = xyes; then
   1.168              { $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
   1.169  $as_echo "$as_me: WARNING: *** Using GPL libmad and MP3 dithering routines, this build of SDL_mixer is now under the GPL" >&2;}
   1.170 -			EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MP3_MAD_GPL_DITHERING"
   1.171 +            EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MP3_MAD_GPL_DITHERING"
   1.172          fi
   1.173          EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmad"
   1.174      else
   1.175 @@ -12729,6 +12728,7 @@
   1.176  fi
   1.177  
   1.178  if test x$enable_music_opus = xyes; then
   1.179 +    LIBS_SAVED="$LIBS"
   1.180  
   1.181  pkg_failed=no
   1.182  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OPUSFILE" >&5
   1.183 @@ -12802,7 +12802,7 @@
   1.184    $as_echo_n "(cached) " >&6
   1.185  else
   1.186    ac_check_lib_save_LIBS=$LIBS
   1.187 -LIBS="-lopusfile  $LIBS"
   1.188 +LIBS="-lopusfile -lopus -logg -lm $LIBS"
   1.189  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
   1.190  /* end confdefs.h.  */
   1.191  
   1.192 @@ -12833,7 +12833,7 @@
   1.193  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_opusfile_op_open_callbacks" >&5
   1.194  $as_echo "$ac_cv_lib_opusfile_op_open_callbacks" >&6; }
   1.195  if test "x$ac_cv_lib_opusfile_op_open_callbacks" = xyes; then :
   1.196 -  have_opusfile_lib=yes
   1.197 +  have_opusfile_lib=yes;OPUSFILE_LIBS="-lopusfile -lopus"
   1.198  fi
   1.199  
   1.200  
   1.201 @@ -12850,7 +12850,7 @@
   1.202    $as_echo_n "(cached) " >&6
   1.203  else
   1.204    ac_check_lib_save_LIBS=$LIBS
   1.205 -LIBS="-lopusfile  $LIBS"
   1.206 +LIBS="-lopusfile -lopus -logg -lm $LIBS"
   1.207  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
   1.208  /* end confdefs.h.  */
   1.209  
   1.210 @@ -12881,7 +12881,7 @@
   1.211  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_opusfile_op_open_callbacks" >&5
   1.212  $as_echo "$ac_cv_lib_opusfile_op_open_callbacks" >&6; }
   1.213  if test "x$ac_cv_lib_opusfile_op_open_callbacks" = xyes; then :
   1.214 -  have_opusfile_lib=yes
   1.215 +  have_opusfile_lib=yes;OPUSFILE_LIBS="-lopusfile -lopus"
   1.216  fi
   1.217  
   1.218  
   1.219 @@ -12894,6 +12894,7 @@
   1.220              have_opusfile_lib=yes
   1.221  
   1.222  fi
   1.223 +    LIBS="$LIBS_SAVED"
   1.224  
   1.225      if test x$have_opusfile_hdr = xyes -a x$have_opusfile_lib = xyes; then
   1.226          have_opusfile=yes
     2.1 --- a/configure.in	Sat Oct 13 17:20:29 2018 +0300
     2.2 +++ b/configure.in	Sun Oct 14 14:04:24 2018 +0300
     2.3 @@ -110,7 +110,7 @@
     2.4          DEPENDENCY_TRACKING_OPTIONS="-MMD -MT \$@"
     2.5      fi
     2.6  fi
     2.7 -    
     2.8 +
     2.9  case "$host" in
    2.10      *mingw32ce*)
    2.11          #VERSION_SOURCES="$srcdir/version.rc"
    2.12 @@ -248,7 +248,7 @@
    2.13              have_libmodplug_lib=yes
    2.14          ], [dnl
    2.15              AC_CHECK_HEADER([libmodplug/modplug.h], [have_libmodplug_hdr=yes])
    2.16 -            AC_CHECK_LIB([modplug], [ModPlug_Load], [have_libmodplug_lib=yes])
    2.17 +            AC_CHECK_LIB([modplug], [ModPlug_Load], [have_libmodplug_lib=yes;MODPLUG_LIBS="-lmodplug"])
    2.18          ])
    2.19  
    2.20      if test x$have_libmodplug_hdr = xyes -a x$have_libmodplug_lib = xyes; then
    2.21 @@ -291,11 +291,10 @@
    2.22      libmikmod_min=1
    2.23      libmikmod_rev=10
    2.24      libmikmod_ver="$libmikmod_maj.$libmikmod_min.$libmikmod_rev"
    2.25 +    CFLAGS_SAVED="$CFLAGS"
    2.26 +    LIBS_SAVED="$LIBS"
    2.27      AC_PATH_PROG(LIBMIKMOD_CONFIG, libmikmod-config, no, [$PATH])
    2.28      if test "$LIBMIKMOD_CONFIG" != "no" ; then
    2.29 -        
    2.30 -        CFLAGS_SAVED="$CFLAGS"
    2.31 -        LIBS_SAVED="$LIBS"
    2.32          CFLAGS="$CFLAGS `$LIBMIKMOD_CONFIG --cflags`"
    2.33          LIBS="$LIBS `$LIBMIKMOD_CONFIG --libs`"
    2.34          have_libmikmod=yes
    2.35 @@ -315,8 +314,7 @@
    2.36  printf("no\n*** libmikmod is older than %d.%d.%d, not using.\n",maj,min,rev);
    2.37  return 1;
    2.38  }
    2.39 -], [], have_libmikmod=no; CFLAGS="$CFLAGS_SAVED"; LIBS="$LIBS_SAVED",
    2.40 -        [echo $ac_n "cross compiling; assumed OK... $ac_c"])
    2.41 +], [], [have_libmikmod=no], [echo $ac_n "cross compiling; assumed OK... $ac_c"])
    2.42      fi
    2.43  
    2.44      if test x$have_libmikmod = xyes; then
    2.45 @@ -344,6 +342,8 @@
    2.46      else
    2.47          AC_MSG_WARN([*** Unable to find MikMod library (http://mikmod.raphnet.net/)])
    2.48      fi
    2.49 +    LIBS="$LIBS_SAVED"
    2.50 +    CFLAGS="$CFLAGS_SAVED"
    2.51  fi
    2.52  
    2.53  if test x$have_libmodplug != xyes -a x$have_libmikmod != xyes ; then
    2.54 @@ -448,9 +448,10 @@
    2.55  AC_HELP_STRING([--enable-music-ogg-shared], [dynamically load Ogg Vorbis library [[default=yes]]]),
    2.56                [], [enable_music_ogg_shared=yes])
    2.57  if test x$enable_music_ogg = xyes; then
    2.58 +    LIBS_SAVED="$LIBS"
    2.59      if test x$enable_music_ogg_tremor = xyes; then
    2.60          AC_CHECK_HEADER([tremor/ivorbisfile.h], [have_tremor_hdr=yes])
    2.61 -        AC_CHECK_LIB([vorbisidec -logg], [ov_open_callbacks], [have_tremor_lib=yes])
    2.62 +        AC_CHECK_LIB([vorbisidec], [ov_open_callbacks], [have_tremor_lib=yes], [], [-logg])
    2.63          if test x$have_tremor_hdr = xyes -a x$have_tremor_lib = xyes; then
    2.64              case "$host" in
    2.65                  *-*-darwin*)
    2.66 @@ -479,7 +480,7 @@
    2.67          fi
    2.68      else
    2.69          AC_CHECK_HEADER([vorbis/vorbisfile.h], [have_ogg_hdr=yes])
    2.70 -        AC_CHECK_LIB([vorbisfile -lvorbis -logg -lm], [ov_open_callbacks], [have_ogg_lib=yes])
    2.71 +        AC_CHECK_LIB([vorbisfile], [ov_open_callbacks], [have_ogg_lib=yes], [], [-lvorbis -logg -lm])
    2.72          if test x$have_ogg_hdr = xyes -a x$have_ogg_lib = xyes; then
    2.73              case "$host" in
    2.74                  *-*-darwin*)
    2.75 @@ -507,6 +508,7 @@
    2.76              AC_MSG_WARN([Ogg Vorbis support disabled])
    2.77          fi
    2.78      fi
    2.79 +    LIBS="$LIBS_SAVED"
    2.80  fi
    2.81  
    2.82  libflac_ver=8
    2.83 @@ -590,9 +592,9 @@
    2.84      AC_MSG_RESULT($have_libmad)
    2.85      if test x$have_libmad = xyes; then
    2.86          EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MP3_MAD"
    2.87 -		if test x$enable_music_mp3_mad_gpl_dithering = xyes; then
    2.88 +        if test x$enable_music_mp3_mad_gpl_dithering = xyes; then
    2.89              AC_MSG_WARN([*** Using GPL libmad and MP3 dithering routines, this build of SDL_mixer is now under the GPL])
    2.90 -			EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MP3_MAD_GPL_DITHERING"
    2.91 +            EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MP3_MAD_GPL_DITHERING"
    2.92          fi
    2.93          EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmad"
    2.94      else
    2.95 @@ -649,13 +651,15 @@
    2.96  AC_HELP_STRING([--enable-music-opus-shared], [dynamically load opusfile library [[default=yes]]]),
    2.97                [], [enable_music_opus_shared=yes])
    2.98  if test x$enable_music_opus = xyes; then
    2.99 +    LIBS_SAVED="$LIBS"
   2.100      PKG_CHECK_MODULES([OPUSFILE], [opusfile >= 0.2], [dnl
   2.101              have_opusfile_hdr=yes
   2.102              have_opusfile_lib=yes
   2.103          ], [dnl
   2.104              AC_CHECK_HEADER([opus/opusfile.h], [have_opusfile_hdr=yes])
   2.105 -            AC_CHECK_LIB([opusfile], [op_open_callbacks], [have_opusfile_lib=yes])
   2.106 +            AC_CHECK_LIB([opusfile], [op_open_callbacks], [have_opusfile_lib=yes;OPUSFILE_LIBS="-lopusfile -lopus"], [], [-lopus -logg -lm])
   2.107          ])
   2.108 +    LIBS="$LIBS_SAVED"
   2.109  
   2.110      if test x$have_opusfile_hdr = xyes -a x$have_opusfile_lib = xyes; then
   2.111          have_opusfile=yes