comparison acinclude.m4 @ 800:1fe6005ed58c

Make it so that both libSIDPlay2 and libSIDPlay-FP can co-exist, though not at run-time, but either one can be chosen via --with-/--without- configure options.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 07 Nov 2012 11:58:46 +0200
parents 3e305ce076e8
children ae1f6418d093
comparison
equal deleted inserted replaced
799:13483b855058 800:1fe6005ed58c
185 dnl Try to find SIDPLAY2 library and header files. 185 dnl Try to find SIDPLAY2 library and header files.
186 dnl $xs_have_sidplay2 will be "yes" or "no" 186 dnl $xs_have_sidplay2 will be "yes" or "no"
187 dnl @SIDPLAY_LIBS@ will be substituted with linker parameters 187 dnl @SIDPLAY_LIBS@ will be substituted with linker parameters
188 dnl @SIDPLAY_INCLUDES@ will be substituted with compiler parameters 188 dnl @SIDPLAY_INCLUDES@ will be substituted with compiler parameters
189 dnl ------------------------------------------------------------------------- 189 dnl -------------------------------------------------------------------------
190
191
192 AC_DEFUN([XS_PATH_LIBSIDPLAYFP],
193 [
194 AC_MSG_CHECKING([for working SIDPlayFP library and headers])
195
196 AC_LANG_PUSH([C++])
197
198 PKG_CHECK_EXISTS([libsidplayfp >= 0.3.7], [xs_pkg_sidplayfp="yes"], [])
199
200 if test "x$xs_pkg_sidplayfp" = "xyes"; then
201 AC_CACHE_VAL([xs_cv_have_sidplayfp],
202 [
203 xs_sidplayfp_cflags=`$PKG_CONFIG --libs libsidplayfp`
204 xs_sidplayfp_ldflags=`$PKG_CONFIG --libs libsidplayfp`
205
206 XS_TRY_LIBRARY([sidplayfp],
207 [$xs_sidplayfp_cxxflags -DHAVE_UNIX], [$xs_sidplayfp_ldflags],
208 [sidplayfp], [sidplayfp/sidplay2.h], [sidplay2 *myEngine;])
209
210 if test "x$xs_sidplayfp_works" = "xyes"; then
211 xs_cv_have_sidplayfp="xs_have_sidplayfp=yes \
212 xs_sidplayfp_cxxflags=\"$xs_sidplayfp_cxxflags\" \
213 xs_sidplayfp_ldflags=\"$xs_sidplayfp_ldflags\""
214 fi
215 ])
216 fi
217
218 eval "$xs_cv_have_sidplayfp"
219
220 if test "x$xs_have_sidplayfp" = "xyes"; then
221 if test "x$xs_sidplayfp_cxxflags" != "x" || test "x$xs_sidplayfp_ldflags" != "x"; then
222 AC_MSG_RESULT([$xs_sidplayfp_cxxflags $xs_sidplayfp_ldflags])
223 else
224 AC_MSG_RESULT([yes])
225 fi
226
227 SIDPLAY2_LIBS="$xs_sidplayfp_ldflags"
228 SIDPLAY2_CFLAGS="$xs_sidplayfp_cxxflags"
229 AC_SUBST([SIDPLAY2_LIBS])dnl
230 AC_SUBST([SIDPLAY2_CFLAGS])dnl
231 else
232 AC_MSG_RESULT([no])
233 fi
234
235 AC_LANG_POP([C++])
236 ])
237
238
239
240
190 AC_DEFUN([XS_PATH_LIBSIDPLAY2], 241 AC_DEFUN([XS_PATH_LIBSIDPLAY2],
191 [ 242 [
192 AC_MSG_CHECKING([for working SIDPlay2/FP library and headers]) 243 AC_MSG_CHECKING([for working SIDPlay2 library and headers])
193 244
194 AC_LANG_PUSH([C++]) 245 AC_LANG_PUSH([C++])
195 246
196 PKG_CHECK_EXISTS([libsidplay2 >= 2.1.1], [xs_pkg_sidplay2="yes"], []) 247 PKG_CHECK_EXISTS([libsidplay2 >= 2.1.1], [xs_pkg_sidplay2="yes"], [])
197 PKG_CHECK_EXISTS([libsidplayfp >= 0.3.7], [xs_pkg_sidplayfp="yes"], []) 248
198 249 if test "x$xs_pkg_sidplay2" = "xyes"; then
199 if test "x$xs_pkg_sidplayfp" = "xyes"; then
200 AC_CACHE_VAL([xs_cv_have_sidplayfp],
201 [
202 xs_sidplay2_cflags=`$PKG_CONFIG --libs libsidplayfp`
203 xs_sidplay2_ldflags=`$PKG_CONFIG --libs libsidplayfp`
204
205 XS_TRY_LIBRARY([sidplay2],
206 [$xs_sidplay2_cxxflags -DHAVE_UNIX], [$xs_sidplay2_ldflags],
207 [sidplayfp], [sidplayfp/sidplay2.h], [sidplay2 *myEngine;])
208
209 if test "x$xs_sidplay2_works" = "xyes"; then
210 xs_cv_have_sidplay2="xs_have_sidplayfp=yes \
211 xs_sidplay2_cxxflags=\"$xs_sidplay2_cxxflags\" \
212 xs_sidplay2_ldflags=\"$xs_sidplay2_ldflags\""
213 fi
214 ])
215
216 elif test "x$xs_pkg_sidplay2" = "xyes"; then
217 250
218 AC_CACHE_VAL([xs_cv_have_sidplay2], 251 AC_CACHE_VAL([xs_cv_have_sidplay2],
219 [ 252 [
220 xs_sidplay2_cflags=`$PKG_CONFIG --libs libsidplay2` 253 xs_sidplay2_cflags=`$PKG_CONFIG --libs libsidplay2`
221 xs_sidplay2_ldflags=`$PKG_CONFIG --libs libsidplay2` 254 xs_sidplay2_ldflags=`$PKG_CONFIG --libs libsidplay2`
254 fi 287 fi
255 ]) 288 ])
256 fi 289 fi
257 290
258 eval "$xs_cv_have_sidplay2" 291 eval "$xs_cv_have_sidplay2"
259 eval "$xs_cv_have_sidplayfp" 292
260 293 if test "x$xs_have_sidplay2" = "xyes"; then
261 if test "x$xs_have_sidplay2" = "xyes" -o "x$xs_have_sidplayfp" = "xyes"; then
262 if test "x$xs_sidplay2_cxxflags" != "x" || test "x$xs_sidplay2_ldflags" != "x"; then 294 if test "x$xs_sidplay2_cxxflags" != "x" || test "x$xs_sidplay2_ldflags" != "x"; then
263 AC_MSG_RESULT([$xs_sidplay2_cxxflags $xs_sidplay2_ldflags]) 295 AC_MSG_RESULT([$xs_sidplay2_cxxflags $xs_sidplay2_ldflags])
264 else 296 else
265 AC_MSG_RESULT([yes]) 297 AC_MSG_RESULT([yes])
266 fi 298 fi