source: roaraudio/configure @ 1520:20fd14e97ead

Last change on this file since 1520:20fd14e97ead was 1520:20fd14e97ead, checked in by phi, 15 years ago

set TARGET_CYGWIN correctly

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