1 dnl sxe-mm.m4 -- Multimedia goodness
6 AC_DEFUN([SXE_MM_CHECK_XPM], [
7 ## arg #1: action on success
8 ## arg #2: action on failure
9 pushdef([MM_SUCC], [$1])
10 pushdef([MM_FAIL], [$2])
12 AC_MSG_CHECKING([for xpm support])
16 if test "$window_system" = "none"; then
21 SXE_LANG_WERROR([off])
22 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
23 LDFLAGS="$LDFLAGS $X_PRE_LIBS $X_LIBS $libs_x"
24 LIBS="$LIBS -lXpm -lX11"
26 SXE_CHECK_HEADERS([X11/xpm.h], [:], [MM_FAIL])
28 AC_MSG_CHECKING([for Xpm (more recent than 3.4f)])
29 AC_RUN_IFELSE([AC_LANG_SOURCE([[
32 int main(int c, char **v)
35 XpmIncludeVersion != XpmLibraryVersion() ? 1 :
36 XpmIncludeVersion < 30406 ? 2 : 0 ;
37 }]])], [./conftest dummy_arg; xpm_status=$?;
38 if test "$xpm_status" = "0"; then
43 if test "$xpm_status" = "1"; then
45 Xpm library version and header file version don't match!
46 I have disabled xpm on your behalf.])
47 elif test "$xpm_status" = "2"; then
49 Xpm library version is too old!
50 I have disabled xpm on your behalf.])
53 Internal xpm detection logic error!])
62 ])dnl SXE_MM_CHECK_XPM
64 AC_DEFUN([SXE_MM_CHECK_XFACE], [
65 ## arg #1: action on success
66 ## arg #2: action on failure
67 pushdef([MM_SUCC], [$1])
68 pushdef([MM_FAIL], [$2])
70 AC_MSG_CHECKING([for xface support])
74 SXE_LANG_WERROR([off])
75 dnl SXE_PREPEND_UNDUP([-I$x_includes], [c_switch_site])
76 dnl SXE_PREPEND_UNDUP([-L$x_libraries], [ld_switch_site])
77 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
78 LDFLAGS="$LDFLAGS $X_LIBS"
81 if test "$window_system" = "none"; then
85 SXE_CHECK_HEADERS([compface.h], [:], [MM_FAIL])
86 AC_CHECK_LIB([compface], [UnGenFace], [:], [MM_FAIL])
89 ])dnl SXE_MM_CHECK_XFACE
91 AC_DEFUN([SXE_MM_CHECK_GIF], [
92 ## arg #1: action on success
93 ## arg #2: action on failure
94 pushdef([MM_SUCC], [$1])
95 pushdef([MM_FAIL], [$2])
97 AC_MSG_CHECKING([for gif support])
103 if test "$window_system" = "none"; then
108 ])dnl SXE_MM_CHECK_GIF
110 AC_DEFUN([SXE_MM_CHECK_JPEG], [
111 ## arg #1: action on success
112 ## arg #2: action on failure
113 pushdef([MM_SUCC], [$1])
114 pushdef([MM_FAIL], [$2])
116 AC_MSG_CHECKING([for jpeg support])
120 SXE_LANG_WERROR([off])
121 dnl SXE_PREPEND_UNDUP([-I$x_includes], [c_switch_site])
122 dnl SXE_PREPEND_UNDUP([-L$x_libraries], [ld_switch_site])
123 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
124 LDFLAGS="$LDFLAGS $X_LIBS"
127 if test "$window_system" = "none"; then
131 SXE_CHECK_HEADERS([jpeglib.h], [:], [MM_FAIL])
132 AC_CHECK_LIB([jpeg], [jpeg_destroy_decompress], [:], [MM_FAIL], [$INFLATE_LIB])
135 ])dnl SXE_MM_CHECK_JPEG
138 AC_DEFUN([_SXE_MM_CHECK_PNG_HEADERS], [dnl
139 ## defines sxe_cv_feat_png_headers
140 ## also defines and substs PNG_CPPFLAGS
143 SXE_LANG_WERROR([off])
144 PNG_CPPFLAGS="$CPPFLAGS $X_CFLAGS"
145 CPPFLAGS="$PNG_CPPFLAGS"
146 SXE_CHECK_HEADERS([png.h])
149 if test "${ac_cv_header_png_h}" = "yes"; then
150 sxe_cv_feat_png_headers="yes"
152 sxe_cv_feat_png_headers="no"
155 AC_SUBST([PNG_CPPFLAGS])
156 ])dnl _SXE_MM_CHECK_PNG_HEADERS
158 AC_DEFUN([_SXE_MM_CHECK_PNG_LIBS], [dnl
159 ## defines sxe_cv_feat_png_libs
160 ## also defines and substs PNG_LIBS and PNG_LDFLAGS
163 SXE_LANG_WERROR([off])
164 PNG_LDFLAGS="$LDFLAGS $X_LIBS"
165 LDFLAGS="$PNG_LDFLAGS"
166 AC_CHECK_LIB([png], [png_read_image], [], [], [$INFLATE_LIB])
169 if test "${ac_cv_lib_png_png_read_image}" = "yes"; then
170 sxe_cv_feat_png_libs="yes"
171 PNG_LIBS="$INFLATE_LIB -lpng"
173 sxe_cv_feat_png_libs="no"
178 AC_SUBST([PNG_LDFLAGS])
179 ])dnl _SXE_MM_CHECK_PNG_LIBS
181 AC_DEFUN([_SXE_MM_CHECK_PNG_VERSION], [dnl
182 ## defines sxe_cv_tmp_png_status to yes if version info seems okay
183 AC_REQUIRE([_SXE_MM_CHECK_PNG_HEADERS])
184 AC_REQUIRE([_SXE_MM_CHECK_PNG_LIBS])
186 SXE_MSG_CHECKING([for workable png version information])
189 CPPFLAGS="$PNG_CPPFLAGS"
190 LDFLAGS="$PNG_LDFLAGS"
192 AC_RUN_IFELSE([AC_LANG_SOURCE([[
193 #if defined HAVE_PNG_H
195 #endif /* HAVE_PNG_H */
197 int main(int c, char **v)
202 if (strcmp(png_libpng_ver, PNG_LIBPNG_VER_STRING) != 0) {
205 return (PNG_LIBPNG_VER < 10002) ? 2 : 0 ;
206 }]])], [./conftest dummy_arg; png_status=$?;
207 if test "$png_status" = "0"; then
208 sxe_cv_tmp_png_status="yes"
210 elif test "$png_status" = "1"; then
211 sxe_cv_tmp_png_status="yes"
213 PNG library version and header file don't match!
214 This is odd but I think I give it a whirl.
215 If things work out badly I suggest to turn off your computer forever.])
217 elif test "$png_status" = "2"; then
218 sxe_cv_tmp_png_status="no"
220 PNG library version too old (pre 1.0.2)!
221 I have disabled PNG support on your behalf.])
224 sxe_cv_tmp_png_status="no"
226 Whatever happened just now, I'm completely fucked.])
227 fi], [sxe_cv_tmp_png_status="no"], [sxe_cv_tmp_png_status="no"])
228 SXE_MSG_RESULT([${sxe_cv_tmp_png_status}])
230 ])dnl _SXE_MM_CHECK_PNG_VERSION
232 AC_DEFUN([SXE_MM_CHECK_PNG], [
233 ## SXE_MM_CHECK_PNG(<action-if-found>, <action-if-not-found>)
234 ## defines HAVE_PNG in case png is usable
235 pushdef([MM_SUCC], [$1])
236 pushdef([MM_FAIL], [$2])
238 SXE_MSG_CHECKING([for PNG support])
241 _SXE_MM_CHECK_PNG_HEADERS
242 _SXE_MM_CHECK_PNG_LIBS
243 _SXE_MM_CHECK_PNG_VERSION
246 ## we want to see a header and png_read_image really
247 if test "${sxe_cv_feat_png_headers}" = "yes" -a \
248 "${sxe_cv_feat_png_libs}" = "yes" -a \
249 "${sxe_cv_tmp_png_status}" = "yes"; then
250 sxe_cv_feat_png="yes"
251 AC_DEFINE([HAVE_PNG], [1], [Define to 1 if png is usable.])
257 ])dnl SXE_MM_CHECK_PNG
259 AC_DEFUN([SXE_MM_CHECK_TIFF], [
260 ## arg #1: action on success
261 ## arg #2: action on failure
262 pushdef([MM_SUCC], [$1])
263 pushdef([MM_FAIL], [$2])
265 AC_MSG_CHECKING([for TIFF support])
269 SXE_LANG_WERROR([off])
270 dnl SXE_PREPEND_UNDUP([-I$x_includes], [c_switch_site])
271 dnl SXE_PREPEND_UNDUP([-L$x_libraries], [ld_switch_site])
272 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
273 LDFLAGS="$LDFLAGS $X_LIBS"
276 if test "$window_system" = "none"; then
280 SXE_CHECK_HEADERS([tiffio.h], [:], [MM_FAIL])
281 AC_CHECK_LIB([tiff], [TIFFClientOpen], [:], [MM_FAIL], [$INFLATE_LIB])
284 ])dnl SXE_MM_CHECK_TIFF
286 AC_DEFUN([SXE_MM_SEARCH_INFLATE], [
287 dnl Too many stupid linkers can't detect cascaded lib dependencies
288 dnl until runtime. So we always search for libz compression support.
289 AC_SEARCH_LIBS([inflate], [c z gz], [
290 if test "$ac_cv_lib_c_inflate" = "yes"; then
292 elif test "$ac_cv_lib_z_inflate" = "yes"; then
294 elif test "$ac_cv_lib_gz_inflate" = "yes"; then
297 if test -n "$INFLATE_LIB"; then
298 SXE_PREPEND([$INFLATE_LIB], [MM_LIBS])
300 ])dnl SXE_MM_SEARCH_INFLATE
302 AC_DEFUN([SXE_MM_CHECK_SNDFILE], [
303 ## assumes $PKG_CONFIG is defined
304 ## arg #1: action on success
305 ## arg #2: action on failure
307 _SXE_MM_CHECK_pkgconfig_based([sndfile], [sndfile], [1.0.12], [dnl
308 sf_open sf_close sf_readf_short sf_readf_int dnl
309 sf_readf_float sf_seek sf_open_virtual],
310 [sndfile.h], [$1], [$2])
311 ])dnl SXE_MM_CHECK_SNDFILE
313 AC_DEFUN([SXE_MM_CHECK_FFMPEG], [
314 ## assumes $PKG_CONFIG is defined
315 ## arg #1: action on success
316 ## arg #2: action on failure
317 pushdef([ACTION_IF_FOUND], [$1])
318 pushdef([ACTION_IF_NOT_FOUND], [$2])
321 ## we can't use that one since we have to check multiple headers
322 dnl _SXE_MM_CHECK_pkgconfig_based([ffmpeg], [libavformat], [49.0.0], [dnl
323 dnl av_open_input_file av_close_input_file av_find_stream_info dnl
324 dnl url_fopen av_probe_input_format avcodec_find_decoder dnl
325 dnl avcodec_open av_read_frame av_seek_frame av_register_all dnl
326 dnl avcodec_decode_audio avcodec_decode_audio2], [avformat.h],
327 dnl [sxe_cv_feat_ffmpeg=yes], [sxe_cv_feat_ffmpeg=no])
329 dnl Dropped in favour of sxe-pkgconfig.m4 macros
330 dnl _SXE_CHECK_pkgconfig_based([ffmpeg], [libavformat], [49.0.0])
332 SXE_PC_CHECK_VERSION_ATLEAST([libavformat], [51.0.0])
334 SXE_CHECK_FFMPEG_HEADERS
335 SXE_CHECK_FFMPEG_LIBS
337 ## make sure we have at least one of the headers
338 if test "$ac_cv_header_avformat_h" = "yes" -o \
339 "$ac_cv_header_ffmpeg_avformat_h" = "yes" -o \
340 "$ac_cv_header_libavformat_avformat_h" = "yes"; then
341 sxe_cv_feat_ffmpeg_headers="yes"
343 ## make sure either decode_audio or decode_audio2 is there
344 if test "$ac_cv_lib_avformat_avcodec_decode_audio2" = "yes" -o \
345 "$ac_cv_lib_avformat_avcodec_decode_audio" = "yes"; then
346 sxe_cv_feat_ffmpeg_decoders="yes"
348 ## make sure we can either use av_register_protocol()
349 ## or register_protocol()
350 if test "$ac_cv_lib_avformat_av_register_protocol" = "yes" -o \
351 "$ac_cv_lib_avformat_register_protocol" = "yes"; then
352 sxe_cv_feat_ffmpeg_proto_reg="yes"
354 ## make sure this bloody av context allocator is there
355 if test "$ac_cv_lib_avformat_avformat_alloc_context" = "yes" -o \
356 "$ac_cv_lib_avformat_av_alloc_format_context" = "yes"; then
357 sxe_cv_feat_ffmpeg_avformat_alloc="yes"
359 if test "$sxe_cv_feat_ffmpeg_headers" = "yes" -a \
360 "$sxe_cv_feat_ffmpeg_decoders" = "yes" -a \
361 "$sxe_cv_feat_ffmpeg_proto_reg" = "yes" -a \
362 "$sxe_cv_feat_ffmpeg_avformat_alloc" = "yes" -a \
363 "$ac_cv_lib_avformat_av_close_input_file" = "yes" -a \
364 "$ac_cv_lib_avformat_av_find_stream_info" = "yes" -a \
365 "$ac_cv_lib_avformat_av_open_input_file" = "yes" -a \
366 "$ac_cv_lib_avformat_av_probe_input_format" = "yes" -a \
367 "$ac_cv_lib_avformat_av_read_frame" = "yes" -a \
368 "$ac_cv_lib_avformat_av_register_all" = "yes" -a \
369 "$ac_cv_lib_avformat_av_seek_frame" = "yes" -a \
370 "$ac_cv_lib_avformat_avcodec_find_decoder" = "yes" -a \
371 "$ac_cv_lib_avformat_avcodec_open" = "yes" -a \
372 "$ac_cv_lib_avformat_url_fopen" = "yes"; then
373 sxe_cv_feat_ffmpeg="yes"
375 sxe_cv_feat_ffmpeg="no"
378 ## newer ffmpegs want a bioctx** in url_fopen, check that
379 AC_MSG_CHECKING([what url_fopen() needs])
380 sxe_cv_tmp_ffmpeg_url_fopen="uncertain"
383 CPPFLAGS="$CPPFLAGS ${FFMPEG_CPPFLAGS}"
384 SXE_LANG_WERROR([off])
385 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
386 #if defined HAVE_ERRNO_H
389 #if defined HAVE_LIBAVFORMAT_AVFORMAT_H
390 # include <libavformat/avformat.h>
391 #elif defined HAVE_FFMPEG_AVFORMAT_H
392 # include <ffmpeg/avformat.h>
393 #elif defined HAVE_AVFORMAT_H
394 # include <avformat.h>
397 extern int foobar(void);
400 ByteIOContext *bioctx = 0;
402 url_fopen(&bioctx, "/foobar", URL_RDONLY);
405 ]])], [sxe_cv_tmp_ffmpeg_url_fopen="ByteIOContext**"], [:])
409 CPPFLAGS="$CPPFLAGS ${FFMPEG_CPPFLAGS}"
410 SXE_LANG_WERROR([on])
411 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
412 #if defined HAVE_ERRNO_H
415 #if defined HAVE_LIBAVFORMAT_AVFORMAT_H
416 # include <libavformat/avformat.h>
417 #elif defined HAVE_FFMPEG_AVFORMAT_H
418 # include <ffmpeg/avformat.h>
419 #elif defined HAVE_AVFORMAT_H
420 # include <avformat.h>
423 extern int foobar(void);
426 ByteIOContext *bioctx = 0;
428 url_fopen(bioctx, "/foobar", URL_RDONLY);
431 ]])], [sxe_cv_tmp_ffmpeg_url_fopen="ByteIOContext*"], [:])
435 AC_MSG_RESULT([$sxe_cv_tmp_ffmpeg_url_fopen])
437 if test "$sxe_cv_tmp_ffmpeg_url_fopen" = "ByteIOContext**"; then
438 AC_DEFINE([FFMPEG_URL_FOPEN_BIOCTX_STAR_STAR], [1],
439 [Whether url_fopen want a ByteIOContext**])
440 elif test "$sxe_cv_tmp_ffmpeg_url_fopen" = "ByteIOContext*"; then
441 AC_DEFINE([FFMPEG_URL_FOPEN_BIOCTX_STAR], [1],
442 [Whether url_fopen want a ByteIOContext*])
444 sxe_cv_feat_ffmpeg="no"
447 if test "$sxe_cv_feat_ffmpeg" = "yes"; then
455 popdef([ACTION_IF_FOUND])
456 popdef([ACTION_IF_NOT_FOUND])
457 ])dnl SXE_MM_CHECK_FFMPEG
459 AC_DEFUN([SXE_CHECK_FFMPEG_HEADERS], [dnl
460 FFMPEG_CPPFLAGS="$(${PKG_CONFIG} --cflags libavformat)"
462 ## backup current configuration
464 CPPFLAGS="${CPPFLAGS} ${FFMPEG_CPPFLAGS}"
465 AC_CHECK_HEADERS([avformat.h ffmpeg/avformat.h libavformat/avformat.h])
466 ## restore configuration
468 ])dnl SXE_CHECK_FFMPEG_HEADERS
470 AC_DEFUN([SXE_CHECK_FFMPEG_LIBS], [dnl
471 FFMPEG_LDFLAGS="$(${PKG_CONFIG} --libs-only-other libavformat) \
472 $(${PKG_CONFIG} --libs-only-L libavformat)"
473 FFMPEG_LIBS="$(${PKG_CONFIG} --libs-only-l libavformat)"
475 ## backup current configuration
477 LDFLAGS="${LDFLAGS} ${FFMPEG_LDFLAGS}"
479 AC_CHECK_LIB([avformat], [av_open_input_file], [:], [:], [${FFMPEG_LIBS}])
480 AC_CHECK_LIB([avformat], [av_close_input_file], [:], [:], [${FFMPEG_LIBS}])
481 AC_CHECK_LIB([avformat], [av_find_stream_info], [:], [:], [${FFMPEG_LIBS}])
482 AC_CHECK_LIB([avformat], [url_fopen], [:], [:], [${FFMPEG_LIBS}])
483 AC_CHECK_LIB([avformat], [av_probe_input_format], [:], [:], [${FFMPEG_LIBS}])
484 AC_CHECK_LIB([avformat], [avcodec_find_decoder], [:], [:], [${FFMPEG_LIBS}])
485 AC_CHECK_LIB([avformat], [avcodec_open], [:], [:], [${FFMPEG_LIBS}])
486 AC_CHECK_LIB([avformat], [av_read_frame], [:], [:], [${FFMPEG_LIBS}])
487 AC_CHECK_LIB([avformat], [av_seek_frame], [:], [:], [${FFMPEG_LIBS}])
488 AC_CHECK_LIB([avformat], [av_register_all], [:], [:], [${FFMPEG_LIBS}])
489 AC_CHECK_LIB([avformat], [avcodec_decode_audio], [:], [:], [${FFMPEG_LIBS}])
490 AC_CHECK_LIB([avformat], [avcodec_decode_audio2], [:], [:], [${FFMPEG_LIBS}])
492 AC_CHECK_LIB([avformat], [av_alloc_format_context], [:], [:], [${FFMPEG_LIBS}])
493 AC_CHECK_LIB([avformat], [avformat_alloc_context], [:], [:], [${FFMPEG_LIBS}])
494 AC_CHECK_LIB([avformat], [register_protocol], [:], [:], [${FFMPEG_LIBS}])
495 AC_CHECK_LIB([avformat], [av_register_protocol], [:], [:], [${FFMPEG_LIBS}])
497 if test "$ac_cv_lib_avformat_av_alloc_format_context" = "yes"; then
498 AC_DEFINE([HAVE_AV_ALLOC_FORMAT_CONTEXT], [1], [Description here!])
500 if test "$ac_cv_lib_avformat_avformat_alloc_context" = "yes"; then
501 AC_DEFINE([HAVE_AVFORMAT_ALLOC_CONTEXT], [1], [Description here!])
504 if test "$ac_cv_lib_avformat___avcodec_decode_audio2" = "yes" -o \
505 "$ac_cv_lib_avformat_avcodec_decode_audio2" = "yes"; then
506 AC_DEFINE([HAVE_AVCODEC_DECODE_AUDIO2], [1], [Description here!])
508 if test "$ac_cv_lib_avformat___avcodec_decode_audio" = "yes" -o \
509 "$ac_cv_lib_avformat_avcodec_decode_audio" = "yes"; then
510 AC_DEFINE([HAVE_AVCODEC_DECODE_AUDIO], [1], [Description here!])
513 if test "$ac_cv_lib_avformat_av_register_protocol" = "yes"; then
514 AC_DEFINE([HAVE_AV_REGISTER_PROTOCOL], [1], [Description here!])
516 if test "$ac_cv_lib_avformat_register_protocol" = "yes"; then
517 AC_DEFINE([HAVE_REGISTER_PROTOCOL], [1], [Description here!])
520 ## restore configuration
522 ])dnl SXE_CHECK_FFMPEG_LIBS
528 AC_DEFUN([SXE_MM_CHECK_SOX], [dnl
529 ## call like this SXE_MM_CHECK_SOX([<if-found>], [<if-not-found>])
530 ## arg #1: action on success
531 ## arg #2: action on failure
532 pushdef([ACTION_IF_FOUND], [$1])
533 pushdef([ACTION_IF_NOT_FOUND], [$2])
535 AC_CACHE_CHECK([for SoX support], [sxe_cv_feat_sox], [_SXE_CHECK_SOX])
537 if test "$sxe_cv_feat_sox" = "yes"; then
545 popdef([ACTION_IF_FOUND])
546 popdef([ACTION_IF_NOT_FOUND])
547 ])dnl SXE_MM_CHECK_SOX
549 AC_DEFUN([_SXE_CHECK_SOX], [dnl
550 AC_REQUIRE([SXE_CHECK_SOX_LOCATIONS])
552 if test "$have_smelly_sox" = "yes"; then
555 SXE_CHECK_SOX_HEADERS
557 SXE_CHECK_SOX_STRUCTS
559 if test "$ac_cv_lib_sox_sox_open_read" = "yes" -a \
560 "$ac_cv_lib_sox_sox_close" = "yes" -a \
561 "$ac_cv_lib_sox_sox_seek" = "yes" -a \
562 "$ac_cv_header_sox_h" = "yes" -a \
563 "$ac_cv_type_sox_format_t" = "yes" -a \
564 "$ac_cv_type_struct_sox_format_t" = "yes" -a \
565 "$sxe_cv_mm_sox_open_read_fooked" != "yes"; then
566 sxe_cv_feat_sox="yes"
574 AC_DEFUN([SXE_CHECK_SOX_LOCATIONS], [dnl
575 PKG_CHECK_MODULES([SOX], [sox >= 14.1.0], [dnl
577 sox_cppflags="$SOX_CFLAGS"
579 sox_libs="$SOX_LIBS"], [dnl
580 have_smelly_sox="yes"
581 AC_MSG_WARN([Your SoX is too old or non-existant. You need >= 14.1.0])])
582 ])dnl SXE_CHECK_SOX_PLACES
584 AC_DEFUN([SXE_PUMP_SOX_LOCATIONS], [dnl
586 CPPFLAGS="$CPPFLAGS $sox_cppflags"
587 LDFLAGS="$LDFLAGS $sox_ldflags"
588 LIBS="$LIBS $sox_libs"
589 ])dnl SXE_PUMP_SOX_LOCATIONS
591 AC_DEFUN([SXE_DUMP_SOX_LOCATIONS], [dnl
593 ])dnl SXE_DUMP_SOX_LOCATIONS
595 AC_DEFUN([SXE_CHECK_SOX_HEADERS], [dnl
596 AC_REQUIRE([SXE_CHECK_SOX_LOCATIONS])
597 SXE_PUMP_SOX_LOCATIONS
598 AC_CHECK_HEADERS([sox.h])
599 SXE_DUMP_SOX_LOCATIONS
600 ])dnl SXE_CHECK_SOX_HEADERS
602 AC_DEFUN([SXE_CHECK_SOX_LIBS], [dnl
603 AC_REQUIRE([SXE_CHECK_SOX_LOCATIONS])
605 echo "void cleanup(void) {}" > cleanup.c
606 $CC -c -o cleanup.o cleanup.c
608 SXE_PUMP_SOX_LOCATIONS
609 ## checks for the spankin' new sox
610 AC_CHECK_LIB([sox], [sox_open_read], [:], [:],
611 [cleanup.o $sox_ldflags $sox_libs])
612 AC_CHECK_LIB([sox], [sox_close], [:], [:], [cleanup.o $sox_ldflags $sox_libs])
613 AC_CHECK_LIB([sox], [sox_read], [:], [:], [cleanup.o $sox_ldflags $sox_libs])
614 AC_CHECK_LIB([sox], [sox_seek], [:], [:], [cleanup.o $sox_ldflags $sox_libs])
616 SXE_DUMP_SOX_LOCATIONS
619 CPPFLAGS="$CPPFLAGS ${SOX_CPPFLAGS}"
620 SXE_LANG_WERROR([on])
621 SXE_MSG_CHECKING([whether sox_open_read() takes 4 arguments])
622 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
623 #if defined HAVE_ERRNO_H
626 #if defined HAVE_SOX_H
630 sox_open_read("tmp", NULL, NULL, NULL);
632 [sxe_cv_mm_sox_open_read_4args="yes"],
633 [sxe_cv_mm_sox_open_read_4args="no"])
634 SXE_MSG_RESULT([$sxe_cv_mm_sox_open_read_4args])
636 SXE_MSG_CHECKING([whether sox_open_read() takes 3 arguments])
637 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
638 #if defined HAVE_ERRNO_H
641 #if defined HAVE_SOX_H
645 sox_open_read("tmp", NULL, NULL);
647 [sxe_cv_mm_sox_open_read_3args="yes"],
648 [sxe_cv_mm_sox_open_read_3args="no"])
649 SXE_MSG_RESULT([$sxe_cv_mm_sox_open_read_3args])
652 if test "$sxe_cv_mm_sox_open_read_3args" = "yes"; then
653 AC_DEFINE([HAVE_SOX_OPEN_READ_3ARGS], [1],
654 [Whether sox_open_read() takes 3 arguments.])
655 AC_DEFINE([HAVE_SOX_OPEN_READ_NARGS], [3],
656 [How many arguments sox_open_read() takes.])
657 elif test "$sxe_cv_mm_sox_open_read_4args" = "yes"; then
658 AC_DEFINE([HAVE_SOX_OPEN_READ_4ARGS], [1],
659 [Whether sox_open_read() takes 4 arguments.])
660 AC_DEFINE([HAVE_SOX_OPEN_READ_NARGS], [4],
661 [How many arguments sox_open_read() takes.])
664 Very weird SoX you've got there.
665 I better disable SoX on your behalf.
667 sxe_cv_mm_sox_open_read_fooked="yes"
670 ## clean up our cleanup snack
671 rm -f cleanup.c cleanup.o
672 ])dnl SXE_CHECK_SOX_LIBS
674 AC_DEFUN([SXE_CHECK_SOX_STRUCTS], [dnl
676 AC_CHECK_TYPES([sox_format_t], [:], [:], [
681 AC_CHECK_TYPES([sox_ssize_t], [:], [:], [
686 AC_CHECK_TYPES([sox_sample_t], [:], [:], [
691 AC_CHECK_TYPES([sox_signalinfo_t], [:], [:], [
692 #if defined HAVE_SOX_H
696 AC_CHECK_TYPES([struct sox_format_t], [:], [:], [
701 AC_CHECK_MEMBERS([struct sox_format_t.signal], [:], [:], [
707 AC_CHECK_MEMBERS([sox_signalinfo_t.precision], [:], [:], [
712 ])dnl SXE_CHECK_SOX_STRUCTS
715 AC_DEFUN([SXE_MM_CHECK_MAD], [
716 ## arg #1: action on success
717 ## arg #2: action on failure
718 pushdef([MM_SUCC], [$1])
719 pushdef([MM_FAIL], [$2])
721 AC_MSG_CHECKING([for mad support])
725 SXE_CHECK_HEADERS([mad.h], [:], [MM_FAIL])
726 AC_CHECK_LIB([mad], [mad_synth_init], [:], [MM_FAIL])
727 AC_CHECK_LIB([mad], [mad_stream_init], [:], [MM_FAIL])
728 AC_CHECK_LIB([mad], [mad_frame_init], [:], [MM_FAIL])
729 AC_CHECK_LIB([mad], [mad_synth_frame], [:], [MM_FAIL])
730 AC_CHECK_LIB([mad], [mad_stream_buffer], [:], [MM_FAIL])
731 AC_CHECK_LIB([mad], [mad_frame_decode], [:], [MM_FAIL])
735 ])dnl SXE_MM_CHECK_MAD
737 AC_DEFUN([SXE_MM_CHECK_MAGIC], [
738 ## assumes $PKG_CONFIG is defined
739 ## arg #1: action on success
740 ## arg #2: action on failure
741 pushdef([MM_SUCC], [$1])
742 pushdef([MM_FAIL], [$2])
744 AC_MSG_CHECKING([for libmagic/file support])
749 AC_CHECK_LIB([magic], [magic_open], [:], [MM_FAIL])
750 SXE_CHECK_HEADERS([magic.h], [:], [MM_FAIL])
751 SXE_CHECK_HEADERS([file.h])
756 ])dnl SXE_MM_CHECK_MAGIC
759 AC_DEFUN([SXE_MM_CHECK_OSS], [
760 ## arg #1: action on success
761 ## arg #2: action on failure
762 pushdef([MM_SUCC], [$1])
763 pushdef([MM_FAIL], [$2])
765 AC_MSG_CHECKING([for OSS support])
770 SXE_CHECK_HEADERS([machine/soundcard.h sys/soundcard.h linux/soundcard.h soundcard.h])
771 if test "$ac_cv_header_linux_soundcard_h"="yes" -o \
772 "$ac_cv_header_machine_soundcard_h"="yes" -o \
773 "$ac_cv_header_soundcard_h"="yes" -o \
774 "$ac_cv_header_sys_soundcard_h"="yes"
776 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
777 #if defined HAVE_MACHINE_SOUNDCARD_H && HAVE_MACHINE_SOUNDCARD_H
778 #include <machine/soundcard.h>
779 #elif defined HAVE_SYS_SOUNDCARD_H && HAVE_SYS_SOUNDCARD_H
780 #include <sys/soundcard.h>
781 #elif defined HAVE_LINUX_SOUNDCARD_H && HAVE_LINUX_SOUNDCARD_H
782 #include <linux/soundcard.h>
784 #include <soundcard.h>
787 [[ ioctl(0, SNDCTL_DSP_RESET, 0); ]])],
788 [oss_ioctl_linked=yes],
789 [oss_ioctl_linked=no])
790 if test "${oss_ioctl_linked}" = "no"
792 if test "${opsys}" = "netbsd"
794 AC_CHECK_LIB([ossaudio],[_oss_ioctl],
796 # netbsd needs this Linux OSS emulator library, just a ioctl
799 SXE_PREPEND([-lossaudio], [MM_LIBS])
810 ])dnl SXE_MM_CHECK_OSS
812 AC_DEFUN([SXE_MM_CHECK_PULSE], [
813 ## assumes $PKG_CONFIG is defined
814 ## arg #1: action on success
815 ## arg #2: action on failure
817 PKG_CHECK_MODULES([PULSE], [libpulse >= 2.0.0], [$1], [$2])
818 ])dnl SXE_MM_CHECK_PULSE
820 AC_DEFUN([SXE_MM_CHECK_JACK], [
821 ## assumes $PKG_CONFIG is defined
822 ## arg #1: action on success
823 ## arg #2: action on failure
825 _SXE_MM_CHECK_pkgconfig_based([jack], [jack], [0.98.0], [dnl
826 jack_client_open jack_get_ports jack_port_register dnl
827 jack_set_process_callback jack_set_error_function dnl
828 jack_on_shutdown jack_activate jack_connect jack_disconnect dnl
829 jack_client_close jack_port_get_buffer], [jack/jack.h], [$1], [$2])
830 ])dnl SXE_MM_CHECK_JACK
832 AC_DEFUN([SXE_MM_CHECK_AO], [
833 ## assumes $PKG_CONFIG is defined
834 ## arg #1: action on success
835 ## arg #2: action on failure
837 _SXE_MM_CHECK_pkgconfig_based([ao], [ao], [0.6], [dnl
838 ao_initialize ao_driver_id ao_default_driver_id dnl
839 ao_open_live ao_close ao_shutdown ao_play], [ao/ao.h], [$1], [$2])
840 ])dnl SXE_MM_CHECK_AO
842 AC_DEFUN([SXE_MM_CHECK_ESD], [
843 ## arg #1: action on success
844 ## arg #2: action on failure
845 SXE_SEARCH_CONFIG_PROG([esd-config])
847 pushdef([MM_SUCC], [$1])
848 pushdef([MM_FAIL], [$2])
850 AC_MSG_CHECKING([for ESD support])
853 if test "$have_esd_config" = "no" -o -z "$ESD_CONFIG"; then
854 AS_MESSAGE([*** esd-config not found.])
855 AS_MESSAGE([*** Cannot check for ESD.])
861 if test "$have_esd_config" = "yes"; then
863 ESD_CPPFLAGS="`$ESD_CONFIG --cflags`"
864 ESD_LDFLAGS="-L`$ESD_CONFIG --libs`"
865 dnl SXE_APPEND_UNDUP([$esd_c_switch], [c_switch_site])
866 dnl SXE_PREPEND([$esd_libs], [LIBS])
867 CPPFLAGS="$CPPFLAGS $ESD_CPPFLAGS"
868 LDFLAGS="$LDFLAGS $ESD_LDFLAGS"
871 SXE_CHECK_HEADERS([esd.h], [:], [MM_FAIL])
872 AC_CHECK_LIB([esd], [esd_play_stream], [:], [MM_FAIL], [$esd_libs])
880 ])dnl SXE_MM_CHECK_ESD
882 AC_DEFUN([SXE_MM_CHECK_ALSA], [
883 ## call like this SXE_MM_CHECK_ALSA([<if-found>], [<if-not-found>])
884 ## defines HAVE_ALSA, HAVE_ALSA_SOUND
885 ## and sxe_cv_feat_alsa
886 pushdef([ACTION_IF_FOUND], [$1])
887 pushdef([ACTION_IF_NOT_FOUND], [$2])
889 AC_CACHE_CHECK([for ALSA support],
890 [sxe_cv_feat_alsa], [_SXE_MM_CHECK_ALSA])
892 if test "$sxe_cv_feat_alsa" = "yes"; then
893 AC_DEFINE([HAVE_ALSA], [1],
894 [Whether ALSA can be used as sound device])
895 AC_DEFINE([HAVE_ALSA_SOUND], [1],
896 [Whether ALSA can be used as sound device])
903 popdef([ACTION_IF_FOUND])
904 popdef([ACTION_IF_NOT_FOUND])
905 ])dnl SXE_MM_CHECK_ALSA
907 AC_DEFUN([_SXE_MM_CHECK_ALSA], [dnl
909 AC_REQUIRE([SXE_CHECK_ALSA_HEADERS])
910 AC_REQUIRE([SXE_CHECK_ALSA_VERSION])
911 AC_REQUIRE([SXE_CHECK_ALSA_LIBS])
913 if test "$ac_cv_header_alsa_input_h" = "yes" -a \
914 "$ac_cv_header_alsa_output_h" = "yes" -a \
915 "$ac_cv_header_alsa_global_h" = "yes" -a \
916 "$ac_cv_header_alsa_conf_h" = "yes" -a \
917 "$ac_cv_header_alsa_pcm_h" = "yes" -a \
918 "$ac_cv_header_alsa_error_h" = "yes" -a \
920 "$sxe_mm_alsa_version_supported_p" = "yes" -a \
922 "$ac_cv_lib_asound_snd_pcm_close" = "yes" -a \
923 "$ac_cv_lib_asound_snd_pcm_hw_free" = "yes" -a \
924 "$ac_cv_lib_asound_snd_pcm_hw_params_any" = "yes" -a \
925 "$ac_cv_lib_asound_snd_pcm_hw_params_free" = "yes" -a \
926 "$ac_cv_lib_asound_snd_pcm_hw_params_set_access" = "yes" -a \
927 "$ac_cv_lib_asound_snd_pcm_hw_params_set_channels" = "yes" -a \
928 "$ac_cv_lib_asound_snd_pcm_hw_params_set_format" = "yes" -a \
929 "$ac_cv_lib_asound_snd_pcm_hw_params_set_rate_near" = "yes" -a \
930 "$ac_cv_lib_asound_snd_pcm_hw_params_test_channels" = "yes" -a \
931 "$ac_cv_lib_asound_snd_pcm_hw_params_test_format" = "yes" -a \
932 "$ac_cv_lib_asound_snd_pcm_open" = "yes" -a \
933 "$ac_cv_lib_asound_snd_pcm_prepare" = "yes" -a \
934 "$ac_cv_lib_asound_snd_pcm_writei" = "yes"; then
935 sxe_cv_feat_alsa="yes"
937 sxe_cv_feat_alsa="no"
939 ])dnl _SXE_MM_CHECK_ALSA
941 AC_DEFUN([SXE_CHECK_ALSA_HEADERS], [dnl
942 ## dump the current configuration
944 SXE_LANG_WERROR([off])
945 SXE_CHECK_HEADERS([alsa/input.h alsa/output.h alsa/global.h])
946 SXE_CHECK_HEADERS([alsa/conf.h], [:], [:], [[
949 #if defined HAVE_ALSA_INPUT_H
950 # include <alsa/input.h>
952 #if defined HAVE_ALSA_OUTPUT_H
953 # include <alsa/output.h>
955 #if defined HAVE_ALSA_GLOBAL_H
956 # include <alsa/global.h>
959 SXE_CHECK_HEADERS([alsa/pcm.h alsa/error.h alsa/version.h], [:], [:], [[
962 #if defined HAVE_ALSA_INPUT_H
963 # include <alsa/input.h>
965 #if defined HAVE_ALSA_OUTPUT_H
966 # include <alsa/output.h>
968 #if defined HAVE_ALSA_GLOBAL_H
969 # include <alsa/global.h>
971 #if defined HAVE_ALSA_CONF_H
972 # include <alsa/conf.h>
977 ])dnl SXE_CHECK_ALSA_HEADERS
979 AC_DEFUN([SXE_CHECK_ALSA_VERSION], [dnl
980 AC_REQUIRE([SXE_CHECK_ALSA_HEADERS])
982 ## dump the configuration
984 SXE_LANG_WERROR([off])
985 AC_MSG_CHECKING([for alsa version])
987 AC_RUN_IFELSE([AC_LANG_SOURCE([[
990 #if defined HAVE_ALSA_INPUT_H
991 # include <alsa/input.h>
993 #if defined HAVE_ALSA_OUTPUT_H
994 # include <alsa/output.h>
996 #if defined HAVE_ALSA_GLOBAL_H
997 # include <alsa/global.h>
999 #if defined HAVE_ALSA_CONF_H
1000 # include <alsa/conf.h>
1002 #if defined HAVE_ALSA_PCM_H
1003 # include <alsa/pcm.h>
1005 #if defined HAVE_ALSA_ERROR_H
1006 # include <alsa/error.h>
1008 #if defined HAVE_ALSA_CONF_H
1009 # include <alsa/version.h>
1012 int main(int c, char *v[])
1014 fprintf(stdout, SND_LIB_VERSION_STR);
1016 }]])], dnl [./conftest; alsa_subminor=$?],[alsa_subminor=$?],[alsa_subminor=0]
1017 [sxe_mm_alsa_version=$(./conftest)],
1018 [:], [sxe_mm_alsa_version="undeterminable"])
1020 case "${sxe_mm_alsa_version}" in
1021 0.*.* | 1.0.3* | 1.0.9* )
1022 AC_MSG_RESULT([${sxe_mm_alsa_version} (known to break)])
1023 AC_MSG_WARN([Your ALSA version is _KNOWN_ to fail! Do not say we have not warned you!])
1024 sxe_mm_alsa_version_supported_p="no"
1026 1.0.2 | 1.0.4* | 1.0.5* | 1.0.6* | 1.0.7* | 1.0.8* )
1027 AC_MSG_RESULT([${sxe_mm_alsa_version} (suspicious to break)])
1028 AC_MSG_WARN([Your ALSA version has not been tested. Do not be surprised if it fails!])
1029 sxe_mm_alsa_version_supported_p="no"
1031 1.0.10* | 1.0.11* | 1.0.12* | 1.0.13* | 1.0.14* | 1.0.15* | 1.0.16* )
1032 AC_MSG_RESULT([${sxe_mm_alsa_version} (sane)])
1033 sxe_mm_alsa_version_supported_p="yes"
1036 AC_MSG_RESULT([${sxe_mm_alsa_version} (unknown)])
1037 AC_MSG_NOTICE([Your ALSA version is unknown, however we are confident that it works.])
1038 AC_MSG_NOTICE([However, if we screwed up something, please report back!])
1039 sxe_mm_alsa_version_supported_p="yes"
1042 AC_MSG_RESULT([${sxe_mm_alsa_version} (unknown)])
1043 AC_MSG_WARN([Your ALSA version is unknown hence not supported!])
1044 sxe_mm_alsa_version_supported_p="no"
1048 ## restore everything
1050 ])dnl SXE_CHECK_ALSA_VERSION
1052 AC_DEFUN([SXE_CHECK_ALSA_LIBS], [dnl
1053 ## dump the current configuration
1056 AC_CHECK_LIB([asound], [snd_pcm_open], [:], [:])
1057 AC_CHECK_LIB([asound], [snd_pcm_close], [:], [:])
1058 AC_CHECK_LIB([asound], [snd_pcm_hw_free], [:], [:])
1059 AC_CHECK_LIB([asound], [snd_pcm_hw_params_any], [:], [:])
1060 AC_CHECK_LIB([asound], [snd_pcm_hw_params_set_access], [:], [:])
1061 AC_CHECK_LIB([asound], [snd_pcm_hw_params_free], [:], [:])
1062 AC_CHECK_LIB([asound], [snd_pcm_hw_params_test_channels], [:], [:])
1063 AC_CHECK_LIB([asound], [snd_pcm_hw_params_test_format], [:], [:])
1064 AC_CHECK_LIB([asound], [snd_pcm_hw_params_set_channels], [:], [:])
1065 AC_CHECK_LIB([asound], [snd_pcm_hw_params_set_format], [:], [:])
1066 AC_CHECK_LIB([asound], [snd_pcm_hw_params_set_rate_near], [:], [:])
1067 AC_CHECK_LIB([asound], [snd_pcm_prepare], [:], [:])
1068 AC_CHECK_LIB([asound], [snd_pcm_writei], [:], [:])
1070 ## restore everything
1072 ])dnl SXE_CHECK_ALSA_LIBS
1076 AC_DEFUN([SXE_MM_CHECK_NAS], [
1077 ## arg #1: action on success
1078 ## arg #2: action on failure
1079 pushdef([MM_SUCC], [$1])
1080 pushdef([MM_FAIL], [$2])
1082 AC_MSG_CHECKING([for NAS support])
1088 ## NAS is often stored inside the X hierarchy, so ...
1089 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1090 LDFLAGS="$LDFLAGS $X_LIBS"
1091 SXE_CHECK_HEADERS([audio/audiolib.h], [:], [MM_FAIL])
1092 AC_CHECK_LIB([audio], [AuOpenServer], [:], [MM_FAIL])
1093 AC_CHECK_LIB([audio], [AuCloseServer], [:], [MM_FAIL])
1094 AC_CHECK_LIB([audio], [AuCreateFlow], [:], [MM_FAIL])
1095 AC_CHECK_LIB([audio], [AuStartFlow], [:], [MM_FAIL])
1096 AC_CHECK_LIB([audio], [AuStopFlow], [:], [MM_FAIL])
1097 AC_CHECK_LIB([audio], [AuScanForTypedEvent], [:], [MM_FAIL])
1098 AC_CHECK_LIB([audio], [AuDispatchEvent], [:], [MM_FAIL])
1099 AC_CHECK_LIB([audio], [AuSetErrorHandler], [:], [MM_FAIL])
1100 AC_CHECK_LIB([audio], [AuSetIOErrorHandler], [:], [MM_FAIL])
1101 AC_CHECK_LIB([audio], [AuWriteElement], [:], [MM_FAIL])
1102 AC_CHECK_LIB([audio], [AuSetElements], [:], [MM_FAIL])
1103 AC_CHECK_LIB([audio], [AuRegisterEventHandler], [:], [MM_FAIL])
1104 AC_CHECK_LIB([audio], [AuSetElementParameters], [:], [MM_FAIL])
1106 dnl If the nas library does not contain the error jump point,
1107 dnl then we force safer behavior.
1108 AC_EGREP_HEADER([AuXtErrorJump], [audio/Xtutil.h], [], [old_nas=yes])
1109 if test "$old_nas" = "yes"; then
1110 AC_DEFINE([NAS_NO_ERROR_JUMP], [1], [Description here!])
1118 ])dnl SXE_MM_CHECK_NAS
1120 dnl sxe-mm.m4 ends here