source: roaraudio/configure @ 1468:dd5c3b050dc6

Last change on this file since 1468:dd5c3b050dc6 was 1468:dd5c3b050dc6, checked in by phi, 15 years ago

check for select() and added --mmcu

  • Property exe set to *
File size: 25.4 KB
Line 
1#!/bin/sh
2
3# check for bash...
4
5if [ "$(echo -n)" = '-n' ]
6then
7 SHELL=$(which bash ksh sh 2> /dev/null | grep ^/ | head -n 1)
8 exec $SHELL $0 "$@"
9fi
10
11PATH="$PATH":/sbin:/usr/sbin:/usr/local/sbin:/usr/pkg/sbin # Ensure superuser paths
12
13#set -x
14
15TF_C=testit.c
16TF_E=./testit
17LDPATH=''
18INCPATH=''
19
20CROSS_COMPILE=false
21
22SYSNAME='unknown'
23SHARED='-shared'
24SHARED_CF=''
25fPIC=true
26MMCU=''
27PKG_CONFIG=false
28RUNTIME_DETECT=false
29
30PREFIX='/usr/local'
31PREFIX_BIN=''
32PREFIX_LIB=''
33PREFIX_INC=''
34PREFIX_MAN=''
35
36CDROM_IS_DEV=true
37CDROM="none"
38OSS_DEV="none"
39PROC_NET_DECNET="/proc/net/decnet"
40TTY_DEV="none"
41
42FSYNC=false
43
44DEFAULT_GRP=''
45
46AO_INST_DIR=''
47XMMS_INST_DIR=''
48
49LIBAO=true
50XMMS=true
51
52DEFAULT_RATE=''
53DEFAULT_CHANNELS=''
54DEFAULT_BITS=''
55
56ALAW=true
57MULAW=true
58ALAW_RW=true
59MULAW_RW=true
60
61PROXY=true
62
63PASSWORD_API=true
64
65WITHOUT_CF=''
66
67WITHOUT_VIO=''
68
69MINIMAL=false
70
71TARGET_WIN32=false
72TARGET_MICROCONTROLLER=false
73
74EXEC_HELPER=''
75
76ROAR_DRIVER_DEFAULT=''
77ROAR_DRIVER_CODEC=''
78
79echo -n "checking for C compiler... "
80if [ "$CC" != '' ]
81then
82 echo $CC
83else
84 CC=$(which gcc cc 2> /dev/null | grep ^/ | head -n 1)
85 if [ "$CC" = '' ]
86 then
87  echo 'none'
88  exit 1;
89 fi
90 echo $CC
91fi
92
93echo -n "checking for pkg-config... "
94PKG_CONFIG=$(which pkg-config false 2> /dev/null | grep ^/ | head -n 1)
95if $PKG_CONFIG --help > /dev/null 2> /dev/null
96then
97 echo $PKG_CONFIG
98else
99 echo no
100fi
101
102#Makefile.conf not yet open, write it later
103
104echo -n "checking for sysname... "
105SYSNAME=$(uname -s)
106echo "$SYSNAME"
107
108while [ "$1" != '' ]
109do
110 case "$1" in
111  '--help')
112   echo '--help                      - This Help'
113   echo
114   echo '--ldpath DIR                - Add DIR to (compile time) search list for libs'
115   echo '--incpath DIR               - Add DIR to search list for headers'
116   echo '--addpath DIR               - Add DIR/lib to lib, DIR/include to header search list'
117   echo
118   echo '--cdrom DEV                 - Set default CDRum device'
119   echo '--tty DEV                   - Set default TTY'
120   echo '--proc-net-decnet FILE      - Set DECnet file for DECnet support auto detecting'
121   echo '                              (ignore this on non-Linux)'
122   echo
123   echo '--no-LIB                    - disable library LIB'
124   echo '--runtime-detect            - do as much as posible auto detecting on runtime (for distributors)'
125   echo
126   echo '--ao-install-dir DIR        - Set install dir for libao plugin'
127   echo '--xmms-install-dir DIR      - Set install dir for XMMS plugin'
128   echo
129   echo '--prefix DIR                - Set general prefix (default: '"$PREFIX"')'
130   echo '--prefix-bin DIR            - Set prefix for binarys (default: $PREFIX/bin)'
131   echo '--prefix-lib DIR            - Set prefix for librarys (default: $PREFIX/libs)'
132   echo '--prefix-inc DIR            - Set prefix for include files (default: $PREFIX/include)'
133   echo '--prefix-man DIR            - Set prefix for manpages (default: $PREFIX/man)'
134   echo
135   echo '--default-rate RATE         - Set default sample rate for roard and roarclients'
136   echo '--default-channels CHANNELS - Set default number of channels for roard and roarclients'
137   echo '--default-bits BITS         - Set default number of bits per sample for roard and roarclients'
138   echo '--default-driver DRIVER     - Set default driver for roard'
139   echo '--default-codec CODEC       - Set default codec used for the default driver'
140   echo
141   echo '--without-alaw              - Disable support of A-Law codec (de- and encoding)'
142   echo '--without-alaw-rw           - Disable support for writing A-Law (saves 8KB)'
143   echo '--without-mulaw             - Disable support of mu-Law codec (de- and encoding)'
144   echo '--without-mulaw-rw          - Disable support for writing mu-Law (saves 16KB)'
145   echo '--without-proxy             - Disable support for proxys'
146   echo
147   echo '--without-cf-cmd            - Disable support for command codecfilter'
148   echo
149   echo '--without-vio-MODULE        - Disable support for VIO module MODULE'
150   echo
151   echo '--without-password-api      - Disable build of Password API'
152   echo
153   echo '--without-libao             - Disable build of libao plugin'
154   echo '--without-xmms              - Disable build of XMMS plugin'
155   echo
156   echo '--mmcu MMCU                 - Sets -mmcu compiler/linker option'
157   echo '--minimal                   - Disable all optional components'
158   echo '--cross-compile             - Enable cross compiler workarounds'
159   echo '--target-microcontroller    - Set Options for mircocontrollers without a OS'
160   echo '                              Implys --cross-compile'
161   echo '--target-win32              - Disable everything useful'
162   echo '--exec-helper HELPER        - Exec all test programms using this command (HELPER $cmd $args)'
163   echo '                              use '\''--exec-helper wine'\'' when building win32 binarys'
164   exit 0;
165  ;;
166  '--ldpath')
167   LDPATH="$LDPATH -L$2"
168   shift;
169  ;;
170  '--incpath')
171   INCPATH="$INCPATH -I$2"
172   shift;
173  ;;
174  '--addpath')
175   LDPATH="$LDPATH -L$2/lib/"
176   INCPATH="$INCPATH -I$2/include/"
177   shift;
178  ;;
179  '--cc')
180   CC="$2"
181   shift;
182  ;;
183  '--cdrom')
184   CDROM="$2"
185   shift;
186  ;;
187  '--tty')
188   TTY_DEV="$2"
189   shift;
190  ;;
191  '--oss-dev')
192   OSS_DEV="$2"
193   shift;
194  ;;
195  '--audio-group')
196   DEFAULT_GRP="$2"
197   shift;
198  ;;
199  '--no-'*)
200   lib=$(echo "$1" | sed 's/^--no-//')
201   eval no_lib_$lib=true
202  ;;
203  '--runtime-detect')
204   RUNTIME_DETECT=true
205  ;;
206  '--ao-install-dir')
207   AO_INST_DIR="$2"
208   shift;
209  ;;
210  '--xmms-install-dir')
211   XMMS_INST_DIR="$2"
212   shift;
213  ;;
214  '--default-rate')
215   DEFAULT_RATE="$2"
216   shift;
217  ;;
218  '--default-channels')
219   DEFAULT_CHANNELS="$2"
220   shift;
221  ;;
222  '--default-bits')
223   DEFAULT_BITS="$2"
224   shift;
225  ;;
226  '--default-driver')
227   ROAR_DRIVER_DEFAULT="$2"
228   shift;
229  ;;
230  '--default-codec')
231   ROAR_DRIVER_CODEC="$2"
232   shift;
233  ;;
234  '--without-alaw')
235   ALAW=false
236   ALAW_RW=false
237  ;;
238  '--without-alaw-rw')
239   ALAW_RW=false
240  ;;
241  '--without-mulaw')
242   MULAW=false
243   MULAW_RW=false
244  ;;
245  '--without-mulaw-rw')
246   MULAW_RW=false
247  ;;
248  '--without-proxy')
249   PROXY=false
250  ;;
251  '--without-cf-'*)
252   WITHOUT_CF="$WITHOUT_CF"' '$(echo "$1" | cut -d- -f5)
253  ;;
254  '--without-vio-'*)
255   WITHOUT_VIO="$WITHOUT_VIO"' '$(echo "$1" | cut -d- -f5)
256  ;;
257  '--without-password-api')
258   PASSWORD_API=false
259  ;;
260  '--without-libao')
261   LIBAO=false
262   no_lib_ao=true
263  ;;
264  '--without-xmms')
265   XMMS=false
266  ;;
267  '--minimal')
268   MINIMAL=true
269   RUNTIME_DETECT=false
270   XMMS=false
271   LIBAO=false
272   PROXY=false
273   MULAW=false
274   MULAW_RW=false
275   ALAW=false
276   ALAW_RW=false
277   PASSWORD_API=false
278   WITHOUT_VIO="$WITHOUT_VIO"' dstr cmd stdio'
279  ;;
280  '--prefix')
281   PREFIX="$2"
282   shift;
283  ;;
284  '--prefix-bin')
285   PREFIX_BIN="$2"
286   shift;
287  ;;
288  '--prefix-lib')
289   PREFIX_LIB="$2"
290   shift;
291  ;;
292  '--prefix-inc')
293   PREFIX_INC="$2"
294   shift;
295  ;;
296  '--prefix-man')
297   PREFIX_MAN="$2"
298   shift;
299  ;;
300  '--mmcu')
301   MMCU="$2"
302   shift;
303  ;;
304  '--cross-compile')
305   CROSS_COMPILE=true
306  ;;
307  '--exec-helper')
308   EXEC_HELPER="$2"
309   shift;
310  ;;
311  '--target-microcontroller')
312   TARGET_MICROCONTROLLER=true
313   CROSS_COMPILE=true
314  ;;
315  '--target-win32')
316   TARGET_WIN32=true
317   CROSS_COMPILE=true
318   RUNTIME_DETECT=true
319   no_lib_dnet=true
320   PROXY=false
321   XMMS=false
322   WITHOUT_VIO="$WITHOUT_VIO"' pipe' # hope that with buffered pipes we can remove this soon
323  ;;
324 esac;
325
326 shift;
327done
328
329
330CCTF="false"
331
332test_lib () {
333 echo > $TF_C
334
335 echo -n "checking for $1... "
336 shift;
337
338 LIBS=''
339
340 while [ "$1" != '--' ]
341 do
342  LIBS="$LIBS -l$1"
343  shift;
344 done
345
346 shift;
347
348 LIBS=$(echo "$LIBS" | sed 's/-l-l/-l/g; s/-l-L/-L/g;')
349
350 while [ "$1" != '' ]
351 do
352  echo "#include <$1>" >> $TF_C
353  shift;
354 done
355
356 echo 'int main (void) { return 0; }' >> $TF_C
357
358 $CCTF $LIBS 2> /dev/null;
359
360 R=$?
361
362 if [ "$R" = '0' ]
363 then
364  echo 'yes'
365 else
366  echo 'no'
367 fi
368
369 return $R
370}
371
372test_lib_defmake () {
373 def="$1"
374 subdir="$2"
375 shift
376 shift
377 name="$1"
378 lib="$2"
379 shift
380
381 [ "$subdir" = '%' ] && subdir=''
382
383 if [ "$lib" != '--' ]
384 then
385  eval _no="\$no_lib_$lib";
386  $MINIMAL && _no='XXX'
387
388  if [ "$_no" != '' ]
389  then
390    echo "checking for $name... disabled by user"
391   [ "$subdir" != '' ] && \
392    echo "subdir_$subdir=" >&4
393   echo "lib_$lib=" >&4
394   return;
395  fi
396 fi
397
398 LIBS=$($PKG_CONFIG --silence-errors --libs $lib 2> /dev/null)
399 if [ "$?" != '0' ]
400 then
401  LIBS="-l$lib"
402 fi
403
404 if test_lib "$name" $LIBS "$@"
405 then
406  subdir_var='subdir_'"`echo $subdir | tr / _`"
407  echo "#define $def"            >&3
408  [ "$subdir" != '' ] && \
409   echo "$subdir_var=$subdir" >&4
410  echo "lib_$lib=$LIBS" >&4
411 else
412  [ "$subdir" != '' ] && \
413   echo "subdir_$subdir=" >&4
414  echo "lib_$lib=" >&4
415 fi
416}
417
418test_tool_defmake () {
419 DEF="$1"
420 NAME="$2"
421 shift;
422 shift;
423 echo -n "checking for $NAME... "
424
425 if $RUNTIME_DETECT
426 then
427  echo "$1 (runtime detect)"
428 echo "#define $DEF "\""$1"\" >&3
429 elif $MINIMAL
430 then
431  echo "disabled by user (minimalstic build)"
432 else
433
434  LIST=$(which "$@" 2> /dev/null | grep ^/ | head -n 1)
435
436  if [ "$LIST" = '' ]
437  then
438   echo 'no'
439  else
440   echo $LIST
441   echo "#define $DEF "\""$LIST"\" >&3
442  fi
443 fi
444}
445
446exec 3> config.h 4> Makefile.conf
447
448if [ "$SYSNAME" = 'Darwin' ]
449then
450 echo "Adding $SYSNAME shared lib arguments..."
451 SHARED="$SHARED -fno-common -dynamiclib -compatibility_version 0.1 -current_version 0.1.0"
452 SHARED_CF="$SHARED_CF -fno-common"
453elif [ "$SYSNAME" = 'NetBSD' ]
454then
455 echo "Adding $SYSNAME libpath arguments..."
456 LDPATH="$LDPATH -L/usr/local/lib/"
457elif [ "$SYSNAME" = 'OpenBSD' ]
458then
459 echo "Adding $SYSNAME search path arguments..."
460 LDPATH="$LDPATH -L/usr/local/lib/"
461 INCPATH="$INCPATH -I/usr/local/include/"
462elif [ "$SYSNAME" = 'FreeBSD' ]
463then
464 echo "Adding $SYSNAME search path arguments..."
465 LDPATH="$LDPATH -L/usr/local/lib/"
466 INCPATH="$INCPATH -I/usr/local/include/"
467 [ "$DEFAULT_GRP" = '' ] && DEFAULT_GRP='wheel'
468elif $TARGET_WIN32
469then
470 echo "Adding win32 build arguments..."
471 fPIC=false
472fi
473
474[ "$PREFIX_BIN" = '' ] && PREFIX_BIN="$PREFIX/bin/"
475[ "$PREFIX_LIB" = '' ] && PREFIX_LIB="$PREFIX/lib/"
476[ "$PREFIX_INC" = '' ] && PREFIX_INC="$PREFIX/include/"
477[ "$PREFIX_MAN" = '' ] && PREFIX_MAN="$PREFIX/share/man/"
478
479[ "$DEFAULT_GRP" = '' ] && DEFAULT_GRP='audio'
480
481if [ "$MMCU" != '' ]
482then
483 CC="$CC -mmcu=$MMCU"
484fi
485
486# now write the cc name to Makefile.conf
487{
488 echo "SHARED=$SHARED"
489 echo "SHARED_CF=$SHARED_CF"
490 $fPIC && echo 'fPIC=-fPIC'
491 echo "CC=$CC"
492 echo "LDPATH=$LDPATH"
493 echo "INCPATH=$INCPATH"
494 echo "PREFIX=$PREFIX"
495 echo "PREFIX_BIN=$PREFIX_BIN"
496 echo "PREFIX_LIB=$PREFIX_LIB"
497 echo "PREFIX_INC=$PREFIX_INC"
498 echo "PREFIX_MAN=$PREFIX_MAN"
499} >&4
500
501CCTF="$CC $LDPATH $INCPATH -Iinclude/ -o $TF_E $TF_C"
502
503cat >&3 << EOF
504//config.h:
505
506#ifndef _ROARAUDIO_CONFIG_H_
507#define _ROARAUDIO_CONFIG_H_
508
509EOF
510
511{
512 echo '/* uname: ' $(uname -a) '*/'
513 echo '/* Date : ' $(date)  '*/'
514 echo
515 [ "$DEFAULT_RATE"        = '' ] || echo "#define ROAR_RATE_DEFAULT     $DEFAULT_RATE"
516 [ "$DEFAULT_CHANNELS"    = '' ] || echo "#define ROAR_CHANNELS_DEFAULT $DEFAULT_CHANNELS"
517 [ "$DEFAULT_BITS"        = '' ] || echo "#define ROAR_BITS_DEFAULT     $DEFAULT_BITS"
518 [ "$ROAR_DRIVER_DEFAULT" = '' ] || echo "#define ROAR_DRIVER_DEFAULT   \"$ROAR_DRIVER_DEFAULT\""
519 [ "$ROAR_DRIVER_CODEC"   = '' ] || echo "#define ROAR_DRIVER_CODEC     \"$ROAR_DRIVER_CODEC\""
520 echo
521 $ALAW         && echo '#define ROAR_SUPPORT_ALAW'
522 $ALAW_RW      && echo '#define ROAR_SUPPORT_ALAW_RW'
523 $MULAW        && echo '#define ROAR_SUPPORT_MULAW'
524 $MULAW_RW     && echo '#define ROAR_SUPPORT_MULAW_RW'
525 $PROXY        && echo '#define ROAR_SUPPORT_PROXY'
526 $PASSWORD_API && echo '#define ROAR_SUPPORT_PASSWORD_API'
527 echo
528
529 for i in $WITHOUT_CF
530 do
531  i=$(echo $i | tr /a-z/ /A-Z/);
532  echo '#define ROAR_WITHOUT_CF_'$i
533 done
534
535 for i in $WITHOUT_VIO
536 do
537  i=$(echo $i | tr /a-z/ /A-Z/);
538  echo '#define ROAR_WITHOUT_VIO_'$i
539 done
540
541 echo
542 $TARGET_MICROCONTROLLER && echo '#define ROAR_TARGET_MICROCONTROLLER'
543 $TARGET_WIN32           && echo '#define ROAR_TARGET_WIN32'
544                            echo '#define ROAR_OS_'$(echo $SYSNAME | tr a-z-. A-Z__)
545 echo
546} >&3
547
548#                 #define                   name         cmds...
549test_tool_defmake ROAR_HAVE_BIN_OGG123      ogg123       ogg123
550test_tool_defmake ROAR_HAVE_BIN_FLAC        flac         flac
551test_tool_defmake ROAR_HAVE_BIN_TIMIDITY    TiMidity++   timidity
552test_tool_defmake ROAR_HAVE_BIN_CDPARANOIA  cdparanoia   cdparanoia
553test_tool_defmake ROAR_HAVE_BIN_WGET        Wget         wget
554test_tool_defmake ROAR_HAVE_BIN_GNUPLOT     gnuplot      gnuplot
555test_tool_defmake ROAR_HAVE_BIN_SSH         OpenSSH      ssh
556test_tool_defmake ROAR_HAVE_BIN_PINENTRY    PIN-Entry    pinentry
557test_tool_defmake ROAR_HAVE_BIN_SSH_ASKPASS SSH-AskPass  ssh-askpass
558test_tool_defmake ROAR_HAVE_BIN_GZIP        Gzip         gzip
559test_tool_defmake ROAR_HAVE_BIN_BZIP2       bzip2        bzip2
560test_tool_defmake ROAR_HAVE_BIN_GPG         GnuPG        gpg
561test_tool_defmake ROAR_HAVE_BIN_CHAT        chat         chat
562
563echo >&3
564
565#                #define                 subdir       name           -lxxx      -- header
566test_lib_defmake ROAR_HAVE_LIBM          %            'Math Library' m          -- math.h
567if test_lib 'realtime Library' rt -- sys/mman.h mqueue.h semaphore.h
568then
569 {
570  echo '#define ROAR_HAVE_LIBRT'
571  echo '#define ROAR_NEED_LIBRT'
572 } >&3
573fi
574
575echo >&3
576
577#                #define                 subdir       name          -lxxx      -- header
578test_lib_defmake ROAR_HAVE_ESD           libroaresd   EsounD        esd        -- esd.h
579test_lib_defmake ROAR_HAVE_LIBAO         plugins/ao   libao         ao         -- ao/ao.h ao/plugin.h
580test_lib_defmake ROAR_HAVE_LIBVORBIS     %            libvorbis     vorbis     -- vorbis/codec.h
581test_lib_defmake ROAR_HAVE_LIBVORBISFILE %            libvorbisfile vorbisfile -- vorbis/vorbisfile.h
582test_lib_defmake ROAR_HAVE_LIBVORBISENC  %            libvorbisenc  vorbisenc  -- vorbis/vorbisenc.h
583test_lib_defmake ROAR_HAVE_LIBSPEEX      %            libspeex      speex      -- speex/speex.h speex/speex_stereo.h
584test_lib_defmake ROAR_HAVE_LIBSPEEXDSP   %            libspeexdsp   speexdsp   -- speex/speex.h speex/speex_stereo.h
585test_lib_defmake ROAR_HAVE_LIBCELT       %            libcelt       celt       -- celt/celt.h celt/celt_header.h
586test_lib_defmake ROAR_HAVE_LIBOGGZ       %            liboggz       oggz       -- oggz/oggz.h
587test_lib_defmake ROAR_HAVE_LIBSNDFILE    %            libsndfile    sndfile    -- sndfile.h
588test_lib_defmake ROAR_HAVE_LIBFISHSOUND  roarfish     libfishsound  fishsound  -- fishsound/fishsound.h
589test_lib_defmake ROAR_HAVE_LIBSHOUT      %            libshout      shout      -- shout/shout.h
590test_lib_defmake ROAR_HAVE_LIBPULSE      libroarpulse libpulse      pulse      -- pulse/pulseaudio.h pulse/simple.h
591test_lib_defmake ROAR_HAVE_LIBY2         libroaryiff  libyiff       Y2         -- Y2/Y.h Y2/Ylib.h
592test_lib_defmake ROAR_HAVE_LIBARTSC      libroararts  libartsc      artsc      -- kde/artsc/artsc.h
593test_lib_defmake ROAR_HAVE_LIBOSSAUDIO   %            libossaudio   ossaudio   -- sys/ioctl.h
594test_lib_defmake ROAR_HAVE_LIBSSL        %            OpenSSL       ssl        -- openssl/bio.h openssl/evp.h
595test_lib_defmake ROAR_HAVE_LIBDNET       %            libdnet       dnet       -- sys/socket.h netdnet/dn.h netdnet/dnetdb.h
596test_lib_defmake ROAR_HAVE_BSDSOCKETS    %            BSDSockets    c          -- sys/types.h sys/socket.h
597test_lib_defmake ROAR_HAVE_UNIX          %            UNIX          c          -- sys/types.h sys/socket.h sys/un.h
598test_lib_defmake ROAR_HAVE_IPX           %            IPX           c          -- netipx/ipx.h
599test_lib_defmake ROAR_HAVE_IPV4          %            IPv4          c          -- sys/types.h sys/socket.h 'netinet/in.h'
600test_lib_defmake ROAR_HAVE_OSS           %            OSS           c          -- sys/ioctl.h sys/soundcard.h
601test_lib_defmake ROAR_HAVE_OSS_BSD       %            BSDOSS        c          -- sys/ioctl.h soundcard.h
602test_lib_defmake ROAR_HAVE_LIBWSOCK32    %            WinSockP0     wsock32    -- winsock2.h
603test_lib_defmake ROAR_HAVE_LIBWS2_32     %            WinSockP1     ws2_32     -- winsock2.h
604
605echo >&3
606
607# Those tests should not be disbaled as they do not reduce the lib size just
608# break --minimal on full systems
609OLD_MINIMAL=$MINIMAL
610MINIMAL=false
611test_lib_defmake ROAR_HAVE_H_SYS_TYPES   %            sys/types.h   c          -- sys/types.h
612test_lib_defmake ROAR_HAVE_H_FCNTL       %            fcntl.h       c          -- fcntl.h
613test_lib_defmake ROAR_HAVE_H_UNISTD      %            unistd.h      c          -- unistd.h
614MINIMAL=$OLD_MINIMAL
615
616echo >&3
617
618# add a better test here
619test_lib 'linux sendfile()'       -- sys/sendfile.h && echo '#define ROAR_HAVE_LINUX_SENDFILE' >&3
620
621
622echo -n 'checking for IPv6... '
623
624if $MINIMAL
625then
626 echo "disabled by user (minimalstic build)"
627else
628 echo '#include <sys/socket.h>'  > $TF_C
629 echo '#include <netinet/in.h>' >> $TF_C
630 echo 'int main (void) { struct sockaddr_in6 in6; return 0; }' >> $TF_C
631
632 if $CCTF 2> /dev/null;
633 then
634  echo '#define ROAR_HAVE_IPV6' >&3
635  echo yes
636 else
637  echo no
638 fi
639fi
640
641
642echo -n 'checking for mlock()... '
643
644echo '#include <sys/mman.h>' > $TF_C
645echo 'int main (void) { mlock((void*)0, 0); return 0; }' >> $TF_C
646
647if $CCTF 2> /dev/null;
648then
649 echo '#define ROAR_HAVE_MLOCK' >&3
650 echo yes
651else
652 echo no
653fi
654
655echo -n 'checking for mmap()... '
656
657echo '#include <sys/mman.h>' > $TF_C
658echo 'int main (void) { mmap((void*)0, 0, 0, 0, 0, 0); return 0; }' >> $TF_C
659
660if $CCTF 2> /dev/null;
661then
662 echo '#define ROAR_HAVE_MMAP' >&3
663 echo yes
664else
665 echo no
666fi
667
668echo -n 'checking for fsync()... '
669
670echo '#include <unistd.h>' > $TF_C
671echo 'int main (void) { fsync(0); return 0; }' >> $TF_C
672
673if $CCTF 2> /dev/null;
674then
675 echo '#define ROAR_HAVE_FSYNC' >&3
676 FSYNC=true
677 echo yes
678else
679 FSYNC=false
680 echo no
681fi
682
683echo -n 'checking for fdatasync()... '
684
685echo '#include <unistd.h>' > $TF_C
686echo 'int main (void) { fdatasync(0); return 0; }' >> $TF_C
687
688if $CCTF 2> /dev/null;
689then
690 echo '#define ROAR_HAVE_FDATASYNC' >&3
691 echo '#define ROAR_FDATASYNC fdatasync' >&3
692 echo yes
693else
694 $FSYNC && echo '#define ROAR_FDATASYNC fsync' >&3
695 echo no
696fi
697
698echo -n 'checking for fopencookie()... '
699
700echo '#define _GNU_SOURCE' > $TF_C
701echo '#include <stdio.h>' >> $TF_C
702echo 'int main (void) { cookie_io_functions_t f; fopencookie(NULL, "", f); return 0; }' >> $TF_C
703
704if $CCTF 2> /dev/null;
705then
706 echo '#define ROAR_HAVE_FOPENCOOKIE' >&3
707 echo '#define ROAR_NEED_GNU_SOURCE' >&3
708 echo yes
709else
710 echo no
711fi
712
713echo -n 'checking for funopen()... '
714
715echo '#define __BSD_VISIBLE 1'  > $TF_C
716echo '#include <stdio.h>'      >> $TF_C
717echo 'int main (void) { funopen(NULL, NULL, NULL, NULL, NULL); return 0; }' >> $TF_C
718
719if $CCTF 2> /dev/null;
720then
721 echo '#define ROAR_HAVE_FUNOPEN' >&3
722 echo '#define ROAR_NEED_BSD_VISIBLE' >&3
723 echo yes
724else
725 echo no
726fi
727
728echo -n 'checking for pipe()... '
729
730echo '#include <unistd.h>'      > $TF_C
731echo 'int main (void) { pipe(NULL); return 0; }' >> $TF_C
732
733if $CCTF 2> /dev/null;
734then
735 echo '#define ROAR_HAVE_PIPE' >&3
736 echo yes
737else
738 echo no
739fi
740
741echo -n 'checking for fork()... '
742
743echo '#include <unistd.h>'      > $TF_C
744echo 'int main (void) { fork(); return 0; }' >> $TF_C
745
746if $CCTF 2> /dev/null;
747then
748 echo '#define ROAR_HAVE_FORK' >&3
749 echo yes
750else
751 echo no
752fi
753
754echo -n 'checking for wait()... '
755
756echo '#include <string.h>'        >  $TF_C
757echo '#include <sys/wait.h>'      >> $TF_C
758echo 'int main (void) { wait(NULL); return 0; }' >> $TF_C
759
760if $CCTF 2> /dev/null;
761then
762 echo '#define ROAR_HAVE_WAIT' >&3
763 echo yes
764else
765 echo no
766fi
767
768echo -n 'checking for square root func... '
769
770echo "$SYSNAME" | if grep CYGWIN > /dev/null
771then
772 echo 'sqrt() (cygwin)'
773elif [ "$SYSNAME" = 'FreeBSD' ]
774then
775 echo 'sqrt() (FreeBSD, fix your gcc)'
776else
777 echo '#include <math.h>' > $TF_C
778 echo 'int main (void) { sqrtl(0); return 0; }' >> $TF_C
779
780 if $CCTF -lm 2> /dev/null;
781 then
782  echo '#define ROAR_HAVE_SQRTL' >&3
783  echo 'sqrtl()'
784 else
785  echo 'sqrt()'
786 fi
787fi
788
789echo -n 'checking for inline funcs... '
790
791echo 'inline int test (void) { return 0; }' > $TF_C
792echo 'int main (void) { return test(); }'  >> $TF_C
793
794if $CCTF 2> /dev/null;
795then
796 echo '#define ROAR_HAVE_INLINE' >&3
797 echo yes
798else
799 echo no
800fi
801
802echo -n 'checking for broken peercred... '
803echo '#include <roaraudio.h>' > $TF_C
804echo 'int main (void) { struct ucred cred; return 0; }'  >> $TF_C
805
806if $CCTF 2> /dev/null;
807then
808 echo working
809else
810 echo '#define ROAR_BROKEN_PEERCRED' >&3
811 echo broken
812fi
813
814echo -n 'checking for getpeereid()... '
815echo '#include <roaraudio.h>' > $TF_C
816echo 'int main (void) { getpeereid(0, NULL, NULL); return 0; }'  >> $TF_C
817
818if $CCTF 2> /dev/null;
819then
820 echo '#define ROAR_HAVE_GETPEEREID' >&3
821 echo yes
822else
823 echo no
824fi
825
826echo -n 'checking for select()... '
827cat <<EOF > $TF_C
828#include <sys/select.h>
829#include <sys/time.h>
830#include <sys/types.h>
831#include <unistd.h>
832
833int main (void) {
834 fd_set rfds;
835 struct timeval tv;
836
837 FD_ZERO(&rfds);
838 FD_SET(0, &rfds);
839
840 tv.tv_sec  = 0;
841 tv.tv_usec = 0;
842
843 select(1, &rfds, NULL, NULL, &tv);
844
845 return 0;
846}
847EOF
848
849if $CCTF 2> /dev/null;
850then
851 echo '#define ROAR_HAVE_SELECT' >&3
852 echo yes
853else
854 echo no
855fi
856
857echo -n 'checking for getobjectbyname()... '
858echo '#include <netdnet/dn.h>'     >  $TF_C
859echo '#include <netdnet/dnetdb.h>' >> $TF_C
860echo 'int main (void) { getobjectbyname(NULL); return 0; }'  >> $TF_C
861
862if $CCTF 2> /dev/null;
863then
864 echo '#define ROAR_HAVE_GETOBJECTBYNAME' >&3
865 echo yes
866else
867 echo no
868fi
869
870echo -n 'checking for getservbyname()... '
871echo '#include <netdb.h>' > $TF_C
872echo 'int main (void) { getservbyname((void*)0, (void*)0); return 0; }'  >> $TF_C
873
874if $CCTF 2> /dev/null;
875then
876 echo '#define ROAR_HAVE_GETSERVBYNAME' >&3
877 echo yes
878else
879 echo no
880fi
881
882echo -n 'checking for safe 32 bit integer overflow... '
883
884cat > $TF_C << EOF
885#include <stdio.h>
886#include <stdint.h>
887#define TYPE uint32_t
888#define MAX  ((TYPE)4294967295U)
889
890int main (void) {
891 TYPE a = MAX;
892
893 a += 2;
894
895 if ( a == 1 ) {
896  printf("#define ROAR_HAVE_SAFE_OVERFLOW\n");
897  return 0;
898 }
899
900 return 1;
901}
902EOF
903
904if $CCTF 2> /dev/null;
905then
906 $EXEC_HELPER $TF_E >&3
907 if [ "$?" = '0' ]
908 then
909  echo yes
910 else
911  echo no
912 fi
913else
914 echo 'no (can not compile!, no stdint.h?)'
915fi
916
917echo -n 'checking for __LP64__... '
918if $TARGET_WIN32
919then
920 echo 'need to set (win32 build)'
921else
922cat > $TF_C << EOF
923#include <stdio.h>
924
925int main (void) {
926#ifdef __LP64__
927 fprintf(stderr, "set by compiler\n");
928#else
929 if ( sizeof(int) == sizeof(void*) ) {
930  fprintf(stderr, "no need to set\n");
931 } else {
932  fprintf(stderr, "need to set\n");
933  printf("\n#ifndef __LP64__\n#define __LP64__\n#endif\n\n");
934 }
935#endif
936 return 0;
937}
938EOF
939 if $CCTF 2> /dev/null;
940 then
941  $EXEC_HELPER $TF_E >&3
942 else
943  echo 'error, can not compile'
944  exit 1
945 fi
946fi
947
948echo -n 'checking for 64 bit types... '
949if $TARGET_WIN32
950then
951 echo 'int64_t, uint64_t (win32 build)'
952 echo '#define ROAR_NATIVE_INT64  int64_t'  >&3
953 echo '#define ROAR_NATIVE_UINT64 uint64_t' >&3
954else
955cat > $TF_C << EOF
956#include <stdio.h>
957#include <stdint.h>
958
959int main (void) {
960 char * i64 = NULL, * ui64 = NULL;
961
962 if ( sizeof(int) == 8 ) {
963  i64 = "int"; ui64 = "unsigned int";
964 } else if ( sizeof(long int) == 8 ) {
965  i64 = "long int"; ui64 = "unsigned long int";
966 } else if ( sizeof(long long int) == 8 ) {
967  i64 = "long long int"; ui64 = "unsigned long long int";
968 } else if ( sizeof(int64_t) == 8 ) {
969  i64 = "int64_t"; ui64 = "uint64_t";
970 } else {
971  fprintf(stderr, "none\n");
972  return 0;
973 }
974
975 fprintf(stderr, "%s, %s\n", i64, ui64);
976 printf("#define ROAR_NATIVE_INT64 %s\n#define ROAR_NATIVE_UINT64 %s\n", i64, ui64);
977
978 return 0;
979}
980EOF
981 if $CCTF 2> /dev/null;
982 then
983  $EXEC_HELPER $TF_E >&3
984 else
985  echo 'error, can not compile'
986  exit 1
987 fi
988fi
989
990
991echo -n 'checking if cp supports -v... '
992if cp -v --help > /dev/null 2> /dev/null
993then
994 echo "cp_v=-v" >&4
995 echo yes
996else
997 echo "cp_v=" >&4
998 echo no
999fi
1000
1001echo -n 'checking for cdrom device... '
1002if [ -e "$CDROM" ]
1003then
1004 echo "$CDROM"
1005 echo '#define ROAR_DEFAULT_CDROM "'"$CDROM"'"' >&3
1006 echo '#define ROAR_HAVE_CDROM' >&3
1007elif $CROSS_COMPILE
1008then
1009 echo 'none (cross compiling, use --cdrom to enable CDROM support)'
1010else
1011 CDROM=$(ls /dev/cdrom /dev/rcd0c 2> /dev/null | head -n 1);
1012 if [ -e "$CDROM" ]
1013 then
1014  echo "$CDROM"
1015  echo '#define ROAR_DEFAULT_CDROM "'"$CDROM"'"' >&3
1016  echo '#define ROAR_HAVE_CDROM' >&3
1017 else
1018  echo 'none'
1019  echo '#define ROAR_HAVE_CDROM' >&3
1020 fi
1021fi
1022
1023echo -n 'checking for default tty device... '
1024if [ -e "$TTY_DEV" ]
1025then
1026 echo "$TTY_DEV"
1027 echo '#define ROAR_DEFAULT_TTY "'"$TTY_DEV"'"' >&3
1028else
1029 TTY_DEV=$(ls /dev/tty 2> /dev/null | head -n 1);
1030 if [ -e "$TTY_DEV" ]
1031 then
1032  echo "$TTY_DEV"
1033  echo '#define ROAR_DEFAULT_TTY "'"$TTY_DEV"'"' >&3
1034 else
1035  echo 'none'
1036 fi
1037fi
1038
1039echo -n 'checking for OSS device... '
1040if [ -e "$OSS_DEV" ]
1041then
1042 echo "$OSS_DEV"
1043 echo '#define ROAR_DEFAULT_OSS_DEV "'"$OSS_DEV"'"' >&3
1044else
1045 OSS_DEV=$(ls /dev/dsp /dev/audio 2> /dev/null | head -n 1);
1046 if [ -e "$OSS_DEV" ]
1047 then
1048  echo "$OSS_DEV"
1049  echo '#define ROAR_DEFAULT_OSS_DEV "'"$OSS_DEV"'"' >&3
1050 else
1051  echo 'none'
1052 fi
1053fi
1054
1055echo 'checking for decnet status file... '"$PROC_NET_DECNET"
1056echo '#define ROAR_PROC_NET_DECNET "'"$PROC_NET_DECNET"'"' >&3
1057
1058
1059echo 'checking for default audio group... '"$DEFAULT_GRP"
1060echo '#define ROAR_DEFAULT_SOCKGRP "'"$DEFAULT_GRP"'"' >&3
1061
1062cat >&3 << EOF
1063
1064#endif
1065
1066//ll
1067EOF
1068
1069cd plugins
1070
1071if $LIBAO
1072then
1073 echo 'running libao plugin configure...'
1074  cd ao/
1075 if [ "$AO_INST_DIR" = '' ]
1076 then
1077  ./configure --force-have-roar
1078 else
1079  ./configure --force-have-roar --inst-dir "$AO_INST_DIR"
1080 fi
1081 cd ..
1082else
1083 echo "running libao plugin configure... disabled by user"
1084fi
1085
1086if $XMMS
1087then
1088 echo 'running xmms plugin configure...'
1089  cd xmms/
1090 if [ "$XMMS_INST_DIR" = '' ]
1091 then
1092  ./configure --force-have-roar
1093 else
1094  ./configure --force-have-roar --inst-dir "$XMMS_INST_DIR"
1095 fi
1096 cd ..
1097else
1098 echo "running xmms plugin configure... disabled by user"
1099fi
1100
1101cd ..
1102
1103rm -f $TF_C $TF_E
1104
1105mv config.h include/roaraudio/
1106echo 'config.h created and moved into include/roaraudio/'
1107
1108echo "$SYSNAME" | if grep CYGWIN > /dev/null
1109then
1110 rm -f $TF_E.exe
1111 echo 'patching Makefiles for cygwin...'
1112 find . -name Makefile -print0 | xargs -0 sed 's/\.so/.dll'/g -i
1113fi
1114
1115#ll
Note: See TracBrowser for help on using the repository browser.