source: roaraudio/configure @ 4731:c30218a490bd

Last change on this file since 4731:c30218a490bd was 4731:c30218a490bd, checked in by phi, 11 years ago

enable runtime detect on crosscompile

  • Property exe set to *
File size: 56.7 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
15# IDs officaly assigned
16DEV_VENDOR=0
17DEV_VENDOR_NAME='RoarAudio'
18#--------
19
20DISTRIBUTION_VERSION_STRING=''
21
22
23TF_C=testit.c
24TF_E=./testit
25LDPATH=''
26INCPATH=''
27
28CROSS_COMPILE=false
29
30SYSNAME='unknown'
31SHARED='-shared'
32SHARED_CF=''
33SHARED_SUFFIX='.so'
34COMPBIN_SUFFIX='.r'
35fPIC=true
36Wextra=false
37MMCU=''
38PKG_CONFIG=false
39RUNTIME_DETECT=false
40
41NEED_GNU_SOURCE=false
42
43PREFIX='/usr/local'
44PREFIX_BIN=''
45PREFIX_LIB=''
46PREFIX_INC=''
47PREFIX_MAN=''
48PREFIX_PC=''
49PREFIX_COMP_LIBS=''
50PREFIX_COMP_BINS=''
51
52CDROM_IS_DEV=true
53CDROM=""
54OSS_DEV=""
55OSS_MIX_DEV=""
56PROC_NET_DECNET="/proc/net/decnet"
57TTY_DEV=""
58
59ROOT_UID=''
60
61VORBIS_BITS=32
62
63FSYNC=false
64
65DEFAULT_GRP=''
66
67AO_INST_DIR=''
68XMMS_INST_DIR=''
69AUDACIOUS_INST_DIR=''
70
71SNDIO_EMUL=true
72
73LIBAO=true
74XMMS=true
75AUDACIOUS=true
76
77DEFAULT_RATE=''
78DEFAULT_CHANNELS=''
79DEFAULT_BITS=''
80
81COMP_LIBS=true
82COMP_ROARD=true
83COMP_CLIENTS=true
84COMP_DOC=true
85COMP_COMP_BINS=true
86
87ALAW=true
88MULAW=true
89ALAW_RW=true
90MULAW_RW=true
91
92PROXY=true
93
94PASSWORD_API=true
95
96NO_LISTEN=false
97
98META_DATA=true
99
100WITHOUT_CF='cmd'
101
102WITHOUT_VIO=''
103
104WITHOUT_DCOMP=''
105
106HAVE_MAIN_ARGS=true
107
108MINIMAL=false
109BETA=true
110EXPERIMENTAL=true
111
112TARGET_WIN32=false
113TARGET_MICROCONTROLLER=false
114TARGET_CYGWIN=false
115
116EXEC_HELPER=''
117
118ROAR_DRIVER_DEFAULT=''
119ROAR_DRIVER_CODEC=''
120
121ROARD_CFREQ='' # cycle frequens for roard, normaly 100Hz
122
123# Libs which are per default disabled:
124no_lib_ssl=true
125
126_CARGS="$@";
127
128# some very basic string functions:
129to_upper() {
130 tr 'a-z' 'A-Z'
131}
132
133to_escaped() {
134 tr 'A-Z/.+-' 'a-z____'
135}
136
137echo -n "checking for version of this package... "
138VERSION=`head -n 1 ChangeLog | cut -d' ' -f2`
139echo "$VERSION"
140
141
142echo -n "checking for C compiler... "
143if [ "$CC" != '' ]
144then
145 echo $CC
146else
147 CC=$(which gcc cc 2> /dev/null | grep ^/ | head -n 1)
148 if [ "$CC" = '' ]
149 then
150  echo 'none'
151  exit 1;
152 fi
153 echo $CC
154fi
155
156echo -n "checking for ranlib... "
157if [ "$RANLIB" != '' ]
158then
159 echo $RANLIB
160else
161 _guess=`echo $CC | sed 's/[gp]*cc\(-.*\)*//'`
162 RANLIB=$(which ${_guess}ranlib ranlib 2> /dev/null | grep ^/ | head -n 1)
163 if [ "$RANLIB" = '' ]
164 then
165  echo 'none'
166 fi
167 echo $RANLIB
168fi
169
170echo -n "checking for pkg-config... "
171PKG_CONFIG=$(which pkg-config false 2> /dev/null | grep ^/ | head -n 1)
172if $PKG_CONFIG --help > /dev/null 2> /dev/null
173then
174 echo $PKG_CONFIG
175else
176 echo no
177fi
178
179#Makefile.conf not yet open, write it later
180
181echo -n "checking for sysname... "
182SYSNAME=$(uname -s)
183echo "$SYSNAME"
184
185while [ "$1" != '' ]
186do
187 case "$1" in
188  '--help')
189   echo '--help                      - This Help'
190   echo
191   echo '--ldpath DIR                - Add DIR to (compile time) search list for libs'
192   echo '--incpath DIR               - Add DIR to search list for headers'
193   echo '--addpath DIR               - Add DIR/lib to lib, DIR/include to header search list'
194   echo
195   echo '--cc CC                     - Set name of C compiler (CC) to CC'
196   echo '--ranlib RANLIB             - Set name of ranlib (RANLIB) to RANLIB'
197   echo
198   echo '--cdrom DEV                 - Set default CDRum device'
199   echo '--tty DEV                   - Set default TTY'
200   echo '--oss-dev DEV               - Set default OSS device'
201   echo '--oss-mixer-dev DEV         - Set default OSS mixer device'
202   echo '--proc-net-decnet FILE      - Set DECnet file for DECnet support auto detecting'
203   echo '                              (ignore this on non-Linux)'
204   echo '--audio-group GROUP         - Sets group of audio permitted users'
205   echo '--root-uid UID              - Sets User ID (UID) of the root user/superuser'
206   echo
207   echo '--no-LIB                    - disable library LIB'
208   echo '--maybe-LIB                 - autodetect library LIB (default)'
209   echo '--runtime-detect            - do as much as posible auto detecting on runtime (for distributors)'
210   echo
211   echo '--ao-install-dir DIR        - Set install dir for libao plugin'
212   echo '--xmms-install-dir DIR      - Set install dir for XMMS plugin'
213   echo '--audacious-install-dir DIR - Set install dir for Audacious plugin'
214   echo
215   echo '--prefix DIR                - Set general prefix (default: '"$PREFIX"')'
216   echo '--prefix-bin DIR            - Set prefix for binarys (default: $PREFIX/bin)'
217   echo '--prefix-lib DIR            - Set prefix for librarys (default: $PREFIX/libs)'
218   echo '--prefix-inc DIR            - Set prefix for include files (default: $PREFIX/include)'
219   echo '--prefix-man DIR            - Set prefix for manpages (default: $PREFIX/man)'
220   echo '--prefix-pc DIR             - Set prefix for pkg-config (default: $PREFIX_LIB/pkgconfig)'
221   echo '--prefix-comp-libs DIR      - Set prefix for compatibility librarys (default: $PREFIX_LIB/roaraudio/complibs)'
222   echo '--prefix-comp-bins DIR      - Set prefix for compatibility binarys  (default: $PREFIX_LIB/roaraudio/compbins)'
223   echo
224   echo '--default-rate RATE         - Set default sample rate for roard and roarclients'
225   echo '--default-channels CHANNELS - Set default number of channels for roard and roarclients'
226   echo '--default-bits BITS         - Set default number of bits per sample for roard and roarclients'
227   echo '--default-driver DRIVER     - Set default driver for roard'
228   echo '--default-codec CODEC       - Set default codec used for the default driver'
229   echo
230   echo '--without-alaw              - Disable support of A-Law codec (de- and encoding)'
231   echo '--without-alaw-rw           - Disable support for writing A-Law (saves 8KB)'
232   echo '--without-mulaw             - Disable support of mu-Law codec (de- and encoding)'
233   echo '--without-mulaw-rw          - Disable support for writing mu-Law (saves 16KB)'
234   echo '--without-proxy             - Disable support for proxys'
235   echo
236   echo '--without-comp-libs         - Disable build of librarys'
237   echo '--without-comp-roard        - Disable build of roard'
238   echo '--without-comp-clients      - Disable build of clients'
239   echo '--without-comp-doc          - Disable build of documentation'
240   echo '--without-comp-comp-bins    - Disable build of compatibility binarys'
241   echo
242   echo '--without-dcomp-COMP        - Disable build of roard'\''s component COMP'
243   echo
244   echo '--without-meta-data         - Disable support for Meta Data'
245   echo
246   echo '--without-cf-cmd            - Disable support for command codecfilter'
247   echo
248   echo '--without-vio-MODULE        - Disable support for VIO module MODULE'
249   echo
250   echo '--without-password-api      - Disable build of Password API'
251   echo
252   echo '--without-listen            - Disable listening sockets in roard'
253   echo '                              This is the same as allways using --no-listen'
254   echo
255   echo '--without-beta              - Disable beta code'
256   echo '--without-experimental      - Disable experimental code'
257   echo
258   echo '--distribution-version-string STRING'
259   echo '                            - Sets distribution part of version string'
260   echo
261   echo '--roard-cfreq FREQ          - Sets the cycle frequency of roard in Hz.'
262   echo '--vorbis-bits BITS          - Sets bits per sample used by Vorbis code'
263   echo
264#   echo '--without-libao             - Disable build of libao plugin'
265   echo '--without-xmms              - Disable build of XMMS plugin'
266#   echo '--without-audacious         - Disable build of Audacious plugin'
267   echo
268   echo '--mmcu MMCU                 - Sets -mmcu compiler/linker option'
269   echo '--minimal                   - Disable all optional components'
270   echo '--cross-compile             - Enable cross compiler workarounds'
271   echo '--target-microcontroller    - Set Options for mircocontrollers without a OS'
272   echo '                              Implys --cross-compile'
273   echo '--target-win32              - Disable everything useful'
274   echo '--exec-helper HELPER        - Exec all test programms using this command (HELPER $cmd $args)'
275   echo '                              use '\''--exec-helper wine'\'' when building win32 binarys'
276   exit 0;
277  ;;
278  '--ldpath')
279   LDPATH="$LDPATH -L$2"
280   shift;
281  ;;
282  '--incpath')
283   INCPATH="$INCPATH -I$2"
284   shift;
285  ;;
286  '--addpath')
287   LDPATH="$LDPATH -L$2/lib/"
288   INCPATH="$INCPATH -I$2/include/"
289   shift;
290  ;;
291  '--cc')
292   CC="$2"
293   shift;
294  ;;
295  '--ranlib')
296   RANLIB="$2"
297   shift;
298  ;;
299  '--cdrom')
300   CDROM="$2"
301   shift;
302  ;;
303  '--tty')
304   TTY_DEV="$2"
305   shift;
306  ;;
307  '--oss-dev')
308   OSS_DEV="$2"
309   shift;
310  ;;
311  '--oss-mixer-dev')
312   OSS_MIX_DEV="$2"
313   shift;
314  ;;
315  '--audio-group')
316   DEFAULT_GRP="$2"
317   shift;
318  ;;
319  '--root-uid')
320   ROOT_UID="$2"
321   shift;
322  ;;
323  '--no-'*)
324   lib=$(echo "$1" | sed 's/^--no-//' | to_escaped)
325   eval no_lib_$lib=true
326  ;;
327  '--maybe-'*)
328   lib=$(echo "$1" | sed 's/^--maybe-//' | to_escaped)
329   eval unset no_lib_$lib
330  ;;
331  '--runtime-detect')
332   RUNTIME_DETECT=true
333  ;;
334  '--ao-install-dir')
335   AO_INST_DIR="$2"
336   shift;
337  ;;
338  '--xmms-install-dir')
339   XMMS_INST_DIR="$2"
340   shift;
341  ;;
342  '--audacious-install-dir')
343   AUDACIOUS_INST_DIR="$2"
344   shift;
345  ;;
346  '--default-rate')
347   DEFAULT_RATE="$2"
348   shift;
349  ;;
350  '--default-channels')
351   DEFAULT_CHANNELS="$2"
352   shift;
353  ;;
354  '--default-bits')
355   DEFAULT_BITS="$2"
356   shift;
357  ;;
358  '--default-driver')
359   ROAR_DRIVER_DEFAULT="$2"
360   shift;
361  ;;
362  '--default-codec')
363   ROAR_DRIVER_CODEC="$2"
364   shift;
365  ;;
366  '--without-alaw')
367   ALAW=false
368   ALAW_RW=false
369  ;;
370  '--without-alaw-rw')
371   ALAW_RW=false
372  ;;
373  '--without-mulaw')
374   MULAW=false
375   MULAW_RW=false
376  ;;
377  '--without-mulaw-rw')
378   MULAW_RW=false
379  ;;
380  '--without-proxy')
381   PROXY=false
382  ;;
383  '--without-comp-libs')
384   COMP_LIBS=false
385  ;;
386  '--without-comp-roard')
387   COMP_ROARD=false
388  ;;
389  '--without-comp-clients')
390   COMP_CLIENTS=false
391  ;;
392  '--without-comp-doc')
393   COMP_DOC=false
394  ;;
395  '--without-comp-comp-bins')
396   COMP_COMP_BINS=false
397  ;;
398  '--without-meta-data')
399   META_DATA=false
400  ;;
401  '--without-cf-'*)
402   WITHOUT_CF="$WITHOUT_CF"' '$(echo "$1" | cut -d- -f5)
403  ;;
404  '--without-vio-'*)
405   WITHOUT_VIO="$WITHOUT_VIO"' '$(echo "$1" | cut -d- -f5)
406  ;;
407  '--without-dcomp-'*)
408   WITHOUT_DCOMP="$WITHOUT_DCOMP"' '$(echo "$1" | cut -d- -f5)
409  ;;
410  '--without-password-api')
411   PASSWORD_API=false
412  ;;
413  '--without-listen')
414   NO_LISTEN=true
415  ;;
416  '--distribution-version-string')
417   DISTRIBUTION_VERSION_STRING="$2"
418   shift;
419  ;;
420  '--roard-cfreq')
421   ROARD_CFREQ="$2"
422   shift;
423  ;;
424  '--vorbis-bits')
425   VORBIS_BITS="$2"
426   shift;
427  ;;
428  '--without-libao')
429   LIBAO=false
430   no_lib_ao=true
431  ;;
432  '--without-xmms')
433   XMMS=false
434  ;;
435  '--without-audacious')
436   AUDACIOUS=false
437  ;;
438  '--minimal')
439   MINIMAL=true
440   RUNTIME_DETECT=false
441   XMMS=false
442   AUDACIOUS=false
443   LIBAO=false
444   PROXY=false
445   MULAW=false
446   MULAW_RW=false
447   ALAW=false
448   ALAW_RW=false
449   META_DATA=false
450   PASSWORD_API=false
451   WITHOUT_VIO="$WITHOUT_VIO"' dstr cmd stdio'
452   WITHOUT_CF="$WITHOUT_CF"' wave cmd'
453   WITHOUT_DCOMP="$WITHOUT_DCOMP"' sources ssynth cb midi light raw rdtcs cdriver emul_esd emul_simple emul_rsound'
454  ;;
455  '--without-beta')
456   BETA=false
457   EXPERIMENTAL=false
458  ;;
459  '--without-experimental')
460   EXPERIMENTAL=false
461  ;;
462  '--prefix')
463   PREFIX="$2"
464   shift;
465  ;;
466  '--prefix-bin')
467   PREFIX_BIN="$2"
468   shift;
469  ;;
470  '--prefix-lib')
471   PREFIX_LIB="$2"
472   shift;
473  ;;
474  '--prefix-inc')
475   PREFIX_INC="$2"
476   shift;
477  ;;
478  '--prefix-man')
479   PREFIX_MAN="$2"
480   shift;
481  ;;
482  '--prefix-pc')
483   PREFIX_PC="$2"
484   shift;
485  ;;
486  # we should remove --prefix-comp soon
487  '--prefix-comp'|'--prefix-comp-libs')
488   PREFIX_COMP_LIBS="$2"
489   shift;
490  ;;
491  '--prefix-comp-bins')
492   PREFIX_COMP_BINS="$2"
493   shift;
494  ;;
495####################################
496# autof* options block:
497  '--prefix='*)
498   PREFIX=$(echo "$1" | cut -d= -f2)
499  ;;
500  '--prefix-bin='*)
501   PREFIX_BIN=$(echo "$1" | cut -d= -f2)
502  ;;
503  '--prefix-lib='*)
504   PREFIX_LIB=$(echo "$1" | cut -d= -f2)
505  ;;
506  '--prefix-inc='*)
507   PREFIX_INC=$(echo "$1" | cut -d= -f2)
508  ;;
509  '--prefix-man='*)
510   PREFIX_MAN=$(echo "$1" | cut -d= -f2)
511  ;;
512  '--prefix-pc='*)
513   PREFIX_PC=$(echo "$1" | cut -d= -f2)
514  ;;
515  '--prefix-comp-libs='*)
516   PREFIX_COMP_LIBS=$(echo "$1" | cut -d= -f2)
517  ;;
518  '--prefix-comp-bins='*)
519   PREFIX_COMP_BINS=$(echo "$1" | cut -d= -f2)
520  ;;
521####################################
522  '--mmcu')
523   MMCU="$2"
524   shift;
525  ;;
526  '--cross-compile')
527   CROSS_COMPILE=true
528   RUNTIME_DETECT=true
529  ;;
530  '--exec-helper')
531   EXEC_HELPER="$2"
532   shift;
533  ;;
534  '--target-microcontroller')
535   TARGET_MICROCONTROLLER=true
536   CROSS_COMPILE=true
537   RUNTIME_DETECT=true
538   HAVE_MAIN_ARGS=false
539   XMMS=false
540   AUDACIOUS=false
541   LIBAO=false
542   WITHOUT_VIO="$WITHOUT_VIO"' cmd'
543  ;;
544  '--target-win32')
545   TARGET_WIN32=true
546  ;;
547 esac;
548
549 shift;
550done
551
552[ "$no_lib_yiff" != '' ] && no_lib_y2=true
553
554if $BETA
555then
556 :
557else
558 PASSWORD_API=false
559 WITHOUT_DCOMP="$WITHOUT_DCOMP"' cb midi rdtcs'
560 WITHOUT_CF="$WITHOUT_CF"' cf'
561 no_lib_gcrypt=true
562 no_lib_jack=true
563 no_lib_dbus_1=true
564fi
565
566if $EXPERIMENTAL
567then
568 :
569else
570 : # Add list of experimental things here.
571fi
572
573CCTF="false"
574
575test_lib () {
576 echo > $TF_C
577
578 name="$1"
579 echo -n "checking for $name... "
580 echo "TEST LIB: $name" >&5
581 shift;
582
583 LIBS=''
584
585 while [ "$1" != '--' ]
586 do
587  case "$1" in
588   'c'|'-lc')
589    :; # no need to do anything
590   ;;
591   '-'*)
592    LIBS="$LIBS $1"
593   ;;
594   *)
595    LIBS="-l$1"
596   ;;
597  esac
598  shift;
599 done
600
601 shift;
602
603 echo "LIB($name) IS TESTED USING LIBS: $LIBS" >&5
604
605 while [ "$1" != '' ]
606 do
607  _h="$1";
608  shift;
609  _envname=`echo "$_h" | to_escaped`
610  eval "_t=\$libname_$_envname"
611  echo "LIB($name) DEPENDS ON $_h($_envname) with state '$_t'" >&5
612  if [ "$_t" = 'false' ]
613  then
614   echo "// not including <$_h> as it was tested as not present"  >> $TF_C
615  else
616   echo "#include <$_h>"  >> $TF_C
617  fi
618 done
619
620 echo 'int main (void) { return 0; }' >> $TF_C
621
622 echo "LIB($name) IS TESTED USING TEST CODE:" >&5
623 echo "--- BEGIN OF CODE BLOCK ---" >&5
624 cat $TF_C >&5
625 echo "--- END OF CODE BLOCK ---" >&5
626
627 echo "LIB($name) HAS COMPILER/LINKER OUTPUT:" >&5
628 echo "--- BEGIN OF CHILD OUTPUT BLOCK ---" >&5
629 $CCTF $LIBS >&5 2>&5;
630 R=$?
631 echo "--- END OF CHILD OUTPUT BLOCK ---" >&5
632
633 if [ "$R" = '0' ]
634 then
635  echo 'yes'
636  echo "LIB($name) WAS FOUND" >&5
637 else
638  echo 'no'
639  echo "LIB($name) NOT FOUND" >&5
640 fi
641
642 return $R
643}
644
645test_lib_defmake () {
646 def="$1"
647 subdir="$2"
648 shift
649 shift
650 name="$1"
651 lib="$2"
652 shift
653
654 echo "TEST LIB: $name" >&5
655
656 [ "$subdir" = '%' ] && subdir=''
657
658 envlib=`echo "$lib"   | cut -d/ -f1 | to_escaped`
659 envname=`echo "$name" | to_escaped`
660
661 echo "LIB($name) HAS envlib='$envlib', envname='$envname'" >&5
662
663 if [ "$lib" != '--' ]
664 then
665  echo "EVAL: _no=\$no_lib_$envlib" >&5
666  eval _no="\$no_lib_$envlib";
667  $MINIMAL && _no='XXX'
668
669  if [ "$_no" != '' ]
670  then
671    echo "checking for $name... disabled by user"
672    echo "LIB($name) IS DISABLED BY USER" >&5
673   [ "$subdir" != '' ] && \
674    echo "subdir_$subdir=" >&4
675   echo "lib_$envlib=" >&4
676   return;
677  fi
678 fi
679
680 lib="$lib/"
681
682 libn=`echo $lib | cut -d/ -f1`
683 is_fatal=`echo $lib | cut -d/ -f2`
684
685 lib="$libn"
686
687# echo "is_fatal(i)=$is_fatal" >&5
688
689 if [ "$is_fatal" = '' -o "$is_fatal" = 'no' -o "$is_fatal" = 'false' ]
690 then
691  is_fatal=false
692 else
693  is_fatal=true
694  shift; # maybe we have a pkg name, not a lib
695 fi
696
697 echo "LIB($name) HAS FATAL FLAG SET TO $is_fatal" >&5
698
699# echo "is_fatal(b)=$is_fatal" >&5
700
701 LIBS=$($PKG_CONFIG --silence-errors --cflags --libs $lib 2> /dev/null)
702 if [ "$?" != '0' ]
703 then
704  if $is_fatal
705  then
706   echo "checking for $name... no (fatal config errors)"
707   echo "LIB($name) HAS FATAL ERRORS" >&5
708   echo "LIB($name) NOT FOUND" >&5
709   [ "$subdir" != '' ] && \
710    echo "subdir_$subdir=" >&4
711   echo "lib_$envlib=" >&4
712   return
713  fi
714  LIBS="-l$lib"
715 fi
716
717 echo "LIB($name) HAS LIBS: $LIBS" >&5
718
719 if test_lib "$name" $LIBS "$@"
720 then
721  subdir_var='subdir_'"`echo $subdir | to_escaped`"
722  echo "#define $def"            >&3
723  [ "$subdir" != '' ] && \
724   echo "$subdir_var=$subdir" >&4
725  [ "$lib" != 'c' ] && \
726   echo "lib_$envlib=$LIBS" >&4
727  if [ "$lib" != 'c' ]
728  then
729   eval "lib_$envlib='$LIBS'"
730  else
731   echo "LIB($name) SETS libname_$envname=true" >&5
732   eval "libname_$envname=true"
733  fi
734 else
735  [ "$subdir" != '' ] && \
736   echo "subdir_$subdir=" >&4
737  [ "$lib" != 'c' ] && \
738   echo "lib_$envlib=" >&4
739  echo "LIB($name) SETS libname_$envname=false" >&5
740  eval "libname_$envname=false"
741 fi
742 echo >&5
743 echo >&5
744}
745
746test_tool_defmake () {
747 DEF="$1"
748 NAME="$2"
749 shift;
750 shift;
751 echo -n "checking for $NAME... "
752
753 echo "TEST TOOL: $NAME" >&5
754
755 if $RUNTIME_DETECT
756 then
757  echo "$1 (runtime detect)"
758  echo "TOOL($NAME) WILL BE RUNTIME DETECTED" >&5
759  echo "#define $DEF "\""$1"\" >&3
760 elif $MINIMAL
761 then
762  echo "disabled by user (minimalstic build)"
763  echo "TOOL($NAME) IS DISABLED BY USER" >&5
764 else
765
766  LIST=$(which "$@" 2> /dev/null | grep ^/ | head -n 1)
767
768  if [ "$LIST" = '' ]
769  then
770   echo 'no'
771   echo "TOOL($NAME) NOT FOUND" >&5
772  else
773   echo $LIST
774   echo "#define $DEF "\""$LIST"\" >&3
775   echo "TOOL($NAME) IS AT $LIST" >&5
776  fi
777 fi
778}
779
780test_func_defmake () {
781 DEF="$1"
782 NAME="$2"
783 shift;
784 shift;
785 echo -n "checking for $NAME()... "
786
787 CALL="$1"
788 shift;
789
790 LIBS=''
791
792 while [ "$1" != '--' ]
793 do
794  case "$1" in
795   'c'|'-lc')
796    :; # no need to do anything
797   ;;
798   '-'*)
799    LIBS="$LIBS $1"
800   ;;
801   *)
802    LIBS="-l$1"
803   ;;
804  esac
805  shift;
806 done
807
808 shift; # skip '--'
809
810 echo "TEST FUNCTION: $NAME" >&5
811
812 {
813  while [ "$1" != '' ]
814  do
815   _h="$1";
816   shift;
817   _envname=`echo "$_h" | to_escaped`
818   eval "_t=\$libname_$_envname"
819   echo "LIB($name) DEPENDS ON $_h($_envname) with state '$_t'" >&5
820   if [ "$_t" = 'false' ]
821   then
822    echo "// not including <$_h> as it was tested as not present"
823   else
824    echo "#include <$_h>"
825   fi
826  done
827
828  echo 'int main (void) {'
829  echo " $CALL;"
830  echo ' return 0;'
831  echo '}'
832
833 } > $TF_C
834
835 echo "--- BEGIN OF CODE BLOCK ---" >&5
836 cat $TF_C >&5
837 echo "--- END OF CODE BLOCK ---" >&5
838
839 echo "FUNCTION($NAME) HAS COMPILER/LINKER OUTPUT:" >&5
840 echo "--- BEGIN OF CHILD OUTPUT BLOCK ---" >&5
841 $CCTF $LIBS >&5 2>&5;
842 R=$?
843 echo "--- END OF CHILD OUTPUT BLOCK ---" >&5
844
845 if [ "$R" = '0' ]
846 then
847  echo "#define $DEF" >&3
848  echo "FUNCTION($NAME) IS OK" >&5
849  echo yes
850 else
851  echo "FUNCTION($NAME) IS NOT OK" >&5
852  echo no
853 fi
854
855}
856
857test_version () {
858 DEF="$1"
859 NAME="$2"
860 PKGNAME="$3"
861
862 echo -n "checking for version of $NAME... "
863
864 _ver=$($PKG_CONFIG --modversion $PKGNAME 2> /dev/null)
865
866 if [ "$_ver" = '' ]
867 then
868  _ver=unknown
869 fi
870
871 echo $_ver
872
873 _ver_def=$(echo $_ver | to_escaped | to_upper)
874 echo "#define ${DEF}_$_ver_def" >&3
875
876 echo "$_ver" | if grep '^[0-9]*\.[0-9]*\.[0-9]*$' > /dev/null
877 then
878  _ver_vdef=$(echo "$_ver" | sed 's/^\([0-9]*\)\.\([0-9]*\)\.\([0-9]\)*$/_ROAR_MKVERSION(\1, \2, \3)/')
879  echo "#define ${DEF} $_ver_vdef" >&3
880 else
881  echo "#define ${DEF} 0" >&3
882 fi
883
884}
885
886test_type () {
887 DEF="$1"
888 NAME="$2"
889 INITVAL="$3"
890 DASHDASH="$4"
891 shift; shift;
892
893 if [ "$#" -ge '2' ]
894 then
895  shift; shift;
896 fi
897
898 HEADERS="stdint.h string.h unistd.h sys/types.h $*" #including headers here let
899                                                     #them get checked for presence.
900
901 [ "$INITVAL" = '' ] && INITVAL='0'
902
903 echo -n "checking for type $NAME... "
904 echo "TEST TYPE: $NAME" >&5
905
906 echo "// type test for type $NAME"  >  $TF_C # need a clean file, write something
907 for _h in $HEADERS
908 do
909  _envname=`echo "$_h" | to_escaped`
910  eval "_t=\$libname_$_envname"
911  echo "TYPE($NAME) DEPENDS ON $_h($_envname) with state '$_t'" >&5
912  if [ "$_t" = 'false' ]
913  then
914   echo "// not including <$_h> as it was tested as not present"  >> $TF_C
915  else
916   echo "#include <$_h>"  >> $TF_C
917  fi
918 done
919 echo "int main (void) { $NAME _var = $INITVAL; return 0; }" >> $TF_C
920
921 echo "--- BEGIN OF CODE BLOCK ---" >&5
922 cat $TF_C >&5
923 echo "--- END OF CODE BLOCK ---" >&5
924
925 echo "TYPE($NAME) HAS COMPILER/LINKER OUTPUT:" >&5
926 echo "--- BEGIN OF CHILD OUTPUT BLOCK ---" >&5
927 $CCTF >&5 2>&5;
928 R=$?
929 echo "--- END OF CHILD OUTPUT BLOCK ---" >&5
930
931 if [ "$R" = '0' ]
932 then
933  echo "#define $DEF" >&3
934  echo 'ok'
935  echo "TYPE($NAME) IS OK" >&5
936 else
937  echo 'not found'
938  echo "TYPE($NAME) NOT FOUND" >&5
939 fi
940}
941
942test_pa_type () {
943 DEF="$1"
944 NAME="$2"
945 TYPE="$3"
946 V0="$4"
947 V1="$5"
948 TEST="$6"
949 shift; shift; shift; shift; shift; shift;
950 HEADER="$*"
951 RS='%s'
952
953 case "$TYPE" in
954  'type')
955   MSG="checking for type of $NAME()... "
956  ;;
957  'args:'*)
958   MSG="checking for argument types of $NAME()... "
959   RS=`echo "$TYPE" | cut -d: -f2`
960  ;;
961 esac;
962
963 echo -n "$MSG"
964 echo '#include <pulse/pulseaudio.h>'  >  $TF_C
965 for _h in $HEADERS
966 do
967  echo "#include <$_h>"  >> $TF_C
968 done
969 echo '#include <string.h>'           >> $TF_C
970 echo 'int main (void) { return 0; }' >> $TF_C
971 echo "$TEST"                         >> $TF_C
972
973 if $CCTF 2> /dev/null;
974 then
975  R="$V0"
976 else
977  R="$V1"
978 fi
979
980 echo "#define $DEF $R" >&3
981 printf "$RS\n" "$R"
982}
983
984exec 3> config.h 4> Makefile.conf 5> config.log
985
986TARGET_CYGWIN=`echo "$SYSNAME" | if grep CYGWIN  > /dev/null; then echo true; else echo false; fi`
987TARGET_WIN32=`echo  "$SYSNAME" | if grep MINGW32 > /dev/null; then echo true; else echo $TARGET_WIN32; fi`
988
989if $TARGET_WIN32
990then
991 CROSS_COMPILE=true
992 RUNTIME_DETECT=true
993 no_lib_dnet=true
994 PROXY=false
995 LIBAO=false
996 XMMS=false
997 AUDACIOUS=false
998 WITHOUT_VIO="$WITHOUT_VIO"' pipe cmd' # hope that with buffered pipes we can remove this soon
999 WITHOUT_DCOMP="$WITHOUT_DCOMP"' cb'
1000# [ "$ROARD_CFREQ" = '' ] && ROARD_CFREQ=20
1001fi
1002
1003if [ "$SYSNAME" = 'Darwin' ]
1004then
1005 echo "Adding $SYSNAME shared lib arguments..."
1006 SHARED="$SHARED -fno-common -dynamiclib -compatibility_version 0.1 -current_version 0.1.0"
1007 SHARED_CF="$SHARED_CF -fno-common"
1008elif [ "$SYSNAME" = 'NetBSD' ]
1009then
1010 echo "Adding $SYSNAME libpath arguments..."
1011 LDPATH="$LDPATH -L/usr/local/lib/"
1012elif [ "$SYSNAME" = 'OpenBSD' ]
1013then
1014 echo "Adding $SYSNAME search path arguments..."
1015 LDPATH="$LDPATH -L/usr/local/lib/"
1016 INCPATH="$INCPATH -I/usr/local/include/"
1017# echo "Adding $SYSNAME build arguments..."
1018# SNDIO_EMUL=false
1019elif [ "$SYSNAME" = 'FreeBSD' ]
1020then
1021 echo "Adding $SYSNAME search path arguments..."
1022 LDPATH="$LDPATH -L/usr/local/lib/"
1023 INCPATH="$INCPATH -I/usr/local/include/"
1024 [ "$DEFAULT_GRP" = '' ] && DEFAULT_GRP='wheel'
1025elif $TARGET_WIN32
1026then
1027 echo "Adding win32 build arguments..."
1028 fPIC=false
1029 SHARED_SUFFIX='.dll'
1030 COMPBIN_SUFFIX='.bat'
1031elif $TARGET_CYGWIN
1032then
1033 echo "Adding cygwin build arguments..."
1034 fPIC=false
1035 SHARED_SUFFIX='.dll'
1036 COMPBIN_SUFFIX='.bat'
1037fi
1038
1039echo -n 'checking if we cross compile... '
1040if $CROSS_COMPILE
1041then
1042 echo yes
1043
1044 echo -n "checking for exec helper... "
1045 if [ "$EXEC_HELPER" = '' ]
1046 then
1047  if $TARGET_WIN32
1048  then
1049   EXEC_HELPER=$(which wine 2> /dev/null | grep ^/ | head -n 1)
1050   if [ "$EXEC_HELPER" = '' ]
1051   then
1052    echo 'none (please install wine)'
1053   else
1054    echo "$EXEC_HELPER"
1055   fi
1056  else
1057   echo 'none (unknown)'
1058  fi
1059 else
1060  echo "$EXEC_HELPER"
1061 fi
1062
1063 echo -n "checking for sysname... "
1064 if $TARGET_CYGWIN
1065 then
1066  SYSNAME=cygwin
1067 elif $TARGET_WIN32
1068 then
1069  SYSNAME=win32
1070 else
1071  SYSNAME=unknown
1072 fi
1073 echo "$SYSNAME"
1074else
1075 echo no
1076fi
1077
1078[ "$PREFIX_BIN"  = '' ] && PREFIX_BIN="$PREFIX/bin/"
1079[ "$PREFIX_LIB"  = '' ] && PREFIX_LIB="$PREFIX/lib/"
1080[ "$PREFIX_INC"  = '' ] && PREFIX_INC="$PREFIX/include/"
1081[ "$PREFIX_MAN"  = '' ] && PREFIX_MAN="$PREFIX/share/man/"
1082[ "$PREFIX_PC"   = '' ] && PREFIX_PC="$PREFIX_LIB/pkgconfig/"
1083[ "$PREFIX_COMP_LIBS" = '' ] && PREFIX_COMP_LIBS="$PREFIX_LIB/roaraudio/complibs/"
1084[ "$PREFIX_COMP_BINS" = '' ] && PREFIX_COMP_BINS="$PREFIX_LIB/roaraudio/compbins/"
1085
1086[ "$DEFAULT_GRP" = '' ] && DEFAULT_GRP='audio'
1087
1088CCTF="$CC $CFLAGS $LDPATH $INCPATH -Iinclude/ -o $TF_E $TF_C"
1089
1090if [ "$MMCU" != '' ]
1091then
1092 CC="$CC -mmcu=$MMCU"
1093fi
1094
1095# Check for -Wextra
1096#Wextra
1097echo -n "checking if compiler supports -Wextra... "
1098echo 'int main (void) { return 0; }' > $TF_C
1099if $CCTF -Wextra 2> /dev/null;
1100then
1101 echo yes
1102 Wextra=true
1103else
1104 echo no
1105 Wextra=false
1106fi
1107
1108# now write the cc name to Makefile.conf
1109{
1110 echo "VERSION=$VERSION"
1111 echo "DEV_VENDOR=$DEV_VENDOR"
1112 echo "DEV_VENDOR_NAME=$DEV_VENDOR_NAME"
1113 echo "DEV_VENDOR_STRING=$DEV_VENDOR/$DEV_VENDOR_NAME"
1114 echo "DISTRIBUTION_VERSION_STRING=$DISTRIBUTION_VERSION_STRING"
1115 echo
1116 echo "SHARED=$SHARED"
1117 echo "SHARED_CF=$SHARED_CF"
1118 echo "SHARED_SUFFIX=$SHARED_SUFFIX"
1119 echo "COMPBIN_SUFFIX=$COMPBIN_SUFFIX"
1120 $fPIC   && echo 'fPIC=-fPIC'
1121 $Wextra && echo 'Wextra=-Wextra'
1122 echo
1123 echo "CC=$CC"
1124 echo "RANLIB=$RANLIB"
1125 echo "LDPATH=$LDPATH"
1126 echo "INCPATH=$INCPATH"
1127 echo
1128 [ "$CFLAGS" != '' ] && echo "CFLAGS+=$CFLAGS"
1129 echo
1130 echo "EXEC_HELPER=$EXEC_HELPER"
1131 echo "CROSS_COMPILE=$CROSS_COMPILE"
1132 echo
1133 echo "PREFIX=$PREFIX"
1134 echo "PREFIX_BIN=$PREFIX_BIN"
1135 echo "PREFIX_LIB=$PREFIX_LIB"
1136 echo "PREFIX_INC=$PREFIX_INC"
1137 echo "PREFIX_MAN=$PREFIX_MAN"
1138 echo "PREFIX_PC=$PREFIX_PC"
1139 echo "PREFIX_COMP_LIBS=$PREFIX_COMP_LIBS"
1140 echo "PREFIX_COMP_BINS=$PREFIX_COMP_BINS"
1141 echo
1142 $COMP_LIBS      && echo "comp_libs=libroar libroardsp libroarmidi libroarlight libroareio"
1143 $COMP_ROARD     && echo "comp_roard=roard"
1144 $COMP_CLIENTS   && echo "comp_clients=roarclients"
1145 $COMP_DOC       && echo "comp_doc=doc"
1146 $COMP_COMP_BINS && echo "comp_comp_bins=compbins"
1147 echo
1148 $SNDIO_EMUL && echo "subdir_libroarsndio=libroarsndio"
1149 echo "subdir_libroaross=libroaross" # this builds an empty file in case of not supported
1150} >&4
1151
1152{
1153 cat <<'EOF'
1154//config.log:
1155
1156/*
1157 * Logfile for configure script $Revision$ of RoarAudio
1158 */
1159
1160EOF
1161 echo '/* uname: ' $(uname -a) '*/'
1162 echo '/* Date : ' $(date)  '*/'
1163 echo
1164
1165 echo
1166 echo
1167
1168 echo "ARGS(): $_CARGS"
1169
1170 for i in PATH SHELL CC RANLIB PKG_CONFIG SYSNAME \
1171          TARGET_CYGWIN TARGET_WIN32 TARGET_MICROCONTROLLER CROSS_COMPILE \
1172          RUNTIME_DETECT MINIMAL EXEC_HELPER
1173 do
1174  eval echo "BASICCONF\($i\): \$$i";
1175 done
1176
1177 echo
1178 echo
1179} >&5
1180
1181cat >&3 << EOF
1182//config.h:
1183
1184#ifndef _ROARAUDIO_CONFIG_H_
1185#define _ROARAUDIO_CONFIG_H_
1186
1187EOF
1188
1189{
1190 echo '/* uname: ' $(uname -a) '*/'
1191 echo '/* Date : ' $(date)  '*/'
1192 echo
1193 [ "$DEFAULT_RATE"        = '' ] || echo "#define ROAR_RATE_DEFAULT     $DEFAULT_RATE"
1194 [ "$DEFAULT_CHANNELS"    = '' ] || echo "#define ROAR_CHANNELS_DEFAULT $DEFAULT_CHANNELS"
1195 [ "$DEFAULT_BITS"        = '' ] || echo "#define ROAR_BITS_DEFAULT     $DEFAULT_BITS"
1196 [ "$ROAR_DRIVER_DEFAULT" = '' ] || echo "#define ROAR_DRIVER_DEFAULT   \"$ROAR_DRIVER_DEFAULT\""
1197 [ "$ROAR_DRIVER_CODEC"   = '' ] || echo "#define ROAR_DRIVER_CODEC     \"$ROAR_DRIVER_CODEC\""
1198 echo
1199 [ "$ROARD_CFREQ"         = '' ] || echo "#define ROAR_OUTPUT_CFREQ     $ROARD_CFREQ"
1200 echo "#define ROAR_VORBIS_BITS     $VORBIS_BITS"
1201 echo
1202 $MINIMAL      && echo '#define ROAR_MINIMAL'
1203 $BETA         && echo '#define ROAR_BETA'
1204 $EXPERIMENTAL && echo '#define ROAR_EXPERIMENTAL'
1205 $ALAW         && echo '#define ROAR_SUPPORT_ALAW'
1206 $ALAW_RW      && echo '#define ROAR_SUPPORT_ALAW_RW'
1207 $MULAW        && echo '#define ROAR_SUPPORT_MULAW'
1208 $MULAW_RW     && echo '#define ROAR_SUPPORT_MULAW_RW'
1209 $PROXY        && echo '#define ROAR_SUPPORT_PROXY'
1210 $PASSWORD_API && echo '#define ROAR_SUPPORT_PASSWORD_API'
1211 $NO_LISTEN    || echo '#define ROAR_SUPPORT_LISTEN'
1212 $META_DATA    && echo '#define ROAR_SUPPORT_META'
1213 echo
1214
1215 $HAVE_MAIN_ARGS && echo '#define ROAR_HAVE_MAIN_ARGS'
1216
1217 echo
1218
1219 for i in $WITHOUT_CF
1220 do
1221  i=$(echo $i | to_upper);
1222  echo '#define ROAR_WITHOUT_CF_'$i
1223 done
1224
1225 for i in $WITHOUT_VIO
1226 do
1227  i=$(echo $i | to_upper);
1228  echo '#define ROAR_WITHOUT_VIO_'$i
1229 done
1230
1231 for i in $WITHOUT_DCOMP
1232 do
1233  i=$(echo $i | to_upper);
1234  echo '#define ROAR_WITHOUT_DCOMP_'$i
1235 done
1236
1237 echo
1238 $TARGET_MICROCONTROLLER && echo '#define ROAR_TARGET_MICROCONTROLLER'
1239 $TARGET_WIN32           && echo '#define ROAR_TARGET_WIN32'
1240 $TARGET_CYGWIN          && echo '#define ROAR_TARGET_CYGWIN'
1241                            echo '#define ROAR_OS_'$(echo $SYSNAME | to_escaped | to_upper)
1242 echo
1243} >&3
1244
1245#                 #define                   name         cmds...
1246test_tool_defmake ROAR_HAVE_BIN_OGG123      ogg123       ogg123
1247test_tool_defmake ROAR_HAVE_BIN_FLAC        flac         flac
1248test_tool_defmake ROAR_HAVE_BIN_TIMIDITY    TiMidity++   timidity
1249test_tool_defmake ROAR_HAVE_BIN_CDPARANOIA  cdparanoia   cdparanoia
1250test_tool_defmake ROAR_HAVE_BIN_WGET        Wget         wget
1251test_tool_defmake ROAR_HAVE_BIN_GNUPLOT     gnuplot      gnuplot
1252test_tool_defmake ROAR_HAVE_BIN_SSH         OpenSSH      ssh
1253test_tool_defmake ROAR_HAVE_BIN_PINENTRY    PIN-Entry    pinentry
1254test_tool_defmake ROAR_HAVE_BIN_SSH_ASKPASS SSH-AskPass  ssh-askpass
1255test_tool_defmake ROAR_HAVE_BIN_GZIP        Gzip         gzip
1256test_tool_defmake ROAR_HAVE_BIN_BZIP2       bzip2        bzip2
1257test_tool_defmake ROAR_HAVE_BIN_GPG         GnuPG        gpg
1258test_tool_defmake ROAR_HAVE_BIN_CHAT        chat         chat
1259test_tool_defmake ROAR_HAVE_BIN_EJECT       eject        eject
1260
1261echo >&3
1262echo >&5
1263echo >&5
1264echo >&5
1265
1266# Those tests should not be disabled as they do not reduce the lib size just
1267# break --minimal on full systems
1268OLD_MINIMAL=$MINIMAL
1269MINIMAL=false
1270# Test haders:
1271test_lib_defmake ROAR_HAVE_H_STDINT      %            stdint.h      c          -- stdint.h
1272test_lib_defmake ROAR_HAVE_H_STRING      %            string.h      c          -- string.h
1273test_lib_defmake ROAR_HAVE_H_SYS_TYPES   %            sys/types.h   c          -- sys/types.h
1274test_lib_defmake ROAR_HAVE_H_SYS_SOCKET  %            sys/socket.h  c          -- sys/types.h sys/socket.h
1275test_lib_defmake ROAR_HAVE_H_SYS_TIME    %            sys/time.h    c          -- sys/time.h
1276test_lib_defmake ROAR_HAVE_H_SYS_IOCTL   %            sys/ioctl.h   c          -- sys/ioctl.h
1277test_lib_defmake ROAR_HAVE_H_TIME        %            time.h        c          -- time.h
1278test_lib_defmake ROAR_HAVE_H_FCNTL       %            fcntl.h       c          -- fcntl.h
1279test_lib_defmake ROAR_HAVE_H_UNISTD      %            unistd.h      c          -- unistd.h
1280test_lib_defmake ROAR_HAVE_H_SIGNAL      %            signal.h      c          -- signal.h
1281test_lib_defmake ROAR_HAVE_H_POLL        %            poll.h        c          -- poll.h
1282test_lib_defmake ROAR_HAVE_H_MMSYSTEM    %            mmsystem.h    c          -- windows.h mmsystem.h
1283test_lib_defmake ROAR_HAVE_H_ESD         libroaresd   esd.h         c          -- esd.h
1284test_lib_defmake ROAR_HAVE_H_ARTSC       libroararts  artsc.h       c          -- kde/artsc/artsc.h
1285test_lib_defmake ROAR_HAVE_H_ICONV       %            iconv.h       c          -- iconv.h
1286test_lib_defmake ROAR_HAVE_H_NETINET_IN  %            'netinet/in.h' c         -- 'netinet/in.h'
1287test_lib_defmake ROAR_HAVE_H_WINDOWS     %            windows.h     c          -- windows.h
1288test_lib_defmake ROAR_HAVE_H_WINSOCK2    %            winsock2.h    c          -- winsock2.h
1289MINIMAL=$OLD_MINIMAL
1290
1291#                #define                 subdir       name           -lxxx      -- header
1292test_lib_defmake ROAR_HAVE_LIBM          %            'Math Library' m          -- math.h
1293if test_lib 'realtime Library' rt -- sys/mman.h mqueue.h semaphore.h
1294then
1295 {
1296  echo '#define ROAR_HAVE_LIBRT'
1297  echo '#define ROAR_NEED_LIBRT'
1298 } >&3
1299fi
1300
1301echo >&3
1302
1303#                #define                 subdir       name          -lxxx      -- header
1304test_lib_defmake ROAR_HAVE_ESD           %            EsounD        esd        -- esd.h
1305test_lib_defmake ROAR_HAVE_LIBAO         %            libao         ao         -- ao/ao.h ao/plugin.h
1306test_lib_defmake ROAR_HAVE_LIBRAUM       %            RAUM          raum       -- raum.h
1307test_lib_defmake ROAR_HAVE_LIBOGG        %            libogg        ogg        -- ogg/ogg.h
1308test_lib_defmake ROAR_HAVE_LIBVORBIS     %            libvorbis     vorbis     -- vorbis/codec.h
1309test_lib_defmake ROAR_HAVE_LIBVORBISFILE %            libvorbisfile vorbisfile -- vorbis/vorbisfile.h
1310test_lib_defmake ROAR_HAVE_LIBVORBISENC  %            libvorbisenc  vorbisenc  -- vorbis/vorbisenc.h
1311test_lib_defmake ROAR_HAVE_LIBSPEEX      %            libspeex      speex      -- speex/speex.h speex/speex_stereo.h
1312test_lib_defmake ROAR_HAVE_LIBSPEEXDSP   %            libspeexdsp   speexdsp   -- speex/speex.h speex/speex_echo.h
1313test_lib_defmake ROAR_HAVE_LIBCELT       %            libcelt       celt       -- celt/celt.h celt/celt_header.h
1314test_lib_defmake ROAR_HAVE_LIBCELT0      %            libcelt0      celt0      -- celt/celt.h celt/celt_header.h
1315test_lib_defmake ROAR_HAVE_LIBOGGZ       %            liboggz       oggz       -- oggz/oggz.h
1316test_lib_defmake ROAR_HAVE_LIBSNDFILE    %            libsndfile    sndfile    -- sndfile.h
1317test_lib_defmake ROAR_HAVE_LIBFISHSOUND  roarfish     libfishsound  fishsound  -- fishsound/fishsound.h
1318test_lib_defmake ROAR_HAVE_LIBFLAC       %            libFLAC       FLAC       -- FLAC/all.h
1319test_lib_defmake ROAR_HAVE_LIBSAMPLERATE %            libsamplerate samplerate -- samplerate.h
1320test_lib_defmake ROAR_HAVE_LIBSHOUT      %            libshout      shout      -- shout/shout.h
1321test_lib_defmake ROAR_HAVE_LIBPULSE      libroarpulse libpulse      pulse      -- pulse/pulseaudio.h pulse/simple.h
1322test_lib_defmake ROAR_HAVE_LIBPULSESIMPLE %           libpulse-simple pulse-simple -- pulse/simple.h
1323test_lib_defmake ROAR_HAVE_LIBY2         libroaryiff  libyiff       Y2         -- Y2/Y.h Y2/Ylib.h
1324test_lib_defmake ROAR_HAVE_LIBARTSC      %            libartsc      artsc      -- kde/artsc/artsc.h
1325test_lib_defmake ROAR_HAVE_LIBOSSAUDIO   %            libossaudio   ossaudio   -- sys/ioctl.h
1326test_lib_defmake ROAR_HAVE_LIBSNDIO      %            libsndio      sndio      -- sndio.h
1327test_lib_defmake ROAR_HAVE_LIBRSOUND     libroarrsound librsound    rsound     -- rsound.h
1328test_lib_defmake ROAR_HAVE_LIBPORTAUDIO  %            PortAudio     portaudio  -- portaudio.h
1329test_lib_defmake ROAR_HAVE_LIBPABLIO     %            PABLIO        pablio     -- pablio/pablio.h
1330test_lib_defmake ROAR_HAVE_LIBSSL        %            OpenSSL       ssl        -- openssl/bio.h openssl/evp.h
1331test_lib_defmake ROAR_HAVE_LIBSLP        %            OpenSLP       slp        -- slp.h
1332test_lib_defmake ROAR_HAVE_LIBUUID       %            libuuid       uuid       -- uuid/uuid.h
1333test_lib_defmake ROAR_HAVE_LIBDNET       %            libdnet       dnet       -- sys/socket.h netdnet/dn.h netdnet/dnetdb.h
1334test_lib_defmake ROAR_HAVE_LIBPTHREAD    %            libpthread    pthread    -- pthread.h
1335OLD_MINIMAL=$MINIMAL
1336MINIMAL=false
1337test_lib_defmake ROAR_HAVE_BSDSOCKETS    %            BSDSockets    c          -- sys/types.h sys/socket.h
1338test_lib_defmake ROAR_HAVE_UNIX          %            UNIX          c          -- sys/types.h sys/socket.h sys/un.h
1339test_lib_defmake ROAR_HAVE_IPV4          %            IPv4          c          -- sys/types.h sys/socket.h 'netinet/in.h' winsock2.h
1340MINIMAL=$OLD_MINIMAL
1341test_lib_defmake ROAR_HAVE_IPX           %            IPX           c          -- netipx/ipx.h
1342test_lib_defmake ROAR_HAVE_OSS           %            OSS           c          -- sys/ioctl.h sys/soundcard.h
1343test_lib_defmake ROAR_HAVE_OSS_BSD       %            BSDOSS        c          -- sys/ioctl.h soundcard.h
1344test_lib_defmake ROAR_HAVE_LIBWINMM      %            WinMM         winmm      -- windows.h mmsystem.h
1345test_lib_defmake ROAR_HAVE_LIBASOUND     %            ALSA          asound     -- alsa/asoundlib.h alsa/pcm_external.h alsa/control_external.h
1346test_lib_defmake ROAR_HAVE_LIBDL         %            DynLinkerLib  dl         -- dlfcn.h
1347test_lib_defmake ROAR_HAVE_LIBZ          %            zlib          z          -- zlib.h
1348test_lib_defmake ROAR_HAVE_LIBSENDFILE   %            sendfile      sendfile   -- sys/sendfile.h
1349test_lib_defmake ROAR_HAVE_LIBSOCKET     %            libsocket     socket     -- sys/socket.h
1350test_lib_defmake ROAR_HAVE_LIBWSOCK32    %            WinSockP0     wsock32    -- winsock2.h
1351test_lib_defmake ROAR_HAVE_LIBWS2_32     %            WinSockP1     ws2_32     -- winsock2.h
1352test_lib_defmake ROAR_HAVE_LIBX11        %            X11           X11        -- X11/Xlib.h X11/Xatom.h
1353test_lib_defmake ROAR_HAVE_GTK_P_2_0     %            GTK+2.0       gtk+-2.0/t -- gtk/gtk.h gdk/gdkkeysyms.h
1354test_lib_defmake ROAR_HAVE_LIBGCRYPT     %            libgcrypt     gcrypt     -- gcrypt.h
1355test_lib_defmake ROAR_HAVE_LIBJACK       %            libjack       jack/t     -- jack/jack.h
1356test_lib_defmake ROAR_HAVE_LIBDBUS       %            libdbus       dbus-1/t   -- dbus-1.0/dbus/dbus.h
1357
1358echo >&3
1359
1360test_version ROAR_HAVE_CELT_VERSION      libcelt  celt
1361test_version ROAR_HAVE_SPEEX_VERSION     libspeex speex
1362test_version ROAR_HAVE_PULSE_VERSION     libpulse libpulse
1363test_version ROAR_HAVE_GTK_P_2_0_VERSION GTK+2.0  gtk+-2.0
1364test_version ROAR_HAVE_FLAC_VERSION      libflac  flac
1365
1366echo >&3
1367
1368# Those tests should not be disabled as they do not reduce the lib size just
1369# break --minimal on full systems
1370
1371OLD_MINIMAL=$MINIMAL
1372MINIMAL=false
1373# Test types:
1374#         DEF                            type/name    init value               -- headers
1375test_type ROAR_HAVE_T_ID_T               id_t
1376test_type ROAR_HAVE_T_PID_T              pid_t
1377test_type ROAR_HAVE_T_UID_T              uid_t
1378test_type ROAR_HAVE_T_GID_T              gid_t
1379test_type ROAR_HAVE_T_SOCKLEN_T          socklen_t    0                        -- sys/socket.h
1380test_type ROAR_HAVE_T_MODE_T             mode_t
1381test_type ROAR_HAVE_T_OFF_T              off_t
1382test_type ROAR_HAVE_T_SSIZE_T            ssize_t
1383test_type ROAR_HAVE_T_TIME_T             time_t
1384test_type ROAR_HAVE_T_SA_FAMILY_T        sa_family_t  0                        -- sys/socket.h
1385MINIMAL=$OLD_MINIMAL
1386
1387echo >&3
1388
1389# add a better test here
1390#test_lib 'linux sendfile()'       -- sys/sendfile.h && echo '#define ROAR_HAVE_LINUX_SENDFILE' >&3
1391
1392
1393echo -n 'checking for IPv6... '
1394
1395if $MINIMAL
1396then
1397 echo "disabled by user (minimalstic build)"
1398else
1399 echo '#include <sys/socket.h>'  > $TF_C
1400 echo '#include <netinet/in.h>' >> $TF_C
1401 echo 'int main (void) { struct sockaddr_in6 in6; return 0; }' >> $TF_C
1402
1403 if $CCTF 2> /dev/null;
1404 then
1405  echo '#define ROAR_HAVE_IPV6' >&3
1406  echo yes
1407 else
1408  echo no
1409 fi
1410fi
1411
1412
1413echo -n 'checking for _exit()... '
1414
1415echo '#include <unistd.h>'    > $TF_C
1416echo 'int main (void) { _exit(0); return 0; }' >> $TF_C
1417
1418if $CCTF 2> /dev/null;
1419then
1420 echo '#define ROAR_HAVE_U_EXIT' >&3
1421 echo '#define ROAR_U_EXIT _exit' >&3
1422 echo yes
1423else
1424 echo '#define ROAR_U_EXIT exit' >&3
1425 echo no
1426fi
1427
1428#                 def                 name      call                         -- header
1429test_func_defmake ROAR_HAVE_SETENV    setenv    'setenv("", "", 0)'          -- stdlib.h
1430test_func_defmake ROAR_HAVE_PUTENV    putenv    'putenv("")'                 -- stdlib.h
1431test_func_defmake ROAR_HAVE_STRTOK_R  strtok_r  'strtok_r("","",(char**)0)'  -- string.h
1432test_func_defmake ROAR_HAVE_NICE      nice      'nice(0)'                    -- unistd.h
1433test_func_defmake ROAR_HAVE_GETGID    getgid    'getgid()'                   -- sys/types.h unistd.h
1434test_func_defmake ROAR_HAVE_GETUID    getuid    'getuid()'                   -- sys/types.h unistd.h
1435test_func_defmake ROAR_HAVE_SETGID    setgid    'setgid(0)'                  -- sys/types.h unistd.h
1436test_func_defmake ROAR_HAVE_SETUID    setuid    'setuid(0)'                  -- sys/types.h unistd.h
1437test_func_defmake ROAR_HAVE_SETSID    setsid    'setsid()'                   -- sys/types.h unistd.h
1438test_func_defmake ROAR_HAVE_GETTIMEOFDAY gettimeofday 'struct timeval tv; gettimeofday(&tv, NULL)' -- sys/time.h time.h
1439test_func_defmake ROAR_HAVE_USLEEP    usleep    'usleep(0)'                  -- sys/types.h unistd.h
1440test_func_defmake ROAR_HAVE_ALARM     alarm     'alarm(0)'                   -- sys/types.h unistd.h
1441test_func_defmake ROAR_HAVE_TIME      time      'time((void*)0)'             -- time.h
1442test_func_defmake ROAR_HAVE_KILL      kill      'kill(0,0)'                  -- sys/types.h signal.h
1443test_func_defmake ROAR_HAVE_UNAME     uname     'uname((void*)0)'            -- sys/utsname.h
1444test_func_defmake ROAR_HAVE_SYSLOG    syslog    'syslog(0, "")'              -- syslog.h
1445test_func_defmake ROAR_HAVE_OPENLOG   openlog   'openlog("", 0, 0)'          -- syslog.h
1446test_func_defmake ROAR_HAVE_CLOSELOG  closelog  'closelog()'                 -- syslog.h
1447test_func_defmake ROAR_HAVE_FILENO    fileno    'fileno(0)'                  -- stdio.h
1448test_func_defmake ROAR_HAVE_FTELL     ftell     'ftell(0)'                   -- stdio.h
1449test_func_defmake ROAR_HAVE_FSEEK     fseek     'fseek(0, 0, 0)'             -- stdio.h
1450test_func_defmake ROAR_HAVE_POPEN     popen     'popen("", "")'              -- stdio.h
1451test_func_defmake ROAR_HAVE_PCLOSE    pclose    'pclose(0)'                  -- stdio.h
1452test_func_defmake ROAR_HAVE_GETSOCKNAME getsockname 'getsockname(0, 0, 0)'   -- sys/socket.h
1453test_func_defmake ROAR_HAVE_GETPEERNAME getpeername 'getpeername(0, 0, 0)'   -- sys/socket.h
1454test_func_defmake ROAR_HAVE_GETSOCKOPT getsockopt 'getsockopt(0, 0, 0, (void*)0, (void*)0)' -- sys/types.h sys/socket.h
1455test_func_defmake ROAR_HAVE_SETSOCKOPT setsockopt 'setsockopt(0, 0, 0, (void*)0, (void*)0)' -- sys/types.h sys/socket.h
1456test_func_defmake ROAR_HAVE_RAND      rand      'rand()'                     -- stdlib.h
1457test_func_defmake ROAR_HAVE_RAND_R    rand_r    'rand_r((unsigned int*)0)'   -- stdlib.h
1458test_func_defmake ROAR_HAVE_SRAND     srand     'srand((unsigned int)0)'     -- stdlib.h
1459test_func_defmake ROAR_HAVE_FCNTL     fcntl     'fcntl(0, 0)'                -- unistd.h fcntl.h
1460test_func_defmake ROAR_HAVE_LINUX_SENDFILE sendfile 'sendfile(-1, -1, (void*)0, 0)' -- sys/sendfile.h
1461test_func_defmake ROAR_HAVE_GETVERSIONEX     GetVersionEx     'OSVERSIONINFO osinfo; osinfo.dwOSVersionInfoSize = sizeof(osinfo);GetVersionEx(&osinfo);'                -- windows.h
1462
1463
1464echo -n 'checking for basic IO calls... '
1465
1466cat <<EOF > $TF_C
1467#include <sys/types.h>
1468#include <sys/stat.h>
1469#include <fcntl.h>
1470#include <string.h>
1471#include <unistd.h>
1472
1473int main(void) {
1474 open(NULL, 0, 0);
1475 close(0);
1476 read(0, NULL, 0);
1477 write(0, NULL, 0);
1478 lseek(0, 0, 0);
1479 return 0;
1480}
1481EOF
1482
1483if $CCTF 2> /dev/null;
1484then
1485 echo '#define ROAR_HAVE_IO_POSIX' >&3
1486 echo posix
1487else
1488 echo none
1489fi
1490
1491echo -n 'checking for basic FS calls... '
1492
1493cat <<EOF > $TF_C
1494#include <string.h>
1495#include <unistd.h>
1496
1497int main(void) {
1498 chdir(NULL);
1499 unlink(NULL);
1500 return 0;
1501}
1502EOF
1503
1504if $CCTF 2> /dev/null;
1505then
1506 echo '#define ROAR_HAVE_FS_POSIX' >&3
1507 echo posix
1508else
1509 echo none
1510fi
1511
1512
1513test_func_defmake ROAR_HAVE_CHROOT     chroot     'chroot((void*)0)'           -- unistd.h
1514test_func_defmake ROAR_HAVE_MLOCK      mlock      'mlock((void*)0, 0)'         -- sys/mman.h
1515test_func_defmake ROAR_HAVE_MUNLOCK    munlock    'munlock((void*)0, 0)'       -- sys/mman.h
1516test_func_defmake ROAR_HAVE_MLOCKALL   mlockall   'mlockall(MCL_CURRENT|MCL_FUTURE)' -- sys/mman.h
1517test_func_defmake ROAR_HAVE_MUNLOCKALL munlockall 'munlockall()'               -- sys/mman.h
1518test_func_defmake ROAR_HAVE_MMAP       mmap       'mmap((void*)0,0,0,0,0,0)'   -- sys/mman.h
1519
1520echo -n 'checking for fsync()... '
1521
1522echo '#include <unistd.h>' > $TF_C
1523echo 'int main (void) { fsync(0); return 0; }' >> $TF_C
1524
1525if $CCTF 2> /dev/null;
1526then
1527 echo '#define ROAR_HAVE_FSYNC' >&3
1528 FSYNC=true
1529 echo yes
1530else
1531 FSYNC=false
1532 echo no
1533fi
1534
1535echo -n 'checking for fdatasync()... '
1536
1537echo '#include <unistd.h>' > $TF_C
1538echo 'int main (void) { fdatasync(0); return 0; }' >> $TF_C
1539
1540if $CCTF 2> /dev/null;
1541then
1542 echo '#define ROAR_HAVE_FDATASYNC' >&3
1543 echo '#define ROAR_FDATASYNC fdatasync' >&3
1544 echo yes
1545else
1546 $FSYNC && echo '#define ROAR_FDATASYNC fsync' >&3
1547 echo no
1548fi
1549
1550
1551#test_func_defmake ROAR_HAVE_STRCASESTR strcasestr 'strcasestr("", "")'       -- string.h
1552echo -n 'checking for strcasestr()... '
1553
1554echo '#define _GNU_SOURCE' > $TF_C
1555echo '#include <string.h>' >> $TF_C
1556echo 'int main (void) { strcasestr("", ""); return 0; }' >> $TF_C
1557
1558if $CCTF 2> /dev/null;
1559then
1560 echo '#define ROAR_HAVE_STRCASESTR' >&3
1561 NEED_GNU_SOURCE=true
1562 echo yes
1563else
1564 echo no
1565fi
1566
1567echo -n 'checking for fopencookie()... '
1568
1569echo '#define _GNU_SOURCE' > $TF_C
1570echo '#include <stdio.h>' >> $TF_C
1571echo 'int main (void) { cookie_io_functions_t f; fopencookie(NULL, "", f); return 0; }' >> $TF_C
1572
1573if $CCTF 2> /dev/null;
1574then
1575 echo '#define ROAR_HAVE_FOPENCOOKIE' >&3
1576 NEED_GNU_SOURCE=true
1577 echo yes
1578else
1579 echo no
1580fi
1581
1582echo -n 'checking for funopen()... '
1583
1584echo '#define __BSD_VISIBLE 1'  > $TF_C
1585echo '#include <stdio.h>'      >> $TF_C
1586echo 'int main (void) { funopen(NULL, NULL, NULL, NULL, NULL); return 0; }' >> $TF_C
1587
1588if $CCTF 2> /dev/null;
1589then
1590 echo '#define ROAR_HAVE_FUNOPEN' >&3
1591 echo '#define ROAR_NEED_BSD_VISIBLE' >&3
1592 echo yes
1593else
1594 echo no
1595fi
1596
1597test_func_defmake ROAR_HAVE_PIPE      pipe      'pipe(NULL)'                 -- unistd.h
1598test_func_defmake ROAR_HAVE_FORK      fork      'fork()'                     -- unistd.h
1599test_func_defmake ROAR_HAVE_WAIT      wait      'wait(NULL)'                 -- string.h sys/wait.h
1600
1601echo -n 'checking for square root func... '
1602
1603if $TARGET_CYGWIN
1604then
1605 echo 'sqrt() (cygwin)'
1606elif [ "$SYSNAME" = 'FreeBSD' ]
1607then
1608 echo 'sqrt() (FreeBSD, fix your gcc)'
1609elif [ "$SYSNAME" = 'Linux' ]
1610then
1611 echo '#include <math.h>' > $TF_C
1612 echo 'int main (void) { sqrtl(0); return 0; }' >> $TF_C
1613
1614 if $CCTF -lm 2> /dev/null;
1615 then
1616  echo '#define ROAR_HAVE_SQRTL' >&3
1617  echo 'sqrtl()'
1618 else
1619  echo 'sqrt()'
1620 fi
1621else
1622 echo 'sqrt()'
1623fi
1624
1625echo -n 'checking for inline funcs... '
1626
1627echo 'inline int test (void) { return 0; }' > $TF_C
1628echo 'int main (void) { return test(); }'  >> $TF_C
1629
1630if $CCTF 2> /dev/null;
1631then
1632 echo '#define ROAR_HAVE_INLINE' >&3
1633 echo yes
1634else
1635 echo no
1636fi
1637
1638
1639echo -n 'checking for -pthread... '
1640
1641echo '#include <pthread.h>'                            > $TF_C
1642echo 'int main (void) { pthread_self(); return 0; }'  >> $TF_C
1643
1644if $CCTF -pthread 2> /dev/null;
1645then
1646 echo '#define ROAR_HAVE_CC_PTHREAD_OPTION' >&3
1647 echo 'opt_pthread=-pthread' >&4
1648 echo 'pthread=$(opt_pthread)' >&4
1649 echo yes
1650else
1651 echo 'opt_pthread=' >&4
1652 echo 'pthread=$(lib_pthread)' >&4
1653 echo no
1654fi
1655
1656
1657echo -n 'checking for broken peercred... '
1658echo '#include <sys/types.h>'      >  $TF_C
1659echo '#include <sys/socket.h>'     >> $TF_C
1660echo '#include <sys/un.h>'         >> $TF_C
1661echo 'int main (void) { struct ucred cred; return 0; }'  >> $TF_C
1662
1663if $CCTF 2> /dev/null;
1664then
1665 echo working
1666else
1667 if $CCTF -D_GNU_SOURCE 2> /dev/null;
1668 then
1669  NEED_GNU_SOURCE=true
1670  echo need to set _GNU_SOURCE
1671 else
1672  echo '#define ROAR_BROKEN_PEERCRED' >&3
1673  echo broken
1674 fi
1675fi
1676
1677
1678test_func_defmake ROAR_HAVE_GETPEEREID getpeereid 'getpeereid(0, NULL, NULL)' -- sys/types.h sys/socket.h
1679
1680echo -n 'checking for select()... '
1681cat <<EOF > $TF_C
1682#ifndef WITHOUT_SYS_SELECT_H
1683#include <sys/select.h>
1684#endif
1685#ifdef WITH_WINSOCK_H
1686#include <winsock.h>
1687#endif
1688#include <sys/time.h>
1689#include <sys/types.h>
1690#include <unistd.h>
1691
1692int main (void) {
1693 fd_set rfds;
1694 struct timeval tv;
1695
1696 FD_ZERO(&rfds);
1697 FD_SET(0, &rfds);
1698
1699 tv.tv_sec  = 0;
1700 tv.tv_usec = 0;
1701
1702 select(1, &rfds, NULL, NULL, &tv);
1703
1704 return 0;
1705}
1706EOF
1707
1708if $CCTF 2> /dev/null;
1709then
1710 echo '#define ROAR_HAVE_SELECT' >&3
1711 echo '#define ROAR_HAVE_H_SYS_SELECT' >&3
1712 echo yes, POSIX.1-2001
1713elif $CCTF -DWITHOUT_SYS_SELECT_H 2> /dev/null;
1714then
1715 echo '#define ROAR_HAVE_SELECT' >&3
1716 echo yes, old style
1717elif $CCTF -DWITHOUT_SYS_SELECT_H -DWITH_WINSOCK_H $lib_wsock32 >&5 2>&5;
1718then
1719 echo '#define ROAR_HAVE_SELECT' >&3
1720 echo yes, WinSock
1721else
1722 echo no
1723fi
1724
1725echo -n 'checking for shutdown()... '
1726cat <<EOF > $TF_C
1727#include <sys/types.h>
1728#ifndef WITHOUT_SYS_SOCKET_H
1729#include <sys/socket.h>
1730#endif
1731#ifdef WITH_WINSOCK_H
1732#include <winsock.h>
1733#endif
1734
1735int main (void) { shutdown(0, 0); return 0; }
1736EOF
1737
1738if [ "$SYSNAME" = 'SunOS' ]
1739then
1740 _l='-lsocket'
1741else
1742 _l=''
1743fi
1744
1745if $CCTF $_l 2> /dev/null;
1746then
1747 echo '#define ROAR_HAVE_SHUTDOWN'     >&3
1748 echo '#define ROAR_SHUTDOWN shutdown' >&3
1749 echo yes
1750elif $CCTF -DWITHOUT_SYS_SOCKET_H -DWITH_WINSOCK_H $lib_wsock32 2> /dev/null;
1751then
1752 echo '#define ROAR_HAVE_SHUTDOWN'     >&3
1753 echo '#define ROAR_SHUTDOWN shutdown' >&3
1754 echo yes, WinSock
1755else
1756 echo '#define ROAR_SHUTDOWN(x,y) (-1)' >&3
1757 echo no
1758fi
1759
1760echo -n 'checking for accept()... '
1761cat <<EOF > $TF_C
1762#include <sys/types.h>
1763#ifndef WITHOUT_SYS_SOCKET_H
1764#include <sys/socket.h>
1765#endif
1766#ifdef WITH_WINSOCK_H
1767#include <winsock.h>
1768#endif
1769
1770int main (void) { accept(0, 0, 0); return 0; }
1771EOF
1772
1773if [ "$SYSNAME" = 'SunOS' ]
1774then
1775 _l='-lsocket'
1776else
1777 _l=''
1778fi
1779
1780if $CCTF $_l 2> /dev/null;
1781then
1782 echo '#define ROAR_HAVE_ACCEPT'     >&3
1783 echo '#define ROAR_ACCEPT accept'   >&3
1784 echo yes
1785elif $CCTF -DWITHOUT_SYS_SOCKET_H -DWITH_WINSOCK_H $lib_wsock32 2> /dev/null;
1786then
1787 echo '#define ROAR_HAVE_ACCEPT'     >&3
1788 echo '#define ROAR_ACCEPT accept'   >&3
1789 echo yes, WinSock
1790else
1791 echo '#define ROAR_ACCEPT(x,y,z) (-1)' >&3
1792 echo no
1793fi
1794
1795test_func_defmake ROAR_HAVE_GETOBJECTBYNAME getobjectbyname 'getobjectbyname(NULL)' dnet -- stdlib.h netdnet/dn.h netdnet/dnetdb.h
1796test_func_defmake ROAR_HAVE_GETSERVBYNAME   getservbyname   'getservbyname((void*)0, (void*)0)' -- netdb.h
1797
1798
1799# --- PulseAudio tests ---
1800test_pa_type ROAR_HAVE_TYPE_PA_PATH_GET_FILENAME pa_path_get_filename type 'const char *' 'char *' 'const char *pa_path_get_filename(const char *p) { return NULL; }' pulse/simple.h
1801
1802test_pa_type ROAR_HAVE_TYPE_PA_UTF8_VALID pa_utf8_valid type 'const char *' 'char *' 'const char *pa_utf8_valid(const char *str) { return NULL; }'
1803
1804test_pa_type ROAR_HAVE_ARG_SINK_NAME_OF_PA_CONTEXT_MOVE_SINK_INPUT_BY_NAME pa_context_move_sink_input_by_name args:'pa_context *c, uint32_t idx, %s sink_name, pa_context_success_cb_t cb, void* userdata' 'const char *' 'char *' 'pa_operation* pa_context_move_sink_input_by_name(pa_context *c, uint32_t idx, const char *sink_name, pa_context_success_cb_t cb, void* userdata) { return NULL; }'
1805
1806test_pa_type ROAR_HAVE_ARG_SOURCE_NAME_OF_PA_CONTEXT_MOVE_SOURCE_OUTPUT_BY_NAME pa_context_move_source_output_by_name args:'pa_context *c, uint32_t idx, %s source_name, pa_context_success_cb_t cb, void* userdata)' 'const char *' 'char *' 'pa_operation* pa_context_move_source_output_by_name(pa_context *c, uint32_t idx, const char *source_name, pa_context_success_cb_t cb, void* userdata) { return NULL; }'
1807
1808test_pa_type ROAR_HAVE_ARG_VOLUME_OF_PA_STREAM_CONNECT_PLAYBACK pa_stream_connect_playback args:'pa_stream *s, const char *dev, const pa_buffer_attr *attr, pa_stream_flags_t flags, %s volume, pa_stream *sync_stream' 'const pa_cvolume *' 'pa_cvolume *' 'int pa_stream_connect_playback(pa_stream *s, const char *dev, const pa_buffer_attr *attr, pa_stream_flags_t flags, const pa_cvolume * volume, pa_stream *sync_stream) { return -1; }'
1809# --- End of PulseAudio tests ---
1810
1811
1812echo -n 'checking for struct rsound'\''s sample size member... '
1813
1814cat > $TF_C << EOF
1815#define RSD_EXPOSE_STRUCT
1816#include <rsound.h>
1817
1818int main (void) {
1819 rsound_t var;
1820
1821 var.samplesize = 0;
1822
1823 return 0;
1824}
1825EOF
1826if $CCTF 2> /dev/null;
1827then
1828 echo '#define ROAR_HAVE_RSOUND_SAMPLESIZE'     >&3
1829 echo '#define ROAR_HAVE_RSOUND_SAMPLESIZE_MEMBER samplesize'   >&3
1830 echo samplesize
1831else
1832 echo '#define ROAR_HAVE_RSOUND_SAMPLESIZE_MEMBER framesize'   >&3
1833 echo framesize
1834fi
1835
1836echo -n 'checking for safe 32 bit integer overflow... '
1837
1838cat > $TF_C << EOF
1839#include <stdio.h>
1840#include <stdint.h>
1841#define TYPE uint32_t
1842#define MAX  ((TYPE)4294967295U)
1843
1844int main (void) {
1845 TYPE a = MAX;
1846
1847 a += 2;
1848
1849 if ( a == 1 ) {
1850  printf("#define ROAR_HAVE_SAFE_OVERFLOW\n");
1851  return 0;
1852 }
1853
1854 return 1;
1855}
1856EOF
1857
1858if $CCTF 2> /dev/null;
1859then
1860 $EXEC_HELPER $TF_E >&3 2> /dev/null
1861 if [ "$?" = '0' ]
1862 then
1863  echo yes
1864 else
1865  echo no
1866 fi
1867else
1868 echo 'no (can not compile!, no stdint.h?)'
1869fi
1870
1871echo -n 'checking for __LP64__... '
1872if $TARGET_WIN32
1873then
1874 echo 'no need to set (win32 build)'
1875else
1876cat > $TF_C << EOF
1877#include <stdio.h>
1878
1879int main (void) {
1880#ifdef __LP64__
1881 fprintf(stderr, "set by compiler\n");
1882#else
1883 if ( sizeof(int) == sizeof(void*) ) {
1884  fprintf(stderr, "no need to set\n");
1885 } else {
1886  fprintf(stderr, "need to set\n");
1887  printf("\n#ifndef __LP64__\n#define __LP64__\n#endif\n\n");
1888 }
1889#endif
1890 return 0;
1891}
1892EOF
1893 if $CCTF 2> /dev/null;
1894 then
1895  $EXEC_HELPER $TF_E >&3
1896 else
1897  echo 'error, can not compile'
1898  exit 1
1899 fi
1900fi
1901
1902echo -n 'checking for 64 bit types... '
1903if $TARGET_WIN32
1904then
1905 echo 'int64_t, uint64_t (win32 build)'
1906 echo '#define ROAR_NATIVE_INT64  int64_t'  >&3
1907 echo '#define ROAR_NATIVE_UINT64 uint64_t' >&3
1908else
1909cat > $TF_C << EOF
1910#include <stdio.h>
1911#include <stdint.h>
1912
1913int main (void) {
1914 char * i64 = NULL, * ui64 = NULL;
1915
1916 if ( sizeof(int) == 8 ) {
1917  i64 = "int"; ui64 = "unsigned int";
1918 } else if ( sizeof(long int) == 8 ) {
1919  i64 = "long int"; ui64 = "unsigned long int";
1920 } else if ( sizeof(long long int) == 8 ) {
1921  i64 = "long long int"; ui64 = "unsigned long long int";
1922 } else if ( sizeof(int64_t) == 8 ) {
1923  i64 = "int64_t"; ui64 = "uint64_t";
1924 } else {
1925  fprintf(stderr, "none\n");
1926  return 0;
1927 }
1928
1929 fprintf(stderr, "%s, %s\n", i64, ui64);
1930 printf("#define ROAR_NATIVE_INT64 %s\n#define ROAR_NATIVE_UINT64 %s\n", i64, ui64);
1931
1932 return 0;
1933}
1934EOF
1935 if $CCTF 2> /dev/null;
1936 then
1937  $EXEC_HELPER $TF_E >&3
1938 else
1939  echo 'error, can not compile'
1940  exit 1
1941 fi
1942fi
1943
1944
1945echo -n 'checking if cp supports -v... '
1946if cp -v --help > /dev/null 2> /dev/null
1947then
1948 echo "cp_v=-v" >&4
1949 echo yes
1950else
1951 echo "cp_v=" >&4
1952 echo no
1953fi
1954
1955echo -n 'checking for cdrom device... '
1956if [ -n "$CDROM" ]
1957then
1958 if [ "$CDROM" = '(none)' ]
1959 then
1960  echo "none (disabled by user)"
1961 else
1962  if $CROSS_COMPILE
1963  then
1964   echo "$CDROM (cross compile)"
1965  elif [ -e "$CDROM" ]
1966  then
1967   echo "$CDROM (forced by user)"
1968  else
1969   echo "$CDROM (not existing, forced by user)"
1970  fi
1971  echo '#define ROAR_DEFAULT_CDROM "'"$CDROM"'"' >&3
1972  echo '#define ROAR_HAVE_CDROM' >&3
1973 fi
1974elif $CROSS_COMPILE
1975then
1976 echo 'none (cross compiling, use --cdrom to enable CDROM support)'
1977else
1978 CDROM=$(ls /dev/cdrom /dev/rcd0c 2> /dev/null | head -n 1);
1979 if [ -e "$CDROM" ]
1980 then
1981  echo "$CDROM"
1982  echo '#define ROAR_DEFAULT_CDROM "'"$CDROM"'"' >&3
1983  echo '#define ROAR_HAVE_CDROM' >&3
1984 else
1985  echo 'none'
1986  echo '#define ROAR_HAVE_CDROM' >&3
1987 fi
1988fi
1989
1990echo -n 'checking for default tty device... '
1991if [ -n "$TTY_DEV" ]
1992then
1993 if [ "$TTY_DEV" = '(none)' ]
1994 then
1995  echo "none (disabled by user)"
1996 else
1997  if $CROSS_COMPILE
1998  then
1999   echo "$TTY_DEV (cross compile)"
2000  elif [ -e "$TTY_DEV" ]
2001  then
2002   echo "$TTY_DEV (forced by user)"
2003  else
2004   echo "$TTY_DEV (not existing, forced by user)"
2005  fi
2006  echo '#define ROAR_DEFAULT_TTY "'"$TTY_DEV"'"' >&3
2007 fi
2008elif $CROSS_COMPILE
2009then
2010 echo 'none (cross compiling, use --tty to set default device)'
2011else
2012 TTY_DEV=$(ls /dev/tty 2> /dev/null | head -n 1);
2013 if [ -e "$TTY_DEV" ]
2014 then
2015  echo "$TTY_DEV"
2016  echo '#define ROAR_DEFAULT_TTY "'"$TTY_DEV"'"' >&3
2017 else
2018  echo 'none'
2019 fi
2020fi
2021
2022echo -n 'checking for OSS device... '
2023if [ -n "$OSS_DEV" ]
2024then
2025 if [ "$OSS_DEV" = '(none)' ]
2026 then
2027  echo "none (disabled by user)"
2028 else
2029  if $CROSS_COMPILE
2030  then
2031   echo "$OSS_DEV (cross compile)"
2032  elif [ -e "$OSS_DEV" ]
2033  then
2034   echo "$OSS_DEV (forced by user)"
2035  else
2036   echo "$OSS_DEV (not existing, forced by user)"
2037  fi
2038  echo '#define ROAR_DEFAULT_OSS_DEV "'"$OSS_DEV"'"' >&3
2039 fi
2040elif $CROSS_COMPILE
2041then
2042 echo 'none (cross compiling, use --oss-dev to set default device)'
2043else
2044 OSS_DEV=$(ls /dev/dsp /dev/audio 2> /dev/null | head -n 1);
2045 if [ -e "$OSS_DEV" ]
2046 then
2047  echo "$OSS_DEV"
2048  echo '#define ROAR_DEFAULT_OSS_DEV "'"$OSS_DEV"'"' >&3
2049 else
2050  echo 'none'
2051 fi
2052fi
2053
2054echo -n 'checking for OSS mixer device... '
2055if [ -n "$OSS_MIX_DEV" ]
2056then
2057 if [ "$OSS_MIX_DEV" = '(none)' ]
2058 then
2059  echo "none (disabled by user)"
2060 else
2061  if $CROSS_COMPILE
2062  then
2063   echo "$OSS_MIX_DEV (cross compile)"
2064  elif [ -e "$OSS_MIX_DEV" ]
2065  then
2066   echo "$OSS_MIX_DEV (forced by user)"
2067  else
2068   echo "$OSS_MIX_DEV (not existing, forced by user)"
2069  fi
2070  echo '#define ROAR_DEFAULT_OSS_MIX_DEV "'"$OSS_MIX_DEV"'"' >&3
2071 fi
2072elif $CROSS_COMPILE
2073then
2074 echo 'none (cross compiling, use --oss-mixer-dev to set default device)'
2075else
2076 OSS_MIX_DEV=$(ls /dev/mixer 2> /dev/null | head -n 1);
2077 if [ -e "$OSS_MIX_DEV" ]
2078 then
2079  echo "$OSS_MIX_DEV"
2080  echo '#define ROAR_DEFAULT_OSS_MIX_DEV "'"$OSS_MIX_DEV"'"' >&3
2081 else
2082  echo 'none'
2083 fi
2084fi
2085
2086echo 'checking for decnet status file... '"$PROC_NET_DECNET"
2087echo '#define ROAR_PROC_NET_DECNET "'"$PROC_NET_DECNET"'"' >&3
2088
2089
2090echo -n 'checking for default audio group... '
2091if [ "$DEFAULT_GRP" = '(none)' ]
2092then
2093 echo "none (disabled by user)"
2094else
2095 echo "$DEFAULT_GRP"
2096 echo '#define ROAR_DEFAULT_SOCKGRP "'"$DEFAULT_GRP"'"' >&3
2097fi
2098
2099echo -n 'checking for user id of root/superuser... '
2100if [ "$ROOT_UID" = '(none)' ]
2101then
2102 echo "none (disabled by user)"
2103elif [ "$ROOT_UID" = '' ]
2104then
2105 ROOT_USER='root'
2106 ROOT_UID=`id -u $ROOT_USER`
2107 if [ "$ROOT_UID" = '' ]
2108 then
2109  echo "none (please report this)"
2110 else
2111  echo "$ROOT_UID($ROOT_USER)"
2112  echo '#define ROAR_ROOT_UID '"$ROOT_UID" >&3
2113 fi
2114else
2115 echo "$ROOT_UID"
2116 echo '#define ROAR_ROOT_UID '"$ROOT_UID" >&3
2117fi
2118
2119$NEED_GNU_SOURCE && echo '#define ROAR_NEED_GNU_SOURCE' >&3
2120
2121cat >&3 << EOF
2122
2123#if defined(ROAR_HAVE_LIBCELT0) && !defined(ROAR_HAVE_LIBCELT)
2124#define ROAR_HAVE_LIBCELT
2125#endif
2126
2127#endif
2128
2129//ll
2130EOF
2131
2132echo >&5
2133echo '//ll' >&5
2134
2135echo >&4
2136echo >&4
2137
2138cd plugins
2139
2140#if $LIBAO
2141#then
2142# echo 'running libao plugin configure...'
2143#  cd ao/
2144# if [ "$AO_INST_DIR" = '' ]
2145# then
2146#  ./configure --force-have-roar --pkg-config "$PKG_CONFIG"                           && \
2147#    echo "subdir_plugins_ao=plugins/ao" >&4
2148# else
2149#  ./configure --force-have-roar --pkg-config "$PKG_CONFIG" --inst-dir "$AO_INST_DIR" && \
2150#    echo "subdir_plugins_ao=plugins/ao" >&4
2151# fi
2152# cd ..
2153#else
2154# echo "running libao plugin configure... disabled by user"
2155#fi
2156
2157if $XMMS
2158then
2159 echo 'running xmms plugin configure...'
2160 cd xmms/
2161  ./configure --force-have-roar --pkg-config "$PKG_CONFIG" --inst-dir "$XMMS_INST_DIR" && \
2162    echo "subdir_plugins_xmms=plugins/xmms" >&4
2163 cd ..
2164else
2165 echo "running xmms plugin configure... disabled by user"
2166fi
2167
2168#if $AUDACIOUS
2169#then
2170# echo 'running Audacious plugin configure...'
2171# cd audacious/
2172#  ./configure --force-have-roar --pkg-config "$PKG_CONFIG" --inst-dir "$AUDACIOUS_INST_DIR" && \
2173#    echo "subdir_plugins_audacious=plugins/audacious" >&4
2174# cd ..
2175#else
2176# echo "running Audacious plugin configure... disabled by user"
2177#fi
2178
2179cd ..
2180
2181rm -f $TF_C $TF_E
2182
2183mv config.h include/roaraudio/
2184echo 'config.h created and moved into include/roaraudio/'
2185
2186if $TARGET_CYGWIN
2187then
2188 rm -f $TF_E.exe
2189 echo 'patching Makefiles for cygwin...'
2190 find . -name Makefile -print0 | xargs -0 sed 's/\.so/.dll'/g -i
2191fi
2192
2193#ll
Note: See TracBrowser for help on using the repository browser.