Fixed the padtemplate definition.
[platform/upstream/gstreamer.git] / acinclude.m4
1 dnl Configure Paths for Alsa
2 dnl Some modifications by Richard Boulton <richard-alsa@tartarus.org>
3 dnl Christopher Lansdown <lansdoct@cs.alfred.edu>
4 dnl Jaroslav Kysela <perex@suse.cz>
5 dnl Last modification: 07/01/2001
6 dnl AM_PATH_ALSA([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
7 dnl Test for libasound, and define ALSA_CFLAGS and ALSA_LIBS as appropriate.
8 dnl enables arguments --with-alsa-prefix=
9 dnl                   --with-alsa-enc-prefix=
10 dnl                   --disable-alsatest  (this has no effect, as yet)
11 dnl
12 dnl For backwards compatibility, if ACTION_IF_NOT_FOUND is not specified,
13 dnl and the alsa libraries are not found, a fatal AC_MSG_ERROR() will result.
14 dnl
15 AC_DEFUN(AM_PATH_ALSA,
16 [dnl Save the original CFLAGS, LDFLAGS, and LIBS
17 alsa_save_CFLAGS="$CFLAGS"
18 alsa_save_LDFLAGS="$LDFLAGS"
19 alsa_save_LIBS="$LIBS"
20 alsa_found=yes
21
22 dnl
23 dnl Get the cflags and libraries for alsa
24 dnl
25 AC_ARG_WITH(alsa-prefix,
26 [  --with-alsa-prefix=PFX  Prefix where Alsa library is installed(optional)],
27 [alsa_prefix="$withval"], [alsa_prefix=""])
28
29 AC_ARG_WITH(alsa-inc-prefix,
30 [  --with-alsa-inc-prefix=PFX  Prefix where include libraries are (optional)],
31 [alsa_inc_prefix="$withval"], [alsa_inc_prefix=""])
32
33 dnl FIXME: this is not yet implemented
34 AC_ARG_ENABLE(alsatest,
35 [  --disable-alsatest      Do not try to compile and run a test Alsa program],
36 [enable_alsatest=no],
37 [enable_alsatest=yes])
38
39 dnl Add any special include directories
40 AC_MSG_CHECKING(for ALSA CFLAGS)
41 if test "$alsa_inc_prefix" != "" ; then
42         ALSA_CFLAGS="$ALSA_CFLAGS -I$alsa_inc_prefix"
43         CFLAGS="$CFLAGS -I$alsa_inc_prefix"
44 fi
45 AC_MSG_RESULT($ALSA_CFLAGS)
46
47 dnl add any special lib dirs
48 AC_MSG_CHECKING(for ALSA LDFLAGS)
49 if test "$alsa_prefix" != "" ; then
50         ALSA_LIBS="$ALSA_LIBS -L$alsa_prefix"
51         LDFLAGS="$LDFLAGS $ALSA_LIBS"
52 fi
53
54 dnl add the alsa library
55 ALSA_LIBS="$ALSA_LIBS -lasound -lm -ldl"
56 LIBS=`echo $LIBS | sed 's/-lm//'`
57 LIBS=`echo $LIBS | sed 's/-ldl//'`
58 LIBS=`echo $LIBS | sed 's/  //'`
59 LIBS="$ALSA_LIBS $LIBS"
60 AC_MSG_RESULT($ALSA_LIBS)
61
62 dnl Check for a working version of libasound that is of the right version.
63 min_alsa_version=ifelse([$1], ,0.1.1,$1)
64 AC_MSG_CHECKING(for libasound headers version >= $min_alsa_version)
65 no_alsa=""
66     alsa_min_major_version=`echo $min_alsa_version | \
67            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
68     alsa_min_minor_version=`echo $min_alsa_version | \
69            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
70     alsa_min_micro_version=`echo $min_alsa_version | \
71            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
72
73 AC_LANG_SAVE
74 AC_LANG_C
75 AC_TRY_COMPILE([
76 #include <sys/asoundlib.h>
77 ], [
78 void main(void)
79 {
80 /* ensure backward compatibility */
81 #if !defined(SND_LIB_MAJOR) && defined(SOUNDLIB_VERSION_MAJOR)
82 #define SND_LIB_MAJOR SOUNDLIB_VERSION_MAJOR
83 #endif
84 #if !defined(SND_LIB_MINOR) && defined(SOUNDLIB_VERSION_MINOR)
85 #define SND_LIB_MINOR SOUNDLIB_VERSION_MINOR
86 #endif
87 #if !defined(SND_LIB_SUBMINOR) && defined(SOUNDLIB_VERSION_SUBMINOR)
88 #define SND_LIB_SUBMINOR SOUNDLIB_VERSION_SUBMINOR
89 #endif
90
91 #  if(SND_LIB_MAJOR > $alsa_min_major_version)
92   exit(0);
93 #  else
94 #    if(SND_LIB_MAJOR < $alsa_min_major_version)
95 #       error not present
96 #    endif
97
98 #   if(SND_LIB_MINOR > $alsa_min_minor_version)
99   exit(0);
100 #   else
101 #     if(SND_LIB_MINOR < $alsa_min_minor_version)
102 #          error not present
103 #      endif
104
105 #      if(SND_LIB_SUBMINOR < $alsa_min_micro_version)
106 #        error not present
107 #      endif
108 #    endif
109 #  endif
110 exit(0);
111 }
112 ],
113   [AC_MSG_RESULT(found.)],
114   [AC_MSG_RESULT(not present.)
115    ifelse([$3], , [AC_MSG_ERROR(Sufficiently new version of libasound not found.)])
116    alsa_found=no]
117 )
118 AC_LANG_RESTORE
119
120 dnl Now that we know that we have the right version, let's see if we have the library and not just the headers.
121 AC_CHECK_LIB([asound], [snd_defaults_card],,
122         [ifelse([$3], , [AC_MSG_ERROR(No linkable libasound was found.)])
123          alsa_found=no]
124 )
125
126 if test "x$alsa_found" = "xyes" ; then
127    ifelse([$2], , :, [$2])
128    LIBS=`echo $LIBS | sed 's/-lasound//g'`
129    LIBS=`echo $LIBS | sed 's/  //'`
130    LIBS="-lasound $LIBS"
131 fi
132 if test "x$alsa_found" = "xno" ; then
133    ifelse([$3], , :, [$3])
134    CFLAGS="$alsa_save_CFLAGS"
135    LDFLAGS="$alsa_save_LDFLAGS"
136    LIBS="$alsa_save_LIBS"
137    ALSA_CFLAGS=""
138    ALSA_LIBS=""
139 fi
140
141 dnl That should be it.  Now just export out symbols:
142 AC_SUBST(ALSA_CFLAGS)
143 AC_SUBST(ALSA_LIBS)
144 ])
145
146 # CFLAGS and library paths for XMMS
147 # written 15 December 1999 by Ben Gertzfield <che@debian.org>
148
149 dnl Usage:
150 dnl AM_PATH_XMMS([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
151 dnl
152 dnl Example:
153 dnl AM_PATH_XMMS(0.9.5.1, , AC_MSG_ERROR([*** XMMS >= 0.9.5.1 not installed - please install first ***]))
154 dnl
155 dnl Defines XMMS_CFLAGS, XMMS_LIBS, XMMS_DATA_DIR, XMMS_PLUGIN_DIR, 
156 dnl XMMS_VISUALIZATION_PLUGIN_DIR, XMMS_INPUT_PLUGIN_DIR, 
157 dnl XMMS_OUTPUT_PLUGIN_DIR, XMMS_GENERAL_PLUGIN_DIR, XMMS_EFFECT_PLUGIN_DIR,
158 dnl and XMMS_VERSION for your plugin pleasure.
159 dnl
160
161 dnl XMMS_TEST_VERSION(AVAILABLE-VERSION, NEEDED-VERSION [, ACTION-IF-OKAY [, ACTION-IF-NOT-OKAY]])
162 AC_DEFUN(XMMS_TEST_VERSION, [
163
164 # Determine which version number is greater. Prints 2 to stdout if      
165 # the second number is greater, 1 if the first number is greater,       
166 # 0 if the numbers are equal.                                           
167                                                                         
168 # Written 15 December 1999 by Ben Gertzfield <che@debian.org>           
169 # Revised 15 December 1999 by Jim Monty <monty@primenet.com>            
170                                                                         
171     AC_PROG_AWK
172     xmms_got_version=[` $AWK '                                          \
173 BEGIN {                                                                 \
174     print vercmp(ARGV[1], ARGV[2]);                                     \
175 }                                                                       \
176                                                                         \
177 function vercmp(ver1, ver2,    ver1arr, ver2arr,                        \
178                                ver1len, ver2len,                        \
179                                ver1int, ver2int, len, i, p) {           \
180                                                                         \
181     ver1len = split(ver1, ver1arr, /\./);                               \
182     ver2len = split(ver2, ver2arr, /\./);                               \
183                                                                         \
184     len = ver1len > ver2len ? ver1len : ver2len;                        \
185                                                                         \
186     for (i = 1; i <= len; i++) {                                        \
187         p = 1000 ^ (len - i);                                           \
188         ver1int += ver1arr[i] * p;                                      \
189         ver2int += ver2arr[i] * p;                                      \
190     }                                                                   \
191                                                                         \
192     if (ver1int < ver2int)                                              \
193         return 2;                                                       \
194     else if (ver1int > ver2int)                                         \
195         return 1;                                                       \
196     else                                                                \
197         return 0;                                                       \
198 }' $1 $2`]                                                              
199
200     if test $xmms_got_version -eq 2; then       # failure
201         ifelse([$4], , :, $4)                   
202     else                                        # success!
203         ifelse([$3], , :, $3)
204     fi
205 ])
206
207 AC_DEFUN(AM_PATH_XMMS,
208 [
209 AC_ARG_WITH(xmms-prefix,[  --with-xmms-prefix=PFX  Prefix where XMMS is installed (optional)],
210         xmms_config_prefix="$withval", xmms_config_prefix="")
211 AC_ARG_WITH(xmms-exec-prefix,[  --with-xmms-exec-prefix=PFX Exec prefix where XMMS is installed (optional)],
212         xmms_config_exec_prefix="$withval", xmms_config_exec_prefix="")
213
214 if test x$xmms_config_exec_prefix != x; then
215     xmms_config_args="$xmms_config_args --exec-prefix=$xmms_config_exec_prefix"
216     if test x${XMMS_CONFIG+set} != xset; then
217         XMMS_CONFIG=$xmms_config_exec_prefix/bin/xmms-config
218     fi
219 fi
220
221 if test x$xmms_config_prefix != x; then
222     xmms_config_args="$xmms_config_args --prefix=$xmms_config_prefix"
223     if test x${XMMS_CONFIG+set} != xset; then
224         XMMS_CONFIG=$xmms_config_prefix/bin/xmms-config
225     fi
226 fi
227
228 AC_PATH_PROG(XMMS_CONFIG, xmms-config, no)
229 min_xmms_version=ifelse([$1], ,0.9.5.1, $1)
230
231 if test "$XMMS_CONFIG" = "no"; then
232     no_xmms=yes
233 else
234     XMMS_CFLAGS=`$XMMS_CONFIG $xmms_config_args --cflags`
235     XMMS_LIBS=`$XMMS_CONFIG $xmms_config_args --libs`
236     XMMS_VERSION=`$XMMS_CONFIG $xmms_config_args --version`
237     XMMS_DATA_DIR=`$XMMS_CONFIG $xmms_config_args --data-dir`
238     XMMS_PLUGIN_DIR=`$XMMS_CONFIG $xmms_config_args --plugin-dir`
239     XMMS_VISUALIZATION_PLUGIN_DIR=`$XMMS_CONFIG $xmms_config_args \
240                                         --visualization-plugin-dir`
241     XMMS_INPUT_PLUGIN_DIR=`$XMMS_CONFIG $xmms_config_args --input-plugin-dir`
242     XMMS_OUTPUT_PLUGIN_DIR=`$XMMS_CONFIG $xmms_config_args --output-plugin-dir`
243     XMMS_EFFECT_PLUGIN_DIR=`$XMMS_CONFIG $xmms_config_args --effect-plugin-dir`
244     XMMS_GENERAL_PLUGIN_DIR=`$XMMS_CONFIG $xmms_config_args --general-plugin-dir`
245
246     XMMS_TEST_VERSION($XMMS_VERSION, $min_xmms_version, ,no_xmms=version)
247 fi
248
249 AC_MSG_CHECKING(for XMMS - version >= $min_xmms_version)
250
251 if test "x$no_xmms" = x; then
252     AC_MSG_RESULT(yes)
253     ifelse([$2], , :, [$2])
254 else
255     AC_MSG_RESULT(no)
256
257     if test "$XMMS_CONFIG" = "no" ; then
258         echo "*** The xmms-config script installed by XMMS could not be found."
259         echo "*** If XMMS was installed in PREFIX, make sure PREFIX/bin is in"
260         echo "*** your path, or set the XMMS_CONFIG environment variable to the"
261         echo "*** full path to xmms-config."
262     else
263         if test "$no_xmms" = "version"; then
264             echo "*** An old version of XMMS, $XMMS_VERSION, was found."
265             echo "*** You need a version of XMMS newer than $min_xmms_version."
266             echo "*** The latest version of XMMS is always available from"
267             echo "*** http://www.xmms.org/"
268             echo "***"
269
270             echo "*** If you have already installed a sufficiently new version, this error"
271             echo "*** probably means that the wrong copy of the xmms-config shell script is"
272             echo "*** being found. The easiest way to fix this is to remove the old version"
273             echo "*** of XMMS, but you can also set the XMMS_CONFIG environment to point to the"
274             echo "*** correct copy of xmms-config. (In this case, you will have to"
275             echo "*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf"
276             echo "*** so that the correct libraries are found at run-time)"
277         fi
278     fi
279     XMMS_CFLAGS=""
280     XMMS_LIBS=""
281     ifelse([$3], , :, [$3])
282 fi
283 AC_SUBST(XMMS_CFLAGS)
284 AC_SUBST(XMMS_LIBS)
285 AC_SUBST(XMMS_VERSION)
286 AC_SUBST(XMMS_DATA_DIR)
287 AC_SUBST(XMMS_PLUGIN_DIR)
288 AC_SUBST(XMMS_VISUALIZATION_PLUGIN_DIR)
289 AC_SUBST(XMMS_INPUT_PLUGIN_DIR)
290 AC_SUBST(XMMS_OUTPUT_PLUGIN_DIR)
291 AC_SUBST(XMMS_GENERAL_PLUGIN_DIR)
292 AC_SUBST(XMMS_EFFECT_PLUGIN_DIR)
293 ])
294
295
296 dnl Perform a check for a feature for GStreamer
297 dnl Richard Boulton <richard-alsa@tartarus.org>
298 dnl Last modification: 25/06/2001
299 dnl GST_CHECK_FEATURE(FEATURE-NAME, FEATURE-DESCRIPTION,
300 dnl                   DEPENDENT-PLUGINS, TEST-FOR-FEATURE,
301 dnl                   DISABLE-BY-DEFAULT, ACTION-IF-USE, ACTION-IF-NOTUSE)
302 dnl
303 dnl This macro adds a command line argument to enable the user to enable
304 dnl or disable a feature, and if the feature is enabled, performs a supplied
305 dnl test to check if the feature is available.
306 dnl
307 dnl The test should define HAVE_<FEATURE-NAME> to "yes" or "no" depending
308 dnl on whether the feature is available.
309 dnl
310 dnl The macro will set USE_<<FEATURE-NAME> to "yes" or "no" depending on
311 dnl whether the feature is to be used.
312 dnl
313 dnl The macro will call AM_CONDITIONAL(USE_<<FEATURE-NAME>, ...) to allow
314 dnl the feature to control what is built in Makefile.ams.  If you want
315 dnl additional actions resulting from the test, you can add them with the
316 dnl ACTION-IF-USE and ACTION-IF-NOTUSE parameters.
317 dnl 
318 dnl FEATURE-NAME        is the name of the feature, and should be in
319 dnl                     purely upper case characters.
320 dnl FEATURE-DESCRIPTION is used to describe the feature in help text for
321 dnl                     the command line argument.
322 dnl DEPENDENT-PLUGINS   lists any plugins which depend on this feature.
323 dnl TEST-FOR-FEATURE    is a test which sets HAVE_<FEATURE-NAME> to "yes"
324 dnl                     or "no" depending on whether the feature is
325 dnl                     available.
326 dnl DISABLE-BY-DEFAULT  if "disabled", the feature is disabled by default,
327 dnl                     if any other value, the feature is enabled by default.
328 dnl ACTION-IF-USE       any extra actions to perform if the feature is to be
329 dnl                     used.
330 dnl ACTION-IF-NOTUSE    any extra actions to perform if the feature is not to
331 dnl                     be used.
332 dnl
333 AC_DEFUN(GST_CHECK_FEATURE,
334 [dnl
335 builtin(define, [gst_endisable], ifelse($5, [disabled], [enable], [disable]))dnl
336 AC_ARG_ENABLE(translit([$1], A-Z, a-z),
337   [  ]builtin(format, --%-26s gst_endisable %s, gst_endisable-translit([$1], A-Z, a-z), [$2]ifelse([$3],,,: [$3])),
338   [ case "${enableval}" in
339       yes) USE_[$1]=yes ;;
340       no) USE_[$1]=no ;;
341       *) AC_MSG_ERROR(bad value ${enableval} for --enable-translit([$1], A-Z, a-z)) ;;
342     esac],
343   [ USE_$1=]ifelse($5, [disabled], [no], [yes]))           dnl DEFAULT
344
345 dnl *** If it's enabled
346 if test x$USE_[$1] = xyes; then
347   gst_check_save_LIBS=$LIBS
348   gst_check_save_LDFLAGS=$LDFLAGS
349   gst_check_save_CFLAGS=$CFLAGS
350   gst_check_save_CPPFLAGS=$CPPFLAGS
351   gst_check_save_CXXFLAGS=$CXXFLAGS
352   HAVE_[$1]=no
353   $4
354   LIBS=$gst_check_save_LIBS
355   LDFLAGS=$gst_check_save_LDFLAGS
356   CFLAGS=$gst_check_save_CFLAGS
357   CPPFLAGS=$gst_check_save_CPPFLAGS
358   CXXFLAGS=$gst_check_save_CXXFLAGS
359
360   dnl If it isn't found, unset USE_[$1]
361   if test x$HAVE_[$1] = xno; then
362     USE_[$1]=no
363   fi
364 fi
365 dnl *** Warn if it's disabled or not found
366 if test x$USE_[$1] = xyes; then
367   ifelse([$6], , :, [$6])
368 else
369   ifelse([$3], , :, [AC_MSG_WARN(
370 ***** NOTE: These plugins won't be built: [$3]
371 )])
372   ifelse([$7], , :, [$7])
373 fi
374 dnl *** Define the conditional as appropriate
375 AM_CONDITIONAL(USE_[$1], test x$USE_[$1] = xyes)
376 ])
377
378 dnl Use a -config program which accepts --cflags and --libs parameters
379 dnl to set *_CFLAGS and *_LIBS and check existence of a feature.
380 dnl Richard Boulton <richard-alsa@tartarus.org>
381 dnl Last modification: 26/06/2001
382 dnl GST_CHECK_CONFIGPROG(FEATURE-NAME, CONFIG-PROG-FILENAME, MODULES)
383 dnl
384 dnl This check was written for GStreamer: it should be renamed and checked
385 dnl for portability if you decide to use it elsewhere.
386 dnl
387 AC_DEFUN(GST_CHECK_CONFIGPROG,
388 [
389   AC_PATH_PROG([$1]_CONFIG, [$2], no)
390   if test x$[$1]_CONFIG = xno; then
391     [$1]_LIBS=
392     [$1]_CFLAGS=
393     HAVE_[$1]=no
394   else
395     [$1]_LIBS=`[$2] --libs [$3]`
396     [$1]_CFLAGS=`[$2] --cflags [$3]`
397     HAVE_[$1]=yes
398   fi
399   AC_SUBST([$1]_LIBS)
400   AC_SUBST([$1]_CFLAGS)
401 ])
402
403
404 dnl Perform a check for existence of ARTSC
405 dnl Richard Boulton <richard-alsa@tartarus.org>
406 dnl Last modification: 26/06/2001
407 dnl GST_CHECK_FEATURE(FEATURE-NAME, FEATURE-DESCRIPTION,
408 dnl                   DEPENDENT-PLUGINS, TEST-FOR-FEATURE)
409 dnl
410 dnl This check was written for GStreamer: it should be renamed and checked
411 dnl for portability if you decide to use it elsewhere.
412 dnl
413 AC_DEFUN(GST_CHECK_ARTSC,
414 [
415   AC_PATH_PROG(ARTSC_CONFIG, artsc-config, no)
416   if test x$ARTSC_CONFIG = xno; then
417     AC_MSG_WARN([Couldn't find artsc-config])
418     HAVE_ARTSC=no
419     ARTSC_LIBS=
420     ARTSC_CFLAGS=
421   else
422     ARTSC_LIBS=`artsc-config --libs`
423     ARTSC_CFLAGS=`artsc-config --cflags`
424     dnl AC_CHECK_HEADER uses CPPFLAGS, but not CFLAGS.
425     dnl FIXME: Ensure only suitable flags result from artsc-config --cflags
426     CPPFLAGS="$CPPFLAGS $ARTSC_CFLAGS"
427     AC_CHECK_HEADER(artsc.h, HAVE_ARTSC=yes, HAVE_ARTSC=no)
428   fi
429   AC_SUBST(ARTSC_LIBS)
430   AC_SUBST(ARTSC_CFLAGS)
431 ])
432
433 dnl sidplay stuff (taken from xmms)
434 AC_DEFUN(AC_FIND_FILE,
435 [
436   $3=NO
437   for i in $2; do
438     for j in $1; do
439       if test -r "$i/$j"; then
440         $3=$i
441         break 2
442       fi
443     done
444   done
445 ])
446
447 AC_DEFUN(AC_PATH_LIBSIDPLAY,
448 [
449 AC_MSG_CHECKING([for SIDPLAY includes and library])
450 ac_sidplay_cflags=NO
451 ac_sidplay_library=NO
452 sidplay_cflags=""
453 sidplay_library=""
454
455 AC_ARG_WITH(sidplay-includes,
456   [  --with-sidplay-includes=DIR
457                           where the sidplay includes are located],
458   [ac_sidplay_cflags="$withval"
459   ])
460
461 AC_ARG_WITH(sidplay-library,
462   [  --with-sidplay-library=DIR
463                           where the sidplay library is installed],
464   [ac_sidplay_library="$withval"
465   ])
466
467 if test "$ac_sidplay_cflags" = NO || test "$ac_sidplay_library" = NO; then
468 #search common locations
469
470 AC_CACHE_VAL(ac_cv_have_sidplay,
471 [
472 sidplay_incdirs="$ac_sidplay_cflags /usr/include /usr/local/include /usr/lib/sidplay/include /usr/local/lib/sidplay/include"
473 AC_FIND_FILE(sidplay/sidtune.h,$sidplay_incdirs,sidplay_foundincdir)
474 ac_sidplay_cflags=$sidplay_foundincdir
475
476 sidplay_libdirs="$ac_sidplay_library /usr/lib /usr/local/lib /usr/lib/sidplay /usr/local/lib/sidplay"
477 AC_FIND_FILE(libsidplay.so libsidplay.so.1 libsidplay.so.1.36 libsidplay.so.1.37,$sidplay_libdirs,sidplay_foundlibdir)
478 ac_sidplay_library=$sidplay_foundlibdir
479
480 if test "$ac_sidplay_cflags" = NO || test "$ac_sidplay_library" = NO; then
481   ac_cv_have_sidplay="have_sidplay=no"
482   ac_sidplay_notfound=""
483   if test "$ac_sidplay_cflags" = NO; then
484     if test "$ac_sidplay_library" = NO; then
485       ac_sidplay_notfound="(headers and library)";
486     else
487       ac_sidplay_notfound="(headers)";
488     fi
489   else
490     ac_sidplay_notfound="(library)";
491   fi
492   eval "$ac_cv_have_sidplay"
493   AC_MSG_RESULT([$have_sidplay])
494 else
495   have_sidplay=yes
496 fi
497
498 ])  dnl AC_CACHE_VAL(ac_cv_have_sidplay,
499 else
500   have_sidplay=yes
501 fi  dnl if (have_to_search)
502
503 eval "$ac_cv_have_sidplay"
504
505 if test "$have_sidplay" != yes; then
506   AC_MSG_RESULT([$have_sidplay]);
507 else
508   ac_cv_have_sidplay="have_sidplay=yes \
509     ac_sidplay_cflags=$ac_sidplay_cflags ac_sidplay_library=$ac_sidplay_library"
510   AC_MSG_RESULT([library $ac_sidplay_library, headers $ac_sidplay_cflags])
511   
512   sidplay_library=$ac_sidplay_library
513   sidplay_cflags=$ac_sidplay_cflags
514   
515   SIDPLAY_LIBS="-L$sidplay_library -lsidplay"
516   all_libraries="$SIDPLAY_LIBS $all_libraries"
517   SIDPLAY_CFLAGS="-I$sidplay_cflags"
518   all_includes="$SIDPLAY_CFLAGS $all_includes"
519 fi
520
521 dnl Test compilation.
522
523 AC_MSG_CHECKING([whether -lsidplay works])
524 ac_cxxflags_safe=$CXXFLAGS
525 ac_ldflags_safe=$LDFLAGS
526 ac_libs_safe=$LIBS
527
528 CXXFLAGS="$CXXFLAGS -I$sidplay_cflags"
529 LDFLAGS="$LDFLAGS -L$sidplay_library"
530 LIBS="-lsidplay"
531
532 AC_CACHE_VAL(ac_cv_sidplay_works,
533 [
534   AC_LANG_CPLUSPLUS
535   AC_TRY_RUN([
536     #include <sidplay/player.h>
537              
538     int main()
539     {
540       sidTune tune = sidTune(0);
541     }
542     ],
543     ac_cv_sidplay_works="yes",
544     ac_cv_sidplay_works="no",
545     ac_cv_sidplay_works="no")
546   AC_LANG_C
547 ])
548
549 CXXFLAGS="$ac_cxxflags_safe"
550 LDFLAGS="$ac_ldflags_safe"
551 LIBS="$ac_libs_safe"
552
553 AC_MSG_RESULT([$ac_cv_sidplay_works])
554 if test "$ac_cv_sidplay_works" != yes; then
555   have_sidplay=no
556 fi
557
558 dnl
559
560 AC_SUBST(SIDPLAY_CFLAGS)
561 AC_SUBST(SIDPLAY_LIBS)
562
563 AC_SUBST(sidplay_library)
564 AC_SUBST(sidplay_cflags)
565
566 ])