acinclude/esd.m4: update from mainstream esound tree, - revise for better compatibility with new autoconf, - remove HP/UX 9 (%@#!) support from it, - replace system("touch conf.esdtest") with fopen/fclose in the test code (see, e.g. glib-2.0.m4 -- sdl.m4 does the same.)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
diff --git a/acinclude/esd.m4 b/acinclude/esd.m4
index 979d1b8..9627e0b 100644
--- a/acinclude/esd.m4
+++ b/acinclude/esd.m4
@@ -8,7 +8,7 @@ dnl AM_PATH_ESD([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for ESD, and define ESD_CFLAGS and ESD_LIBS
dnl
AC_DEFUN([AM_PATH_ESD],
-[dnl
+[dnl
dnl Get the cflags and libraries from the esd-config script
dnl
AC_ARG_WITH(esd-prefix,[ --with-esd-prefix=PFX Prefix where ESD is installed (optional)],
@@ -48,6 +48,7 @@ AC_ARG_ENABLE(esdtest, [ --disable-esdtest Do not try to compile and run
esd_micro_version=`$ESD_CONFIG $esd_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test "x$enable_esdtest" = "xyes" ; then
+ AC_LANG_PUSH([C])
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $ESD_CFLAGS"
@@ -60,35 +61,16 @@ dnl
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
#include <esd.h>
-char*
-my_strdup (char *str)
-{
- char *new_str;
-
- if (str)
- {
- new_str = malloc ((strlen (str) + 1) * sizeof(char));
- strcpy (new_str, str);
- }
- else
- new_str = NULL;
-
- return new_str;
-}
-
-int main ()
+int main (void)
{
int major, minor, micro;
- char *tmp_version;
+ FILE *fp = fopen("conf.esdtest", "w");
- system ("touch conf.esdtest");
+ if (fp) fclose(fp);
- /* HP/UX 9 (%@#!) writes to sscanf strings */
- tmp_version = my_strdup("$min_esd_version");
- if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
+ if (sscanf("$min_esd_version", "%d.%d.%d", &major, &minor, µ) != 3) {
printf("%s, bad version string\n", "$min_esd_version");
exit(1);
}
@@ -110,15 +92,15 @@ int main ()
return 1;
}
}
-
-],, no_esd=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+], [], [no_esd=yes], [echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
+ AC_LANG_POP([C])
fi
fi
if test "x$no_esd" = x ; then
AC_MSG_RESULT(yes)
- ifelse([$2], , :, [$2])
+ ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
if test "$ESD_CONFIG" = "no" ; then
@@ -133,6 +115,7 @@ int main ()
echo "*** Could not run ESD test program, checking why..."
CFLAGS="$CFLAGS $ESD_CFLAGS"
LIBS="$LIBS $ESD_LIBS"
+ AC_LANG_PUSH([C])
AC_TRY_LINK([
#include <stdio.h>
#include <esd.h>
@@ -152,6 +135,7 @@ int main ()
echo "*** may want to edit the esd-config script: $ESD_CONFIG" ])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
+ AC_LANG_POP([C])
fi
fi
ESD_CFLAGS=""
@@ -162,3 +146,27 @@ int main ()
AC_SUBST(ESD_LIBS)
rm -f conf.esdtest
])
+
+dnl AM_ESD_SUPPORTS_MULTIPLE_RECORD([ACTION-IF-SUPPORTS [, ACTION-IF-NOT-SUPPORTS]])
+dnl Test, whether esd supports multiple recording clients (version >=0.2.21)
+dnl
+AC_DEFUN([AM_ESD_SUPPORTS_MULTIPLE_RECORD],
+[dnl
+ AC_MSG_NOTICE([whether installed esd version supports multiple recording clients])
+ ac_save_ESD_CFLAGS="$ESD_CFLAGS"
+ ac_save_ESD_LIBS="$ESD_LIBS"
+ AM_PATH_ESD(0.2.21,
+ ifelse([$1], , [
+ AM_CONDITIONAL(ESD_SUPPORTS_MULTIPLE_RECORD, true)
+ AC_DEFINE(ESD_SUPPORTS_MULTIPLE_RECORD, 1,
+ [Define if you have esound with support of multiple recording clients.])],
+ [$1]),
+ ifelse([$2], , [AM_CONDITIONAL(ESD_SUPPORTS_MULTIPLE_RECORD, false)], [$2])
+ if test "x$ac_save_ESD_CFLAGS" != x ; then
+ ESD_CFLAGS="$ac_save_ESD_CFLAGS"
+ fi
+ if test "x$ac_save_ESD_LIBS" != x ; then
+ ESD_LIBS="$ac_save_ESD_LIBS"
+ fi
+ )
+])