1 # CFLAGS and library paths for XMMS
2 # written 15 December 1999 by Ben Gertzfield <che@debian.org>
5 dnl AM_PATH_XMMS([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
8 dnl AM_PATH_XMMS(0.9.5.1, , AC_MSG_ERROR([*** XMMS >= 0.9.5.1 not installed - please install first ***]))
10 dnl Defines XMMS_CFLAGS, XMMS_LIBS, XMMS_DATA_DIR, XMMS_PLUGIN_DIR,
11 dnl XMMS_VISUALIZATION_PLUGIN_DIR, XMMS_INPUT_PLUGIN_DIR,
12 dnl XMMS_OUTPUT_PLUGIN_DIR, XMMS_GENERAL_PLUGIN_DIR, XMMS_EFFECT_PLUGIN_DIR,
13 dnl and XMMS_VERSION for your plugin pleasure.
16 dnl XMMS_TEST_VERSION(AVAILABLE-VERSION, NEEDED-VERSION [, ACTION-IF-OKAY [, ACTION-IF-NOT-OKAY]])
17 AC_DEFUN(XMMS_TEST_VERSION, [
19 # Determine which version number is greater. Prints 2 to stdout if
20 # the second number is greater, 1 if the first number is greater,
21 # 0 if the numbers are equal.
23 # Written 15 December 1999 by Ben Gertzfield <che@debian.org>
24 # Revised 15 December 1999 by Jim Monty <monty@primenet.com>
27 xmms_got_version=[` $AWK ' \
29 print vercmp(ARGV[1], ARGV[2]); \
32 function vercmp(ver1, ver2, ver1arr, ver2arr, \
34 ver1int, ver2int, len, i, p) { \
36 ver1len = split(ver1, ver1arr, /\./); \
37 ver2len = split(ver2, ver2arr, /\./); \
39 len = ver1len > ver2len ? ver1len : ver2len; \
41 for (i = 1; i <= len; i++) { \
42 p = 1000 ^ (len - i); \
43 ver1int += ver1arr[i] * p; \
44 ver2int += ver2arr[i] * p; \
47 if (ver1int < ver2int) \
49 else if (ver1int > ver2int) \
55 if test $xmms_got_version -eq 2; then # failure
62 AC_DEFUN(AM_PATH_XMMS,
64 AC_ARG_WITH(xmms-prefix,[ --with-xmms-prefix=PFX Prefix where XMMS is installed (optional)],
65 xmms_config_prefix="$withval", xmms_config_prefix="")
66 AC_ARG_WITH(xmms-exec-prefix,[ --with-xmms-exec-prefix=PFX Exec prefix where XMMS is installed (optional)],
67 xmms_config_exec_prefix="$withval", xmms_config_exec_prefix="")
69 if test x$xmms_config_exec_prefix != x; then
70 xmms_config_args="$xmms_config_args --exec-prefix=$xmms_config_exec_prefix"
71 if test x${XMMS_CONFIG+set} != xset; then
72 XMMS_CONFIG=$xmms_config_exec_prefix/bin/xmms-config
76 if test x$xmms_config_prefix != x; then
77 xmms_config_args="$xmms_config_args --prefix=$xmms_config_prefix"
78 if test x${XMMS_CONFIG+set} != xset; then
79 XMMS_CONFIG=$xmms_config_prefix/bin/xmms-config
83 AC_PATH_PROG(XMMS_CONFIG, xmms-config, no)
84 min_xmms_version=ifelse([$1], ,0.9.5.1, $1)
86 if test "$XMMS_CONFIG" = "no"; then
89 XMMS_CFLAGS=`$XMMS_CONFIG $xmms_config_args --cflags`
90 XMMS_LIBS=`$XMMS_CONFIG $xmms_config_args --libs`
91 XMMS_VERSION=`$XMMS_CONFIG $xmms_config_args --version`
92 XMMS_DATA_DIR=`$XMMS_CONFIG $xmms_config_args --data-dir`
93 XMMS_PLUGIN_DIR=`$XMMS_CONFIG $xmms_config_args --plugin-dir`
94 XMMS_VISUALIZATION_PLUGIN_DIR=`$XMMS_CONFIG $xmms_config_args \
95 --visualization-plugin-dir`
96 XMMS_INPUT_PLUGIN_DIR=`$XMMS_CONFIG $xmms_config_args --input-plugin-dir`
97 XMMS_OUTPUT_PLUGIN_DIR=`$XMMS_CONFIG $xmms_config_args --output-plugin-dir`
98 XMMS_EFFECT_PLUGIN_DIR=`$XMMS_CONFIG $xmms_config_args --effect-plugin-dir`
99 XMMS_GENERAL_PLUGIN_DIR=`$XMMS_CONFIG $xmms_config_args --general-plugin-dir`
101 XMMS_TEST_VERSION($XMMS_VERSION, $min_xmms_version, ,no_xmms=version)
104 AC_MSG_CHECKING(for XMMS - version >= $min_xmms_version)
106 if test "x$no_xmms" = x; then
108 ifelse([$2], , :, [$2])
112 if test "$XMMS_CONFIG" = "no" ; then
113 echo "*** The xmms-config script installed by XMMS could not be found."
114 echo "*** If XMMS was installed in PREFIX, make sure PREFIX/bin is in"
115 echo "*** your path, or set the XMMS_CONFIG environment variable to the"
116 echo "*** full path to xmms-config."
118 if test "$no_xmms" = "version"; then
119 echo "*** An old version of XMMS, $XMMS_VERSION, was found."
120 echo "*** You need a version of XMMS newer than $min_xmms_version."
121 echo "*** The latest version of XMMS is always available from"
122 echo "*** http://www.xmms.org/"
125 echo "*** If you have already installed a sufficiently new version, this error"
126 echo "*** probably means that the wrong copy of the xmms-config shell script is"
127 echo "*** being found. The easiest way to fix this is to remove the old version"
128 echo "*** of XMMS, but you can also set the XMMS_CONFIG environment to point to the"
129 echo "*** correct copy of xmms-config. (In this case, you will have to"
130 echo "*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf"
131 echo "*** so that the correct libraries are found at run-time)"
136 ifelse([$3], , :, [$3])
138 AC_SUBST(XMMS_CFLAGS)
140 AC_SUBST(XMMS_VERSION)
141 AC_SUBST(XMMS_DATA_DIR)
142 AC_SUBST(XMMS_PLUGIN_DIR)
143 AC_SUBST(XMMS_VISUALIZATION_PLUGIN_DIR)
144 AC_SUBST(XMMS_INPUT_PLUGIN_DIR)
145 AC_SUBST(XMMS_OUTPUT_PLUGIN_DIR)
146 AC_SUBST(XMMS_GENERAL_PLUGIN_DIR)
147 AC_SUBST(XMMS_EFFECT_PLUGIN_DIR)
151 dnl Perform a check for a feature for GStreamer
152 dnl Richard Boulton <richard-alsa@tartarus.org>
153 dnl Last modification: 25/06/2001
154 dnl GST_CHECK_FEATURE(FEATURE-NAME, FEATURE-DESCRIPTION,
155 dnl DEPENDENT-PLUGINS, TEST-FOR-FEATURE,
156 dnl DISABLE-BY-DEFAULT, ACTION-IF-USE, ACTION-IF-NOTUSE)
158 dnl This macro adds a command line argument to enable the user to enable
159 dnl or disable a feature, and if the feature is enabled, performs a supplied
160 dnl test to check if the feature is available.
162 dnl The test should define HAVE_<FEATURE-NAME> to "yes" or "no" depending
163 dnl on whether the feature is available.
165 dnl The macro will set USE_<<FEATURE-NAME> to "yes" or "no" depending on
166 dnl whether the feature is to be used.
168 dnl The macro will call AM_CONDITIONAL(USE_<<FEATURE-NAME>, ...) to allow
169 dnl the feature to control what is built in Makefile.ams. If you want
170 dnl additional actions resulting from the test, you can add them with the
171 dnl ACTION-IF-USE and ACTION-IF-NOTUSE parameters.
173 dnl FEATURE-NAME is the name of the feature, and should be in
174 dnl purely upper case characters.
175 dnl FEATURE-DESCRIPTION is used to describe the feature in help text for
176 dnl the command line argument.
177 dnl DEPENDENT-PLUGINS lists any plugins which depend on this feature.
178 dnl TEST-FOR-FEATURE is a test which sets HAVE_<FEATURE-NAME> to "yes"
179 dnl or "no" depending on whether the feature is
181 dnl DISABLE-BY-DEFAULT if "disabled", the feature is disabled by default,
182 dnl if any other value, the feature is enabled by default.
183 dnl ACTION-IF-USE any extra actions to perform if the feature is to be
185 dnl ACTION-IF-NOTUSE any extra actions to perform if the feature is not to
188 AC_DEFUN(GST_CHECK_FEATURE,
190 builtin(define, [gst_endisable], ifelse($5, [disabled], [enable], [disable]))dnl
191 AC_ARG_ENABLE(translit([$1], A-Z, a-z),
192 [ ]builtin(format, --%-26s gst_endisable %s, gst_endisable-translit([$1], A-Z, a-z), [$2]ifelse([$3],,,: [$3])),
193 [ case "${enableval}" in
196 *) AC_MSG_ERROR(bad value ${enableval} for --enable-translit([$1], A-Z, a-z)) ;;
198 [ USE_$1=]ifelse($5, [disabled], [no], [yes])) dnl DEFAULT
200 dnl *** If it's enabled
201 if test x$USE_[$1] = xyes; then
202 gst_check_save_LIBS=$LIBS
203 gst_check_save_LDFLAGS=$LDFLAGS
204 gst_check_save_CFLAGS=$CFLAGS
205 gst_check_save_CPPFLAGS=$CPPFLAGS
206 gst_check_save_CXXFLAGS=$CXXFLAGS
209 LIBS=$gst_check_save_LIBS
210 LDFLAGS=$gst_check_save_LDFLAGS
211 CFLAGS=$gst_check_save_CFLAGS
212 CPPFLAGS=$gst_check_save_CPPFLAGS
213 CXXFLAGS=$gst_check_save_CXXFLAGS
215 dnl If it isn't found, unset USE_[$1]
216 if test x$HAVE_[$1] = xno; then
220 dnl *** Warn if it's disabled or not found
221 if test x$USE_[$1] = xyes; then
222 ifelse([$6], , :, [$6])
224 ifelse([$3], , :, [AC_MSG_WARN(
225 ***** NOTE: These plugins won't be built: [$3]
227 ifelse([$7], , :, [$7])
229 dnl *** Define the conditional as appropriate
230 AM_CONDITIONAL(USE_[$1], test x$USE_[$1] = xyes)
233 dnl Use a -config program which accepts --cflags and --libs parameters
234 dnl to set *_CFLAGS and *_LIBS and check existence of a feature.
235 dnl Richard Boulton <richard-alsa@tartarus.org>
236 dnl Last modification: 26/06/2001
237 dnl GST_CHECK_CONFIGPROG(FEATURE-NAME, CONFIG-PROG-FILENAME, MODULES)
239 dnl This check was written for GStreamer: it should be renamed and checked
240 dnl for portability if you decide to use it elsewhere.
242 AC_DEFUN(GST_CHECK_CONFIGPROG,
244 AC_PATH_PROG([$1]_CONFIG, [$2], no)
245 if test x$[$1]_CONFIG = xno; then
250 [$1]_LIBS=`[$2] --libs [$3]`
251 [$1]_CFLAGS=`[$2] --cflags [$3]`
255 AC_SUBST([$1]_CFLAGS)
259 dnl Perform a check for existence of ARTSC
260 dnl Richard Boulton <richard-alsa@tartarus.org>
261 dnl Last modification: 26/06/2001
262 dnl GST_CHECK_FEATURE(FEATURE-NAME, FEATURE-DESCRIPTION,
263 dnl DEPENDENT-PLUGINS, TEST-FOR-FEATURE)
265 dnl This check was written for GStreamer: it should be renamed and checked
266 dnl for portability if you decide to use it elsewhere.
268 AC_DEFUN(GST_CHECK_ARTSC,
270 AC_PATH_PROG(ARTSC_CONFIG, artsc-config, no)
271 if test x$ARTSC_CONFIG = xno; then
272 AC_MSG_WARN([Couldn't find artsc-config])
277 ARTSC_LIBS=`artsc-config --libs`
278 ARTSC_CFLAGS=`artsc-config --cflags`
279 dnl AC_CHECK_HEADER uses CPPFLAGS, but not CFLAGS.
280 dnl FIXME: Ensure only suitable flags result from artsc-config --cflags
281 CPPFLAGS="$CPPFLAGS $ARTSC_CFLAGS"
282 AC_CHECK_HEADER(artsc.h, HAVE_ARTSC=yes, HAVE_ARTSC=no)
285 AC_SUBST(ARTSC_CFLAGS)
288 dnl sidplay stuff (taken from xmms)
289 AC_DEFUN(AC_FIND_FILE,
294 if test -r "$i/$j"; then
302 AC_DEFUN(AC_PATH_LIBSIDPLAY,
304 AC_MSG_CHECKING([for SIDPLAY includes and library])
306 ac_sidplay_library=NO
310 AC_ARG_WITH(sidplay-includes,
311 [ --with-sidplay-includes=DIR
312 where the sidplay includes are located],
313 [ac_sidplay_cflags="$withval"
316 AC_ARG_WITH(sidplay-library,
317 [ --with-sidplay-library=DIR
318 where the sidplay library is installed],
319 [ac_sidplay_library="$withval"
322 if test "$ac_sidplay_cflags" = NO || test "$ac_sidplay_library" = NO; then
323 #search common locations
325 AC_CACHE_VAL(ac_cv_have_sidplay,
327 sidplay_incdirs="$ac_sidplay_cflags /usr/include /usr/local/include /usr/lib/sidplay/include /usr/local/lib/sidplay/include"
328 AC_FIND_FILE(sidplay/sidtune.h,$sidplay_incdirs,sidplay_foundincdir)
329 ac_sidplay_cflags=$sidplay_foundincdir
331 sidplay_libdirs="$ac_sidplay_library /usr/lib /usr/local/lib /usr/lib/sidplay /usr/local/lib/sidplay"
332 AC_FIND_FILE(libsidplay.so libsidplay.so.1 libsidplay.so.1.36 libsidplay.so.1.37,$sidplay_libdirs,sidplay_foundlibdir)
333 ac_sidplay_library=$sidplay_foundlibdir
335 if test "$ac_sidplay_cflags" = NO || test "$ac_sidplay_library" = NO; then
336 ac_cv_have_sidplay="have_sidplay=no"
337 ac_sidplay_notfound=""
338 if test "$ac_sidplay_cflags" = NO; then
339 if test "$ac_sidplay_library" = NO; then
340 ac_sidplay_notfound="(headers and library)";
342 ac_sidplay_notfound="(headers)";
345 ac_sidplay_notfound="(library)";
347 eval "$ac_cv_have_sidplay"
348 AC_MSG_RESULT([$have_sidplay])
353 ]) dnl AC_CACHE_VAL(ac_cv_have_sidplay,
356 fi dnl if (have_to_search)
358 eval "$ac_cv_have_sidplay"
360 if test "$have_sidplay" != yes; then
361 AC_MSG_RESULT([$have_sidplay]);
363 ac_cv_have_sidplay="have_sidplay=yes \
364 ac_sidplay_cflags=$ac_sidplay_cflags ac_sidplay_library=$ac_sidplay_library"
365 AC_MSG_RESULT([library $ac_sidplay_library, headers $ac_sidplay_cflags])
367 sidplay_library=$ac_sidplay_library
368 sidplay_cflags=$ac_sidplay_cflags
370 SIDPLAY_LIBS="-L$sidplay_library -lsidplay"
371 all_libraries="$SIDPLAY_LIBS $all_libraries"
372 SIDPLAY_CFLAGS="-I$sidplay_cflags"
373 all_includes="$SIDPLAY_CFLAGS $all_includes"
376 dnl Test compilation.
378 AC_MSG_CHECKING([whether -lsidplay works])
379 ac_cxxflags_safe=$CXXFLAGS
380 ac_ldflags_safe=$LDFLAGS
383 CXXFLAGS="$CXXFLAGS -I$sidplay_cflags"
384 LDFLAGS="$LDFLAGS -L$sidplay_library"
387 AC_CACHE_VAL(ac_cv_sidplay_works,
391 #include <sidplay/player.h>
395 sidTune tune = sidTune(0);
398 ac_cv_sidplay_works="yes",
399 ac_cv_sidplay_works="no",
400 ac_cv_sidplay_works="no")
404 CXXFLAGS="$ac_cxxflags_safe"
405 LDFLAGS="$ac_ldflags_safe"
408 AC_MSG_RESULT([$ac_cv_sidplay_works])
409 if test "$ac_cv_sidplay_works" != yes; then
415 AC_SUBST(SIDPLAY_CFLAGS)
416 AC_SUBST(SIDPLAY_LIBS)
418 AC_SUBST(sidplay_library)
419 AC_SUBST(sidplay_cflags)
422 dnl Configure Paths for Alsa
423 dnl Some modifications by Richard Boulton <richard-alsa@tartarus.org>
424 dnl Christopher Lansdown <lansdoct@cs.alfred.edu>
425 dnl Jaroslav Kysela <perex@suse.cz>
426 dnl Last modification: 07/01/2001
427 dnl AM_PATH_ALSA([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
428 dnl Test for libasound, and define ALSA_CFLAGS and ALSA_LIBS as appropriate.
429 dnl enables arguments --with-alsa-prefix=
430 dnl --with-alsa-enc-prefix=
431 dnl --disable-alsatest (this has no effect, as yet)
433 dnl For backwards compatibility, if ACTION_IF_NOT_FOUND is not specified,
434 dnl and the alsa libraries are not found, a fatal AC_MSG_ERROR() will result.
436 AC_DEFUN(AM_PATH_ALSA,
437 [dnl Save the original CFLAGS, LDFLAGS, and LIBS
438 alsa_save_CFLAGS="$CFLAGS"
439 alsa_save_LDFLAGS="$LDFLAGS"
440 alsa_save_LIBS="$LIBS"
444 dnl Get the cflags and libraries for alsa
446 AC_ARG_WITH(alsa-prefix,
447 [ --with-alsa-prefix=PFX Prefix where Alsa library is installed(optional)],
448 [alsa_prefix="$withval"], [alsa_prefix=""])
450 AC_ARG_WITH(alsa-inc-prefix,
451 [ --with-alsa-inc-prefix=PFX Prefix where include libraries are (optional)],
452 [alsa_inc_prefix="$withval"], [alsa_inc_prefix=""])
454 dnl FIXME: this is not yet implemented
455 AC_ARG_ENABLE(alsatest,
456 [ --disable-alsatest Do not try to compile and run a test Alsa program],
457 [enable_alsatest=no],
458 [enable_alsatest=yes])
460 dnl Add any special include directories
461 AC_MSG_CHECKING(for ALSA CFLAGS)
462 if test "$alsa_inc_prefix" != "" ; then
463 ALSA_CFLAGS="$ALSA_CFLAGS -I$alsa_inc_prefix"
464 CFLAGS="$CFLAGS -I$alsa_inc_prefix"
466 AC_MSG_RESULT($ALSA_CFLAGS)
468 dnl add any special lib dirs
469 AC_MSG_CHECKING(for ALSA LDFLAGS)
470 if test "$alsa_prefix" != "" ; then
471 ALSA_LIBS="$ALSA_LIBS -L$alsa_prefix"
472 LDFLAGS="$LDFLAGS $ALSA_LIBS"
475 dnl add the alsa library
476 ALSA_LIBS="$ALSA_LIBS -lasound -lm -ldl"
477 LIBS=`echo $LIBS | sed 's/-lm//'`
478 LIBS=`echo $LIBS | sed 's/-ldl//'`
479 LIBS=`echo $LIBS | sed 's/ //'`
480 LIBS="$ALSA_LIBS $LIBS"
481 AC_MSG_RESULT($ALSA_LIBS)
483 dnl Check for a working version of libasound that is of the right version.
484 min_alsa_version=ifelse([$1], ,0.1.1,$1)
485 AC_MSG_CHECKING(for libasound headers version >= $min_alsa_version)
487 alsa_min_major_version=`echo $min_alsa_version | \
488 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
489 alsa_min_minor_version=`echo $min_alsa_version | \
490 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
491 alsa_min_micro_version=`echo $min_alsa_version | \
492 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
497 #include <sys/asoundlib.h>
501 /* ensure backward compatibility */
502 #if !defined(SND_LIB_MAJOR) && defined(SOUNDLIB_VERSION_MAJOR)
503 #define SND_LIB_MAJOR SOUNDLIB_VERSION_MAJOR
505 #if !defined(SND_LIB_MINOR) && defined(SOUNDLIB_VERSION_MINOR)
506 #define SND_LIB_MINOR SOUNDLIB_VERSION_MINOR
508 #if !defined(SND_LIB_SUBMINOR) && defined(SOUNDLIB_VERSION_SUBMINOR)
509 #define SND_LIB_SUBMINOR SOUNDLIB_VERSION_SUBMINOR
512 # if(SND_LIB_MAJOR > $alsa_min_major_version)
515 # if(SND_LIB_MAJOR < $alsa_min_major_version)
519 # if(SND_LIB_MINOR > $alsa_min_minor_version)
522 # if(SND_LIB_MINOR < $alsa_min_minor_version)
526 # if(SND_LIB_SUBMINOR < $alsa_min_micro_version)
534 [AC_MSG_RESULT(found.)],
535 [AC_MSG_RESULT(not present.)
536 ifelse([$3], , [AC_MSG_ERROR(Sufficiently new version of libasound not found.)])
541 dnl Now that we know that we have the right version, let's see if we have the library and not just the headers.
542 AC_CHECK_LIB([asound], [snd_seq_create_event],,
543 [ifelse([$3], , [AC_MSG_ERROR(No linkable libasound was found.)])
547 if test "x$alsa_found" = "xyes" ; then
548 ifelse([$2], , :, [$2])
549 LIBS=`echo $LIBS | sed 's/-lasound//g'`
550 LIBS=`echo $LIBS | sed 's/ //'`
551 LIBS="-lasound $LIBS"
553 if test "x$alsa_found" = "xno" ; then
554 ifelse([$3], , :, [$3])
555 CFLAGS="$alsa_save_CFLAGS"
556 LDFLAGS="$alsa_save_LDFLAGS"
557 LIBS="$alsa_save_LIBS"
562 dnl That should be it. Now just export out symbols:
563 AC_SUBST(ALSA_CFLAGS)
567 # stuff for SDL, hope this helps if we put it here
569 # Configure paths for SDL
570 # Sam Lantinga 9/21/99
571 # stolen from Manish Singh
572 # stolen back from Frank Belew
573 # stolen from Manish Singh
574 # Shamelessly stolen from Owen Taylor
576 dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
577 dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
579 AC_DEFUN(AM_PATH_SDL,
581 dnl Get the cflags and libraries from the sdl-config script
583 AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
584 sdl_prefix="$withval", sdl_prefix="")
585 AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
586 sdl_exec_prefix="$withval", sdl_exec_prefix="")
587 AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program],
588 , enable_sdltest=yes)
590 if test x$sdl_exec_prefix != x ; then
591 sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix"
592 if test x${SDL_CONFIG+set} != xset ; then
593 SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
596 if test x$sdl_prefix != x ; then
597 sdl_args="$sdl_args --prefix=$sdl_prefix"
598 if test x${SDL_CONFIG+set} != xset ; then
599 SDL_CONFIG=$sdl_prefix/bin/sdl-config
603 AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
604 min_sdl_version=ifelse([$1], ,0.11.0,$1)
605 AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
607 if test "$SDL_CONFIG" = "no" ; then
610 SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags`
611 SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs`
613 sdl_major_version=`$SDL_CONFIG $sdl_args --version | \
614 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
615 sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \
616 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
617 sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
618 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
619 if test "x$enable_sdltest" = "xyes" ; then
620 ac_save_CFLAGS="$CFLAGS"
622 CFLAGS="$CFLAGS $SDL_CFLAGS"
623 LIBS="$LIBS $SDL_LIBS"
625 dnl Now check if the installed SDL is sufficiently new. (Also sanity
626 dnl checks the results of sdl-config to some extent
636 my_strdup (char *str)
642 new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
643 strcpy (new_str, str);
651 int main (int argc, char *argv[])
653 int major, minor, micro;
656 /* This hangs on some systems (?)
657 system ("touch conf.sdltest");
659 { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
661 /* HP/UX 9 (%@#!) writes to sscanf strings */
662 tmp_version = my_strdup("$min_sdl_version");
663 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
664 printf("%s, bad version string\n", "$min_sdl_version");
668 if (($sdl_major_version > major) ||
669 (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
670 (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
676 printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
677 printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
678 printf("*** best to upgrade to the required version.\n");
679 printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
680 printf("*** to point to the correct copy of sdl-config, and remove the file\n");
681 printf("*** config.cache before re-running configure\n");
686 ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
687 CFLAGS="$ac_save_CFLAGS"
691 if test "x$no_sdl" = x ; then
693 ifelse([$2], , :, [$2])
696 if test "$SDL_CONFIG" = "no" ; then
697 echo "*** The sdl-config script installed by SDL could not be found"
698 echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
699 echo "*** your path, or set the SDL_CONFIG environment variable to the"
700 echo "*** full path to sdl-config."
702 if test -f conf.sdltest ; then
705 echo "*** Could not run SDL test program, checking why..."
706 CFLAGS="$CFLAGS $SDL_CFLAGS"
707 LIBS="$LIBS $SDL_LIBS"
712 int main(int argc, char *argv[])
715 #define main K_and_R_C_main
717 [ echo "*** The test program compiled, but did not run. This usually means"
718 echo "*** that the run-time linker is not finding SDL or finding the wrong"
719 echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
720 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
721 echo "*** to the installed location Also, make sure you have run ldconfig if that"
722 echo "*** is required on your system"
724 echo "*** If you have an old version installed, it is best to remove it, although"
725 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
726 [ echo "*** The test program failed to compile or link. See the file config.log for the"
727 echo "*** exact error that occured. This usually means SDL was incorrectly installed"
728 echo "*** or that you have moved SDL since it was installed. In the latter case, you"
729 echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
730 CFLAGS="$ac_save_CFLAGS"
736 ifelse([$3], , :, [$3])
742 # Configure paths for ARTS
743 # Philip Stadermann 2001-06-21
745 # adapted and scrubbed by thomas
747 dnl AM_PATH_ARTS([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
748 dnl Test for ARTS, and define ARTS_CFLAGS and ARTS_LIBS
750 AC_DEFUN([AM_PATH_ARTS],
752 dnl Get the cflags and libraries from the artsc-config script
754 AC_ARG_WITH(arts-prefix,[ --with-arts-prefix=PFX Prefix where ARTS is installed (optional)],
755 arts_prefix="$withval", arts_prefix="")
756 AC_ARG_WITH(arts-exec-prefix,[ --with-arts-exec-prefix=PFX Exec prefix where ARTS is installed (optional)],
757 arts_exec_prefix="$withval", arts_exec_prefix="")
758 AC_ARG_ENABLE(artstest, [ --disable-artstest Do not try to compile and run a test ARTS program],
759 , enable_artstest=yes)
761 if test x$arts_exec_prefix != x ; then
762 arts_args="$arts_args --exec-prefix=$arts_exec_prefix"
763 if test x${ARTS_CONFIG+set} != xset ; then
764 ARTS_CONFIG=$arts_exec_prefix/bin/artsc-config
767 if test x$arts_prefix != x ; then
768 arts_args="$arts_args --prefix=$arts_prefix"
769 if test x${ARTS_CONFIG+set} != xset ; then
770 ARTS_CONFIG=$arts_prefix/bin/artsc-config
774 AC_PATH_PROG(ARTS_CONFIG, artsc-config, no)
775 min_arts_version=ifelse([$1], ,0.9.5,$1)
776 AC_MSG_CHECKING(for ARTS artsc - version >= $min_arts_version)
778 if test "$ARTS_CONFIG" = "no" ; then
781 # FIXME : thomas added this sed to get arts path instead of artsc
782 ARTS_CFLAGS=`$ARTS_CONFIG $artsconf_args --cflags | sed 's/artsc$/arts/'`
783 ARTS_LIBS=`$ARTS_CONFIG $artsconf_args --libs | sed 's/artsc$/arts/'`
785 arts_major_version=`$ARTS_CONFIG $arts_args --version | \
786 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
787 arts_minor_version=`$ARTS_CONFIG $arts_args --version | \
788 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
789 arts_micro_version=`$ARTS_CONFIG $arts_config_args --version | \
790 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
791 if test "x$enable_artstest" = "xyes" ; then
792 ac_save_CFLAGS="$CFLAGS"
794 CFLAGS="$CFLAGS $ARTS_CFLAGS"
795 LIBS="$LIBS $ARTS_LIBS"
797 dnl Now check if the installed ARTS is sufficiently new. (Also sanity
798 dnl checks the results of artsc-config to some extent)
800 dnl thomas: ask nicely for C++ compilation
803 ac_save_CPPFLAGS="$CPPFLAGS"
804 ac_save_LDFLAGS="$LDFLAGS"
805 AC_SUBST(CPPFLAGS,"$CPPFLAGS $ARTS_CFLAGS")
806 AC_SUBST(LDFLAGS,"$LDFLAGS $ARTS_CLIBS")
812 #include <artsflow.h>
815 my_strdup (char *str)
821 // thomas: the original test did not have the typecast
822 new_str = (char *) malloc ((strlen (str) + 1) * sizeof(char));
823 strcpy (new_str, str);
833 int major, minor, micro;
836 system ("touch conf.artstest");
838 /* HP/UX 9 (%@#!) writes to sscanf strings */
839 tmp_version = my_strdup("$min_arts_version");
840 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
841 printf("%s, bad version string\n", "$min_arts_version");
845 if (($arts_major_version > major) ||
846 (($arts_major_version == major) && ($arts_minor_version > minor)) ||
847 (($arts_major_version == major) && ($arts_minor_version == minor) && ($arts_micro_version >= micro)))
853 printf("\n*** 'artsc-config --version' returned %d.%d.%d, but the minimum version\n", $arts_major_version, $arts_minor_version, $arts_micro_version);
854 printf("*** of ARTS required is %d.%d.%d. If artsc-config is correct, then it is\n", major, minor, micro);
855 printf("*** best to upgrade to the required version.\n");
856 printf("*** If artsc-config was wrong, set the environment variable ARTS_CONFIG\n");
857 printf("*** to point to the correct copy of artsc-config, and remove the file\n");
858 printf("*** config.cache before re-running configure\n");
863 ],, no_arts=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
864 dnl release C++ question
866 CFLAGS="$ac_save_CFLAGS"
868 CPPFLAGS="$ac_save_CPPFLAGS"
869 LDFLAGS="$ac_save_LDFLAGS"
870 AC_SUBST(CPPFLAGS,"$CPPFLAGS")
871 AC_SUBST(LDFLAGS,"$LDFLAGS")
874 if test "x$no_arts" = x ; then
876 ifelse([$2], , :, [$2])
879 if test "$ARTS_CONFIG" = "no" ; then
880 echo "*** The artsc-config script installed by ARTS could not be found"
881 echo "*** If ARTS was installed in PREFIX, make sure PREFIX/bin is in"
882 echo "*** your path, or set the ARTS_CONFIG environment variable to the"
883 echo "*** full path to artsc-config."
885 if test -f conf.artstest ; then
888 echo "*** Could not run ARTS test program, checking why..."
889 CFLAGS="$CFLAGS $ARTS_CFLAGS"
890 LIBS="$LIBS $ARTS_LIBS"
893 #include <artsflow.h>
895 [ echo "*** The test program compiled, but did not run. This usually means"
896 echo "*** that the run-time linker is not finding ARTS or finding the wrong"
897 echo "*** version of ARTS. If it is not finding ARTS, you'll need to set your"
898 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
899 echo "*** to the installed location Also, make sure you have run ldconfig if that"
900 echo "*** is required on your system"
902 echo "*** If you have an old version installed, it is best to remove it, although"
903 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
904 [ echo "*** The test program failed to compile or link. See the file config.log for the"
905 echo "*** exact error that occured. This usually means ARTS was incorrectly installed"
906 echo "*** or that you have moved ARTS since it was installed. In the latter case, you"
907 echo "*** may want to edit the artsc-config script: $ARTS_CONFIG" ])
908 CFLAGS="$ac_save_CFLAGS"
914 ifelse([$3], , :, [$3])
916 AC_SUBST(ARTS_CFLAGS)