source: roaraudio/configure @ 4748:d7be1c18ccb5

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

updated configure script to honor LDFLAGS and added --opti to set optimizer level (Closes: #27)

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