~ubuntu-branches/ubuntu/precise/mpeg4ip/precise

« back to all changes in this revision

Viewing changes to lib/SDLAudio/acinclude.m4

  • Committer: Bazaar Package Importer
  • Author(s): Mario Limonciello
  • Date: 2008-01-12 15:59:56 UTC
  • Revision ID: james.westby@ubuntu.com-20080112155956-1vznw5njidvrh649
Tags: upstream-1.6dfsg
ImportĀ upstreamĀ versionĀ 1.6dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Local macros for the SDL configure.in script
 
2
 
 
3
dnl Function to link an architecture specific file
 
4
dnl LINK_ARCH_SRC(source_dir, arch, source_file)
 
5
AC_DEFUN([COPY_ARCH_SRC],
 
6
[
 
7
  old="$srcdir/$1/$2/$3"
 
8
  new="$1/$3"
 
9
  if test ! -d $1; then
 
10
    echo "Creating directory $1"
 
11
    mkdir -p $1
 
12
  fi
 
13
  echo "Copying $old -> $new"
 
14
  cat >$new <<__EOF__
 
15
/* WARNING:  This file was automatically generated!
 
16
 * Original: $old
 
17
 */
 
18
__EOF__
 
19
  cat >>$new <$old
 
20
])
 
21
##############################################################################
 
22
dnl Configure Paths for Alsa
 
23
dnl Some modifications by Richard Boulton <richard-alsa@tartarus.org>
 
24
dnl Christopher Lansdown <lansdoct@cs.alfred.edu>
 
25
dnl Jaroslav Kysela <perex@suse.cz>
 
26
dnl Last modification: alsa.m4,v 1.23 2004/01/16 18:14:22 tiwai Exp
 
