source: roaraudio/configure @ 2776:d5f84375ec76

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

test for libwinmm

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