source: roaraudio/configure @ 5408:c6d31c2e4a51

Last change on this file since 5408:c6d31c2e4a51 was 5408:c6d31c2e4a51, checked in by phi, 10 years ago

re-ported to f* s* bla win32 !*!*Dd*S!, I hate this.

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