27
dnl AM_PATH_ALSA([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
 
28
dnl Test for libasound, and define ALSA_CFLAGS and ALSA_LIBS as appropriate.
 
29
dnl enables arguments --with-alsa-prefix=
 
30
dnl                   --with-alsa-enc-prefix=
 
31
dnl                   --disable-alsatest
 
32
dnl
 
33
dnl For backwards compatibility, if ACTION_IF_NOT_FOUND is not specified,
 
34
dnl and the alsa libraries are not found, a fatal AC_MSG_ERROR() will result.
 
35
dnl
 
36
AC_DEFUN([AM_PATH_ALSA],
 
37
[dnl Save the original CFLAGS, LDFLAGS, and LIBS
 
38
alsa_save_CFLAGS="$CFLAGS"
 
39
alsa_save_LDFLAGS="$LDFLAGS"
 
40
alsa_save_LIBS="$LIBS"
 
41
alsa_found=yes
 
42
 
 
43
dnl
 
44
dnl Get the cflags and libraries for alsa
 
45
dnl
 
46
AC_ARG_WITH(alsa-prefix,
 
47
[  --with-alsa-prefix=PFX  Prefix where Alsa library is installed(optional)],
 
48
[alsa_prefix="$withval"], [alsa_prefix=""])
 
49
 
 
50
AC_ARG_WITH(alsa-inc-prefix,
 
51
[  --with-alsa-inc-prefix=PFX  Prefix where include libraries are (optional)],
 
52
[alsa_inc_prefix="$withval"], [alsa_inc_prefix=""])
 
53
 
 
54
dnl FIXME: this is not yet implemented
 
55
AC_ARG_ENABLE(alsatest,
 
56
[  --disable-alsatest      Do not try to compile and run a test Alsa program],
 
57
[enable_alsatest="$enableval"],
 
58
[enable_alsatest=yes])
 
59
 
 
60
dnl Add any special include directories
 
61
AC_MSG_CHECKING(for ALSA CFLAGS)
 
62
if test "$alsa_inc_prefix" != "" ; then
 
63
        ALSA_CFLAGS="$ALSA_CFLAGS -I$alsa_inc_prefix"
 
64
        CFLAGS="$CFLAGS -I$alsa_inc_prefix"
 
65
fi
 
66
AC_MSG_RESULT($ALSA_CFLAGS)
 
67
 
 
68
dnl add any special lib dirs
 
69
AC_MSG_CHECKING(for ALSA LDFLAGS)
 
70
if test "$alsa_prefix" != "" ; then
 
71
        ALSA_LIBS="$ALSA_LIBS -L$alsa_prefix"
 
72
        LDFLAGS="$LDFLAGS $ALSA_LIBS"
 
73
fi
 
74
 
 
75
dnl add the alsa library
 
76
ALSA_LIBS="$ALSA_LIBS -lasound -lm -ldl -lpthread"
 
77
LIBS=`echo $LIBS | sed 's/-lm//'`
 
78
LIBS=`echo $LIBS | sed 's/-ldl//'`
 
79
LIBS=`echo $LIBS | sed 's/-lpthread//'`
 
80
LIBS=`echo $LIBS | sed 's/  //'`
 
81
LIBS="$ALSA_LIBS $LIBS"
 
82
AC_MSG_RESULT($ALSA_LIBS)
 
83
 
 
84
dnl Check for a working version of libasound that is of the right version.
 
85
min_alsa_version=ifelse([$1], ,0.1.1,$1)
 
86
AC_MSG_CHECKING(for libasound headers version >= $min_alsa_version)
 
87
no_alsa=""
 
88
    alsa_min_major_version=`echo $min_alsa_version | \
 
89
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
 
90
    alsa_min_minor_version=`echo $min_alsa_version | \
 
91
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
 
92
    alsa_min_micro_version=`echo $min_alsa_version | \
 
93
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
 
94
 
 
95
AC_LANG_SAVE
 
96
AC_LANG_C
 
97
AC_TRY_COMPILE([
 
98
#include <alsa/asoundlib.h>
 
99
], [
 
100
/* ensure backward compatibility */
 
101
#if !defined(SND_LIB_MAJOR) && defined(SOUNDLIB_VERSION_MAJOR)
 
102
#define SND_LIB_MAJOR SOUNDLIB_VERSION_MAJOR
 
103
#endif
 
104
#if !defined(SND_LIB_MINOR) && defined(SOUNDLIB_VERSION_MINOR)
 
105
#define SND_LIB_MINOR SOUNDLIB_VERSION_MINOR
 
106
#endif
 
107
#if !defined(SND_LIB_SUBMINOR) && defined(SOUNDLIB_VERSION_SUBMINOR)
 
108
#define SND_LIB_SUBMINOR SOUNDLIB_VERSION_SUBMINOR
 
109
#endif
 
110
 
 
111
#  if(SND_LIB_MAJOR > $alsa_min_major_version)
 
112
  exit(0);
 
113
#  else
 
114
#    if(SND_LIB_MAJOR < $alsa_min_major_version)
 
115
#       error not present
 
116
#    endif
 
117
 
 
118
#   if(SND_LIB_MINOR > $alsa_min_minor_version)
 
119
  exit(0);
 
120
#   else
 
121
#     if(SND_LIB_MINOR < $alsa_min_minor_version)
 
122
#          error not present
 
123
#      endif
 
124
 
 
125
#      if(SND_LIB_SUBMINOR < $alsa_min_micro_version)
 
126
#        error not present
 
127
#      endif
 
128
#    endif
 
129
#  endif
 
130
exit(0);
 
131
],
 
132
  [AC_MSG_RESULT(found.)],
 
133
  [AC_MSG_RESULT(not present.)
 
134
   ifelse([$3], , [AC_MSG_ERROR(Sufficiently new version of libasound not found.)])
 
135
   alsa_found=no]
 
136
)
 
137
AC_LANG_RESTORE
 
138
 
 
139
dnl Now that we know that we have the right version, let's see if we have the library and not just the headers.
 
140
if test "x$enable_alsatest" = "xyes"; then
 
141
AC_CHECK_LIB([asound], [snd_ctl_open],,
 
142
        [ifelse([$3], , [AC_MSG_ERROR(No linkable libasound was found.)])
 
143
         alsa_found=no]
 
144
)
 
145
fi
 
146
 
 
147
if test "x$alsa_found" = "xyes" ; then
 
148
   ifelse([$2], , :, [$2])
 
149
   LIBS=`echo $LIBS | sed 's/-lasound//g'`
 
150
   LIBS=`echo $LIBS | sed 's/  //'`
 
151
   LIBS="-lasound $LIBS"
 
152
fi
 
153
if test "x$alsa_found" = "xno" ; then
 
154
   ifelse([$3], , :, [$3])
 
155
   CFLAGS="$alsa_save_CFLAGS"
 
156
   LDFLAGS="$alsa_save_LDFLAGS"
 
157
   LIBS="$alsa_save_LIBS"
 
158
   ALSA_CFLAGS=""
 
159
   ALSA_LIBS=""
 
160
fi
 
161
 
 
162
dnl That should be it.  Now just export out symbols:
 
163
AC_SUBST(ALSA_CFLAGS)
 
164
AC_SUBST(ALSA_LIBS)
 
165
])
 
166
 
 
167
#
 
168
# --- esd.m4 ---
 
169
#
 
170
# Configure paths for ESD
 
171
# Manish Singh    98-9-30
 
172
# stolen back from Frank Belew
 
173
# stolen from Manish Singh
 
174
# Shamelessly stolen from Owen Taylor
 
175
 
 
176
dnl AM_PATH_ESD([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
 
177
dnl Test for ESD, and define ESD_CFLAGS and ESD_LIBS
 
178
dnl
 
179
AC_DEFUN([AM_PATH_ESD],
 
180
[dnl 
 
181
dnl Get the cflags and libraries from the esd-config script
 
182
dnl
 
183
AC_ARG_WITH(esd-prefix,[  --with-esd-prefix=PFX   Prefix where ESD is installed (optional)],
 
184
            esd_prefix="$withval", esd_prefix="")
 
185
AC_ARG_WITH(esd-exec-prefix,[  --with-esd-exec-prefix=PFX Exec prefix where ESD is installed (optional)],
 
186
            esd_exec_prefix="$withval", esd_exec_prefix="")
 
187
AC_ARG_ENABLE(esdtest, [  --disable-esdtest       Do not try to compile and run a test ESD program],
 
188
                    , enable_esdtest=yes)
 
189
 
 
190
  if test x$esd_exec_prefix != x ; then
 
191
     esd_args="$esd_args --exec-prefix=$esd_exec_prefix"
 
192
     if test x${ESD_CONFIG+set} != xset ; then
 
193
        ESD_CONFIG=$esd_exec_prefix/bin/esd-config
 
194
     fi
 
195
  fi
 
196
  if test x$esd_prefix != x ; then
 
197
     esd_args="$esd_args --prefix=$esd_prefix"
 
198
     if test x${ESD_CONFIG+set} != xset ; then
 
199
        ESD_CONFIG=$esd_prefix/bin/esd-config
 
200
     fi
 
201
  fi
 
202
 
 
203
  AC_PATH_PROG(ESD_CONFIG, esd-config, no)
 
204
  min_esd_version=ifelse([$1], ,0.2.7,$1)
 
205
  AC_MSG_CHECKING(for ESD - version >= $min_esd_version)
 
206
  no_esd=""
 
207
  if test "$ESD_CONFIG" = "no" ; then
 
208
    no_esd=yes
 
209
  else
 
210
    ESD_CFLAGS=`$ESD_CONFIG $esdconf_args --cflags`
 
211
    ESD_LIBS=`$ESD_CONFIG $esdconf_args --libs`
 
212
 
 
213
    esd_major_version=`$ESD_CONFIG $esd_args --version | \
 
214
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
 
215
    esd_minor_version=`$ESD_CONFIG $esd_args --version | \
 
216
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
 
217
    esd_micro_version=`$ESD_CONFIG $esd_config_args --version | \
 
218
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
 
219
    if test "x$enable_esdtest" = "xyes" ; then
 
220
      ac_save_CFLAGS="$CFLAGS"
 
221
      ac_save_LIBS="$LIBS"
 
222
      CFLAGS="$CFLAGS $ESD_CFLAGS"
 
223
      LIBS="$LIBS $ESD_LIBS"
 
224
dnl
 
225
dnl Now check if the installed ESD is sufficiently new. (Also sanity
 
226
dnl checks the results of esd-config to some extent
 
227
dnl
 
228
      rm -f conf.esdtest
 
229
      AC_TRY_RUN([
 
230
#include <stdio.h>
 
231
#include <stdlib.h>
 
232
#include <string.h>
 
233
#include <esd.h>
 
234
 
 
235
char*
 
236
my_strdup (char *str)
 
237
{
 
238
  char *new_str;
 
239
  
 
240
  if (str)
 
241
    {
 
242
      new_str = malloc ((strlen (str) + 1) * sizeof(char));
 
243
      strcpy (new_str, str);
 
244
    }
 
245
  else
 
246
    new_str = NULL;
 
247
  
 
248
  return new_str;
 
249
}
 
250
 
 
251
int main ()
 
252
{
 
253
  int major, minor, micro;
 
254
  char *tmp_version;
 
255
 
 
256
  system ("touch conf.esdtest");
 
257
 
 
258
  /* HP/UX 9 (%@#!) writes to sscanf strings */
 
259
  tmp_version = my_strdup("$min_esd_version");
 
260
  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
 
261
     printf("%s, bad version string\n", "$min_esd_version");
 
262
     exit(1);
 
263
   }
 
264
 
 
265
   if (($esd_major_version > major) ||
 
266
      (($esd_major_version == major) && ($esd_minor_version > minor)) ||
 
267
      (($esd_major_version == major) && ($esd_minor_version == minor) && ($esd_micro_version >= micro)))
 
268
    {
 
269
      return 0;
 
270
    }
 
271
  else
 
272
    {
 
273
      printf("\n*** 'esd-config --version' returned %d.%d.%d, but the minimum version\n", $esd_major_version, $esd_minor_version, $esd_micro_version);
 
274
      printf("*** of ESD required is %d.%d.%d. If esd-config is correct, then it is\n", major, minor, micro);
 
275
      printf("*** best to upgrade to the required version.\n");
 
276
      printf("*** If esd-config was wrong, set the environment variable ESD_CONFIG\n");
 
277
      printf("*** to point to the correct copy of esd-config, and remove the file\n");
 
278
      printf("*** config.cache before re-running configure\n");
 
279
      return 1;
 
280
    }
 
281
}
 
282
 
 
283
],, no_esd=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
 
284
       CFLAGS="$ac_save_CFLAGS"
 
285
       LIBS="$ac_save_LIBS"
 
286
     fi
 
287
  fi
 
288
  if test "x$no_esd" = x ; then
 
289
     AC_MSG_RESULT(yes)
 
290
     ifelse([$2], , :, [$2])     
 
291
  else
 
292
     AC_MSG_RESULT(no)
 
293
     if test "$ESD_CONFIG" = "no" ; then
 
294
       echo "*** The esd-config script installed by ESD could not be found"
 
295
       echo "*** If ESD was installed in PREFIX, make sure PREFIX/bin is in"
 
296
       echo "*** your path, or set the ESD_CONFIG environment variable to the"
 
297
       echo "*** full path to esd-config."
 
298
     else
 
299
       if test -f conf.esdtest ; then
 
300
        :
 
301
       else
 
302
          echo "*** Could not run ESD test program, checking why..."
 
303
          CFLAGS="$CFLAGS $ESD_CFLAGS"
 
304
          LIBS="$LIBS $ESD_LIBS"
 
305
          AC_TRY_LINK([
 
306
#include <stdio.h>
 
307
#include <esd.h>
 
308
],      [ return 0; ],
 
309
        [ echo "*** The test program compiled, but did not run. This usually means"
 
310
          echo "*** that the run-time linker is not finding ESD or finding the wrong"
 
311
          echo "*** version of ESD. If it is not finding ESD, you'll need to set your"
 
312
          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
 
313
          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
 
314
          echo "*** is required on your system"
 
315
          echo "***"
 
316
          echo "*** If you have an old version installed, it is best to remove it, although"
 
317
          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
 
318
        [ echo "*** The test program failed to compile or link. See the file config.log for the"
 
319
          echo "*** exact error that occured. This usually means ESD was incorrectly installed"
 
320
          echo "*** or that you have moved ESD since it was installed. In the latter case, you"
 
321
          echo "*** may want to edit the esd-config script: $ESD_CONFIG" ])
 
322
          CFLAGS="$ac_save_CFLAGS"
 
323
          LIBS="$ac_save_LIBS"
 
324
       fi
 
325
     fi
 
326
     ESD_CFLAGS=""
 
327
     ESD_LIBS=""
 
328
     ifelse([$3], , :, [$3])
 
329
  fi
 
330
  AC_SUBST(ESD_CFLAGS)
 
331
  AC_SUBST(ESD_LIBS)
 
332
  rm -f conf.esdtest
 
333
])
 
334