/[svn]/linuxsampler/trunk/m4/arts.m4
ViewVC logotype

Contents of /linuxsampler/trunk/m4/arts.m4

Parent Directory Parent Directory | Revision Log Revision Log


Revision 838 - (show annotations) (download)
Fri Feb 10 14:57:40 2006 UTC (18 years, 1 month ago) by schoenebeck
File size: 6179 byte(s)
* added aRts audio output driver (by no means RT safe)

1 # Configure paths for ARTS
2 # Philip Stadermann 2001-06-21
3 # stolen from esd.m4
4 #
5 # Christian Schoenebeck 2006-02-09
6 # modified to work for a C++ environment
7
8 dnl --------------------------------------------------------------------------
9 dnl AM_PATH_ARTS([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
10 dnl Test for ARTS, and define ARTS_CFLAGS and ARTS_LIBS
11 dnl --------------------------------------------------------------------------
12 AC_DEFUN([AM_PATH_ARTS],
13 [dnl
14 dnl Get the cflags and libraries from the artsc-config script
15 dnl
16 AC_ARG_WITH(arts-prefix, AC_HELP_STRING([--with-arts-prefix=DIR], [prefix where ARTS is installed (optional)]),
17 arts_prefix="$withval", arts_prefix="")
18 AC_ARG_ENABLE(artstest, AC_HELP_STRING([--disable-artstest], [do not try to compile and run a test ARTS program]),
19 enable_artstest=$enableval, enable_artstest=yes)
20
21 if test x$arts_prefix != x ; then
22 arts_args="$arts_args --arts-prefix=$arts_prefix"
23 if test x${ARTS_CONFIG+set} != xset ; then
24 ARTS_CONFIG=$arts_prefix/bin/artsc-config
25 fi
26 fi
27
28 AC_LANG_SAVE
29 AC_LANG_C
30
31 AC_PATH_TOOL(ARTS_CONFIG, artsc-config, no)
32
33 min_arts_version=ifelse([$1], ,0.9.5,$1)
34 AC_MSG_CHECKING(for ARTS artsc - version >= $min_arts_version)
35 no_arts=""
36 if test "$ARTS_CONFIG" = "no" ; then
37 no_arts=yes
38 else
39 ARTS_CFLAGS=`$ARTS_CONFIG $artsconf_args --cflags`
40 ARTS_LIBS=`$ARTS_CONFIG $artsconf_args --libs`
41
42 arts_major_version=`$ARTS_CONFIG $arts_args --version | \
43 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
44 arts_minor_version=`$ARTS_CONFIG $arts_args --version | \
45 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
46 arts_micro_version=`$ARTS_CONFIG $arts_config_args --version | \
47 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
48 if test "x$enable_artstest" = "xyes" ; then
49 ac_save_CFLAGS="$CFLAGS"
50 ac_save_LIBS="$LIBS"
51 CFLAGS="$CFLAGS $ARTS_CFLAGS"
52 LIBS="$LIBS $ARTS_LIBS"
53 dnl
54 dnl Check if the installed ARTS is actually available -- when cross-compiling,
55 dnl we have probably detected the build system's version of artsc-config
56 dnl
57 AC_CHECK_LIB([artsc], [arts_init], [], [no_arts=yes], [$ARTS_LIBS])
58
59 dnl
60 dnl Now check if the installed ARTS is sufficiently new. (Also sanity
61 dnl checks the results of artsc-config to some extent)
62 dnl
63 rm -f conf.artstest
64 AC_TRY_RUN([
65 #include <stdio.h>
66 #include <stdlib.h>
67 #include <string.h>
68 #include <artsc.h>
69
70 char*
71 my_strdup (char *str)
72 {
73 char *new_str;
74
75 if (str)
76 {
77 new_str = malloc ((strlen (str) + 1) * sizeof(char));
78 strcpy (new_str, str);
79 }
80 else
81 new_str = NULL;
82
83 return new_str;
84 }
85
86 int main ()
87 {
88 int major, minor, micro;
89 char *tmp_version;
90
91 system ("touch conf.artstest");
92
93 /* HP/UX 9 (%@#!) writes to sscanf strings */
94 tmp_version = my_strdup("$min_arts_version");
95 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
96 printf("%s, bad version string\n", "$min_arts_version");
97 exit(1);
98 }
99
100 if (($arts_major_version > major) ||
101 (($arts_major_version == major) && ($arts_minor_version > minor)) ||
102 (($arts_major_version == major) && ($arts_minor_version == minor) && ($arts_micro_version >= micro)))
103 {
104 return 0;
105 }
106 else
107 {
108 printf("\n*** 'artsc-config --version' returned %d.%d.%d, but the minimum version\n", $arts_major_version, $arts_minor_version, $arts_micro_version);
109 printf("*** of ARTS required is %d.%d.%d. If artsc-config is correct, then it is\n", major, minor, micro);
110 printf("*** best to upgrade to the required version.\n");
111 printf("*** If artsc-config was wrong, set the environment variable ARTS_CONFIG\n");
112 printf("*** to point to the correct copy of artsc-config, and remove the file\n");
113 printf("*** config.cache before re-running configure\n");
114 return 1;
115 }
116 }
117
118 ],, no_arts=yes,
119 AC_TRY_LINK([
120 #include <stdio.h>
121 #include <artsc.h>
122 ], [ return 0; ],, no_arts=yes))
123 CFLAGS="$ac_save_CFLAGS"
124 LIBS="$ac_save_LIBS"
125 fi
126 fi
127 if test "x$no_arts" = x ; then
128 AC_MSG_RESULT(yes)
129 ifelse([$2], , :, [$2])
130 else
131 AC_MSG_RESULT(no)
132 if test "$ARTS_CONFIG" = "no" ; then
133 echo "*** The artsc-config script installed by ARTS could not be found"
134 echo "*** If ARTS was installed in PREFIX, make sure PREFIX/bin is in"
135 echo "*** your path, or set the ARTS_CONFIG environment variable to the"
136 echo "*** full path to artsc-config."
137 else
138 if test -f conf.artstest ; then
139 :
140 else
141 echo "*** Could not run ARTS test program, checking why..."
142 CFLAGS="$CFLAGS $ARTS_CFLAGS"
143 LIBS="$LIBS $ARTS_LIBS"
144 AC_TRY_LINK([
145 #include <stdio.h>
146 #include <artsc.h>
147 ], [ return 0; ],
148 [ echo "*** The test program compiled, but did not run. This usually means"
149 echo "*** that the run-time linker is not finding ARTS or finding the wrong"
150 echo "*** version of ARTS. If it is not finding ARTS, you'll need to set your"
151 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
152 echo "*** to the installed location Also, make sure you have run ldconfig if that"
153 echo "*** is required on your system"
154 echo "***"
155 echo "*** If you have an old version installed, it is best to remove it, although"
156 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
157 [ echo "*** The test program failed to compile or link. See the file config.log for the"
158 echo "*** exact error that occured. This usually means ARTS was incorrectly installed"
159 echo "*** or that you have moved ARTS since it was installed. In the latter case, you"
160 echo "*** may want to edit the artsc-config script: $ARTS_CONFIG" ])
161 CFLAGS="$ac_save_CFLAGS"
162 LIBS="$ac_save_LIBS"
163 fi
164 fi
165 ARTS_CFLAGS=""
166 ARTS_LIBS=""
167 ifelse([$3], , :, [$3])
168 fi
169 AC_SUBST(ARTS_CFLAGS)
170 AC_SUBST(ARTS_LIBS)
171 rm -f conf.artstest
172 AC_LANG_RESTORE
173 ])

  ViewVC Help
Powered by ViewVC