source: roaraudio/configure @ 360:39cf379de032

Last change on this file since 360:39cf379de032 was 360:39cf379de032, checked in by phi, 16 years ago

added math.h and changed celt to correct ROAR_HAVE_LIBCELT

  • Property exe set to *
File size: 2.7 KB
Line 
1#!/bin/sh
2
3#set -x
4
5TF_C=testit.c
6TF_E=./testit
7CC=cc
8
9CCTF="$CC -o $TF_E $TF_C"
10
11test_lib () {
12 echo > $TF_C
13
14 echo -n "checking for $1... "
15 shift;
16
17 LIBS=''
18
19 while [ "$1" != '--' ]
20 do
21  LIBS="$LIBS -l$1"
22  shift;
23 done
24
25 shift;
26
27 while [ "$1" != '' ]
28 do
29  echo "#include <$1>" >> $TF_C
30  shift;
31 done
32
33 echo 'int main (void) { return 0; }' >> $TF_C
34
35 $CCTF $LIBS 2> /dev/null;
36
37 R=$?
38
39 if [ "$R" = '0' ]
40 then
41  echo 'yes'
42 else
43  echo 'no'
44 fi
45
46 return $R
47}
48
49exec 3> config.h
50
51cat >&3 << EOF
52//config.h:
53
54#ifndef _ROARAUDIO_CONFIG_H_
55#define _ROARAUDIO_CONFIG_H_
56
57EOF
58
59{
60 echo '/* uname: ' $(uname -a) '*/'
61 echo '/* Date : ' $(date)  '*/'
62 echo
63} >&3
64
65test_lib 'Math Library' m          -- math.h                         && echo '#define ROAR_HAVE_LIBM' >&3
66test_lib EsounD         esd        -- esd.h                          && echo '#define ROAR_HAVE_ESD' >&3
67test_lib libao          ao         -- ao/ao.h ao/plugin.h            && echo '#define ROAR_HAVE_LIBAO' >&3
68test_lib libvorbis      vorbis     -- vorbis/codec.h                 && echo '#define ROAR_HAVE_LIBVORBIS' >&3
69test_lib libvorbisfile  vorbisfile -- vorbis/vorbisfile.h            && echo '#define ROAR_HAVE_LIBVORBISFILE' >&3
70test_lib libspeex       speex      -- speex/speex.h                  && echo '#define ROAR_HAVE_LIBSPEEX' >&3
71test_lib libcelt        celt       -- celt/celt.h celt/celt_header.h && echo '#define ROAR_HAVE_LIBCELT' >&3
72test_lib liboggz        oggz       -- oggz/oggz.h                    && echo '#define ROAR_HAVE_LIBOGGZ' >&3
73test_lib libfishsound   fishsound  -- fishsound/fishsound.h          && echo '#define ROAR_HAVE_LIBFISHSOUND' >&3
74test_lib libsndfile     sndfile    -- sndfile.h                      && echo '#define ROAR_HAVE_LIBSNDFILE' >&3
75
76# add a better test here
77test_lib 'linux sendfile()'       -- sys/sendfile.h && echo '#define ROAR_HAVE_LINUX_SENDFILE' >&3
78
79
80echo -n 'checking for mlock()... '
81
82echo '#include <sys/mman.h>' > $TF_C
83echo 'int main (void) { mlock((void*)0, 0); return 0; }' >> $TF_C
84
85if $CCTF 2> /dev/null;
86then
87 echo '#define ROAR_HAVE_MLOCK' >&3
88 echo yes
89else
90 echo no
91fi
92
93echo -n 'checking for save 32 bit integer overflow... '
94
95cat > $TF_C << EOF
96#include <stdio.h>
97#include <stdint.h>
98#define TYPE uint32_t
99#define MAX  ((TYPE)4294967295U)
100
101int main (void) {
102 TYPE a = MAX;
103
104 a += 2;
105
106 if ( a == 1 ) {
107  printf("#define ROAR_HAVE_SAFE_OVERFLOW\n");
108  return 0;
109 }
110
111 return 1;
112}
113EOF
114
115if $CCTF 2> /dev/null;
116then
117 $TF_E >&3
118 if [ "$?" = '0' ]
119 then
120  echo yes
121 else
122  echo no
123 fi
124else
125 echo 'no (can not compile!, no stdint.h?)'
126fi
127
128cat >&3 << EOF
129
130#endif
131
132//ll
133EOF
134
135rm -f $TF_C $TF_E
136
137mv config.h include/roaraudio/
138echo 'config.h created and moved into include/roaraudio/'
139
140#ll
Note: See TracBrowser for help on using the repository browser.