source: roaraudio/configure @ 416:3c1e97685b59

Last change on this file since 416:3c1e97685b59 was 390:728f3ccf4ce4, checked in by phi, 16 years ago

updated as we need speex/speex_stereo.h, too

  • Property exe set to *
File size: 2.9 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
66if test_lib 'realtime Library' rt -- sys/mman.h mqueue.h semaphore.h
67then
68 {
69  echo '#define ROAR_HAVE_LIBRT'
70  echo '#define ROAR_NEED_LIBRT'
71 } >&3
72fi
73
74echo >&3
75
76test_lib EsounD         esd        -- esd.h                              && echo '#define ROAR_HAVE_ESD' >&3
77test_lib libao          ao         -- ao/ao.h ao/plugin.h                && echo '#define ROAR_HAVE_LIBAO' >&3
78test_lib libvorbis      vorbis     -- vorbis/codec.h                     && echo '#define ROAR_HAVE_LIBVORBIS' >&3
79test_lib libvorbisfile  vorbisfile -- vorbis/vorbisfile.h                && echo '#define ROAR_HAVE_LIBVORBISFILE' >&3
80test_lib libspeex       speex      -- speex/speex.h speex/speex_stereo.h && echo '#define ROAR_HAVE_LIBSPEEX' >&3
81test_lib libcelt        celt       -- celt/celt.h celt/celt_header.h     && echo '#define ROAR_HAVE_LIBCELT' >&3
82test_lib liboggz        oggz       -- oggz/oggz.h                        && echo '#define ROAR_HAVE_LIBOGGZ' >&3
83test_lib libfishsound   fishsound  -- fishsound/fishsound.h              && echo '#define ROAR_HAVE_LIBFISHSOUND' >&3
84test_lib libsndfile     sndfile    -- sndfile.h                          && echo '#define ROAR_HAVE_LIBSNDFILE' >&3
85
86# add a better test here
87test_lib 'linux sendfile()'       -- sys/sendfile.h && echo '#define ROAR_HAVE_LINUX_SENDFILE' >&3
88
89
90echo -n 'checking for mlock()... '
91
92echo '#include <sys/mman.h>' > $TF_C
93echo 'int main (void) { mlock((void*)0, 0); return 0; }' >> $TF_C
94
95if $CCTF 2> /dev/null;
96then
97 echo '#define ROAR_HAVE_MLOCK' >&3
98 echo yes
99else
100 echo no
101fi
102
103echo -n 'checking for save 32 bit integer overflow... '
104
105cat > $TF_C << EOF
106#include <stdio.h>
107#include <stdint.h>
108#define TYPE uint32_t
109#define MAX  ((TYPE)4294967295U)
110
111int main (void) {
112 TYPE a = MAX;
113
114 a += 2;
115
116 if ( a == 1 ) {
117  printf("#define ROAR_HAVE_SAFE_OVERFLOW\n");
118  return 0;
119 }
120
121 return 1;
122}
123EOF
124
125if $CCTF 2> /dev/null;
126then
127 $TF_E >&3
128 if [ "$?" = '0' ]
129 then
130  echo yes
131 else
132  echo no
133 fi
134else
135 echo 'no (can not compile!, no stdint.h?)'
136fi
137
138cat >&3 << EOF
139
140#endif
141
142//ll
143EOF
144
145rm -f $TF_C $TF_E
146
147mv config.h include/roaraudio/
148echo 'config.h created and moved into include/roaraudio/'
149
150#ll
Note: See TracBrowser for help on using the repository browser.