source: roaraudio/configure @ 5423:ecb64035ba72

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

added support to load plugins from search path

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