source: roaraudio/configure @ 528:d42830e32ea1

Last change on this file since 528:d42830e32ea1 was 528:d42830e32ea1, checked in by phi, 16 years ago

adding dummy IPX implementation: are there no docs? Can't even find correct socket() values!

  • Property exe set to *
File size: 4.3 KB
Line 
1#!/bin/sh
2
3#set -x
4
5TF_C=testit.c
6TF_E=./testit
7LDPATH=''
8
9echo -n "checking for C compiler... "
10CC=$(which gcc cc 2> /dev/null | head -n 1)
11if [ "$CC" = '' ]
12then
13 echo 'none'
14 exit 1;
15fi
16echo $CC
17
18#Makefile.conf not yet open, write it later
19
20
21while [ "$1" != '' ]
22do
23 case "$1" in
24  '--help')
25   echo '--help'
26   echo '--ldpath DIR'
27   exit 0;
28  ;;
29  '--ldpath')
30   LDPATH="$LDPATH -L$2"
31   shift;
32  ;;
33 esac;
34
35 shift;
36done
37
38
39CCTF="$CC $LDPATH -o $TF_E $TF_C"
40
41test_lib () {
42 echo > $TF_C
43
44 echo -n "checking for $1... "
45 shift;
46
47 LIBS=''
48
49 while [ "$1" != '--' ]
50 do
51  LIBS="$LIBS -l$1"
52  shift;
53 done
54
55 shift;
56
57 while [ "$1" != '' ]
58 do
59  echo "#include <$1>" >> $TF_C
60  shift;
61 done
62
63 echo 'int main (void) { return 0; }' >> $TF_C
64
65 $CCTF $LIBS 2> /dev/null;
66
67 R=$?
68
69 if [ "$R" = '0' ]
70 then
71  echo 'yes'
72 else
73  echo 'no'
74 fi
75
76 return $R
77}
78
79test_lib_defmake () {
80 def="$1"
81 subdir="$2"
82 shift
83 shift
84 lib="$2"
85
86 [ "$subdir" = '%' ] && subdir=''
87
88 if test_lib $@
89 then
90  echo "#define $def"            >&3
91  [ "$subdir" != '' ] && \
92   echo "subdir_$subdir=$subdir" >&4
93  echo "lib_$lib=-l$lib" >&4
94 else
95  [ "$subdir" != '' ] && \
96   echo "subdir_$subdir=" >&4
97  echo "lib_$lib=" >&4
98 fi
99}
100
101exec 3> config.h 4> Makefile.conf
102
103# now write the cc name to Makefile.conf
104echo "CC=$CC" >&4
105echo "LDPATH=$LDPATH" >&4
106
107cat >&3 << EOF
108//config.h:
109
110#ifndef _ROARAUDIO_CONFIG_H_
111#define _ROARAUDIO_CONFIG_H_
112
113EOF
114
115{
116 echo '/* uname: ' $(uname -a) '*/'
117 echo '/* Date : ' $(date)  '*/'
118 echo
119} >&3
120
121test_lib 'Math Library' m          -- math.h                         && echo '#define ROAR_HAVE_LIBM' >&3
122if test_lib 'realtime Library' rt -- sys/mman.h mqueue.h semaphore.h
123then
124 {
125  echo '#define ROAR_HAVE_LIBRT'
126  echo '#define ROAR_NEED_LIBRT'
127 } >&3
128fi
129
130echo >&3
131
132#                #define                 subdir       name          -lxxx      -- header
133test_lib_defmake ROAR_HAVE_ESD           libroaresd   EsounD        esd        -- esd.h
134test_lib_defmake ROAR_HAVE_LIBAO         %            libao         ao         -- ao/ao.h ao/plugin.h
135test_lib_defmake ROAR_HAVE_LIBVORBIS     %            libvorbis     vorbis     -- vorbis/codec.h
136test_lib_defmake ROAR_HAVE_LIBVORBISFILE %            libvorbisfile vorbisfile -- vorbis/vorbisfile.h
137test_lib_defmake ROAR_HAVE_LIBSPEEX      %            libspeex      speex      -- speex/speex.h speex/speex_stereo.h
138test_lib_defmake ROAR_HAVE_LIBCELT       %            libcelt       celt       -- celt/celt.h celt/celt_header.h
139test_lib_defmake ROAR_HAVE_LIBOGGZ       %            liboggz       oggz       -- oggz/oggz.h
140test_lib_defmake ROAR_HAVE_LIBSNDFILE    %            libsndfile    sndfile    -- sndfile.h
141test_lib_defmake ROAR_HAVE_LIBFISHSOUND  roarfish     libfishsound  fishsound  -- fishsound/fishsound.h
142test_lib_defmake ROAR_HAVE_LIBPULSE      libroarpulse libpulse      pulse      -- pulse/pulseaudio.h pulse/simple.h
143test_lib_defmake ROAR_HAVE_LIBY2         libroaryiff  libyiff       Y2         -- Y2/Y.h Y2/Ylib.h
144test_lib_defmake ROAR_HAVE_LIBARTSC      libroararts  libartsc      artsc      -- kde/artsc/artsc.h
145test_lib_defmake ROAR_HAVE_LIBDNET       %            libdnet       dnet       -- sys/socket.h netdnet/dn.h netdnet/dnetdb.h
146test_lib_defmake ROAR_HAVE_IPXSPX        %            IPX                      -- netipx/ipx.h
147
148# add a better test here
149test_lib 'linux sendfile()'       -- sys/sendfile.h && echo '#define ROAR_HAVE_LINUX_SENDFILE' >&3
150
151
152echo -n 'checking for mlock()... '
153
154echo '#include <sys/mman.h>' > $TF_C
155echo 'int main (void) { mlock((void*)0, 0); return 0; }' >> $TF_C
156
157if $CCTF 2> /dev/null;
158then
159 echo '#define ROAR_HAVE_MLOCK' >&3
160 echo yes
161else
162 echo no
163fi
164
165echo -n 'checking for safe 32 bit integer overflow... '
166
167cat > $TF_C << EOF
168#include <stdio.h>
169#include <stdint.h>
170#define TYPE uint32_t
171#define MAX  ((TYPE)4294967295U)
172
173int main (void) {
174 TYPE a = MAX;
175
176 a += 2;
177
178 if ( a == 1 ) {
179  printf("#define ROAR_HAVE_SAFE_OVERFLOW\n");
180  return 0;
181 }
182
183 return 1;
184}
185EOF
186
187if $CCTF 2> /dev/null;
188then
189 $TF_E >&3
190 if [ "$?" = '0' ]
191 then
192  echo yes
193 else
194  echo no
195 fi
196else
197 echo 'no (can not compile!, no stdint.h?)'
198fi
199
200echo -n 'checking if cp supports -v... '
201if cp -v --help > /dev/null 2> /dev/null
202then
203 echo "cp_v=-v" >&4
204 echo yes
205else
206 echo "cp_v=" >&4
207 echo no
208fi
209
210
211cat >&3 << EOF
212
213#endif
214
215//ll
216EOF
217
218rm -f $TF_C $TF_E
219
220mv config.h include/roaraudio/
221echo 'config.h created and moved into include/roaraudio/'
222
223#ll
Note: See TracBrowser for help on using the repository browser.