source: roaraudio/configure @ 1399:76ed08a98e30

Last change on this file since 1399:76ed08a98e30 was 1399:76ed08a98e30, checked in by phi, 15 years ago

info about --without-password-api

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