source: roaraudio/configure @ 5425:2c3f247e8f9a

Last change on this file since 5425:2c3f247e8f9a was 5425:2c3f247e8f9a, checked in by phi, 10 years ago

use SHARED_SUFFIX from configure script, not hardcoded list

  • Property exe set to *
File size: 71.2 KB
Line 
1#!/bin/sh
2
3# check for bash...
4
5if [ "$(echo -n)" = '-n' ]
6then
7 SHELL=$(which bash ksh sh 2> /dev/null | grep ^/ | head -n 1)
8 exec $SHELL $0 "$@"
9fi
10
11PATH="$PATH":/sbin:/usr/sbin:/usr/local/sbin:/usr/pkg/sbin # Ensure superuser paths
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_SHARED_SUFFIX \"$SHARED_SUFFIX\""
1554 echo "#define ROAR_PREFIX_PLUGINS \"$PREFIX_PLUGINS\""
1555 echo
1556 $MINIMAL      && echo '#define ROAR_MINIMAL'
1557 $BETA         && echo '#define ROAR_BETA'
1558 $EXPERIMENTAL && echo '#define ROAR_EXPERIMENTAL'
1559 $ALAW         && echo '#define ROAR_SUPPORT_ALAW'
1560 $ALAW_RW      && echo '#define ROAR_SUPPORT_ALAW_RW'
1561 $MULAW        && echo '#define ROAR_SUPPORT_MULAW'
1562 $MULAW_RW     && echo '#define ROAR_SUPPORT_MULAW_RW'
1563 $PROXY        && echo '#define ROAR_SUPPORT_PROXY'
1564 $PASSWORD_API && echo '#define ROAR_SUPPORT_PASSWORD_API'
1565 $SUPPORT_TRAP && echo '#define ROAR_SUPPORT_TRAP'
1566 $USE_MEMMGR   && echo '#define ROAR_USE_MEMMGR'
1567 $NO_LISTEN    || echo '#define ROAR_SUPPORT_LISTEN'
1568 $META_DATA    && echo '#define ROAR_SUPPORT_META'
1569 echo
1570
1571 $HAVE_MAIN_ARGS && echo '#define ROAR_HAVE_MAIN_ARGS'
1572
1573 echo
1574
1575 for i in $WITHOUT_CF
1576 do
1577  i=$(echo $i | to_upper);
1578  echo '#define ROAR_WITHOUT_CF_'$i
1579 done
1580
1581 for i in $WITHOUT_VIO
1582 do
1583  i=$(echo $i | to_upper);
1584  echo '#define ROAR_WITHOUT_VIO_'$i
1585 done
1586
1587 for i in $WITHOUT_DCOMP
1588 do
1589  i=$(echo $i | to_upper);
1590  echo '#define ROAR_WITHOUT_DCOMP_'$i
1591 done
1592
1593 echo
1594 $TARGET_MICROCONTROLLER && echo '#define ROAR_TARGET_MICROCONTROLLER'
1595 $TARGET_WIN32           && echo '#define ROAR_TARGET_WIN32'
1596 $TARGET_CYGWIN          && echo '#define ROAR_TARGET_CYGWIN'
1597                            echo '#define ROAR_OS_'$(echo $SYSNAME | to_escaped | to_upper)
1598 echo
1599} >&3
1600
1601#                 #define                   name         cmds...
1602test_tool_defmake ROAR_HAVE_BIN_OGG123      ogg123       ogg123
1603test_tool_defmake ROAR_HAVE_BIN_FLAC        flac         flac
1604test_tool_defmake ROAR_HAVE_BIN_TIMIDITY    TiMidity++   timidity
1605test_tool_defmake ROAR_HAVE_BIN_CDPARANOIA  cdparanoia   cdparanoia
1606test_tool_defmake ROAR_HAVE_BIN_WGET        Wget         wget
1607test_tool_defmake ROAR_HAVE_BIN_GNUPLOT     gnuplot      gnuplot
1608test_tool_defmake ROAR_HAVE_BIN_SSH         OpenSSH      ssh
1609test_tool_defmake ROAR_HAVE_BIN_PINENTRY    PIN-Entry    pinentry
1610test_tool_defmake ROAR_HAVE_BIN_SSH_ASKPASS SSH-AskPass  ssh-askpass
1611test_tool_defmake ROAR_HAVE_BIN_GTK_LED_ASKPASS GTK-LED-AskPass gtk-led-askpass
1612test_tool_defmake ROAR_HAVE_BIN_X11_SSH_ASKPASS X11-SSH-AskPass x11-ssh-askpass
1613test_tool_defmake ROAR_HAVE_BIN_GNOME_SSH_ASKPASS GNOME-SSH-AskPass gnome-ssh-askpass
1614test_tool_defmake ROAR_HAVE_BIN_GZIP        Gzip         gzip
1615test_tool_defmake ROAR_HAVE_BIN_BZIP2       bzip2        bzip2
1616test_tool_defmake ROAR_HAVE_BIN_GPG         GnuPG        gpg
1617test_tool_defmake ROAR_HAVE_BIN_CHAT        chat         chat
1618test_tool_defmake ROAR_HAVE_BIN_EJECT       eject        eject
1619
1620echo >&3
1621echo >&5
1622echo >&5
1623echo >&5
1624
1625# Those tests should not be disabled as they do not reduce the lib size just
1626# break --minimal on full systems
1627OLD_MINIMAL=$MINIMAL
1628MINIMAL=false
1629# Test haders:
1630test_lib_defmake ROAR_HAVE_H_STDINT      %            stdint.h      c          -- stdint.h
1631test_lib_defmake ROAR_HAVE_H_STRING      %            string.h      c          -- string.h
1632test_lib_defmake ROAR_HAVE_H_SYS_TYPES   %            sys/types.h   c          -- sys/types.h
1633test_lib_defmake ROAR_HAVE_H_SYS_SOCKET  %            sys/socket.h  c          -- sys/types.h sys/socket.h
1634test_lib_defmake ROAR_HAVE_H_SYS_TIME    %            sys/time.h    c          -- sys/time.h
1635test_lib_defmake ROAR_HAVE_H_SYS_IOCTL   %            sys/ioctl.h   c          -- sys/ioctl.h
1636test_lib_defmake ROAR_HAVE_H_SYS_STAT    %            sys/stat.h    c          -- sys/types.h sys/stat.h
1637test_lib_defmake ROAR_HAVE_H_SYS_REBOOT  %            sys/reboot.h  c          -- sys/reboot.h
1638test_lib_defmake ROAR_HAVE_H_TIME        %            time.h        c          -- time.h
1639test_lib_defmake ROAR_HAVE_H_FCNTL       %            fcntl.h       c          -- fcntl.h
1640test_lib_defmake ROAR_HAVE_H_UNISTD      %            unistd.h      c          -- unistd.h
1641test_lib_defmake ROAR_HAVE_H_DIRENT      %            dirent.h      c          -- dirent.h
1642test_lib_defmake ROAR_HAVE_H_STDLIB      %            stdlib.h      c          -- stdlib.h
1643test_lib_defmake ROAR_HAVE_H_SIGNAL      %            signal.h      c          -- signal.h
1644test_lib_defmake ROAR_HAVE_H_POLL        %            poll.h        c          -- poll.h
1645test_lib_defmake ROAR_HAVE_H_MMSYSTEM    %            mmsystem.h    c          -- windows.h mmsystem.h
1646test_lib_defmake ROAR_HAVE_H_ESD         libroaresd   esd.h         c          -- esd.h
1647test_lib_defmake ROAR_HAVE_H_ARTSC       libroararts  artsc.h       c          -- kde/artsc/artsc.h
1648test_lib_defmake ROAR_HAVE_H_ICONV       %            iconv.h       c          -- iconv.h
1649test_lib_defmake ROAR_HAVE_H_NETINET_IN  %            'netinet/in.h' c         -- 'netinet/in.h'
1650test_lib_defmake ROAR_HAVE_H_LINUX_REBOOT %            linux/reboot.h c        -- linux/reboot.h
1651test_lib_defmake ROAR_HAVE_H_WINDOWS     %            windows.h     c          -- windows.h
1652test_lib_defmake ROAR_HAVE_H_WINSOCK     %            winsock.h     c          -- winsock.h
1653test_lib_defmake ROAR_HAVE_H_WINSOCK2    %            winsock2.h    c          -- winsock2.h
1654MINIMAL=$OLD_MINIMAL
1655
1656#                #define                 subdir       name           -lxxx      -- header
1657test_lib_defmake ROAR_HAVE_LIBM          %            'MathLibrary'  m          -- math.h
1658rt=''
1659libname_rt=false
1660if test_lib 'realtime Library' rt -- sys/mman.h mqueue.h semaphore.h
1661then
1662 {
1663  echo '#define ROAR_HAVE_LIBRT'
1664  echo '#define ROAR_NEED_LIBRT'
1665  libname_rt=true
1666  rt=rt
1667 } >&3
1668fi
1669
1670echo >&3
1671
1672#                #define                 subdir       name          -lxxx      -- header
1673test_lib_defmake ROAR_HAVE_ESD           %            EsounD        esd        -- esd.h
1674test_lib_defmake ROAR_HAVE_LIBAO         %            libao         ao         -- ao/ao.h ao/plugin.h
1675test_lib_defmake ROAR_HAVE_LIBRAUM       %            RAUM          raum       -- raum.h
1676test_lib_defmake ROAR_HAVE_LIBOGG        %            libogg        ogg        -- ogg/ogg.h
1677test_lib_defmake ROAR_HAVE_LIBVORBIS     %            libvorbis     vorbis     -- vorbis/codec.h
1678test_lib_defmake ROAR_HAVE_LIBVORBISFILE %            libvorbisfile vorbisfile -- vorbis/vorbisfile.h
1679test_lib_defmake ROAR_HAVE_LIBVORBISENC  %            libvorbisenc  vorbisenc  -- vorbis/vorbisenc.h
1680test_lib_defmake ROAR_HAVE_LIBSPEEX      %            libspeex      speex      -- speex/speex.h speex/speex_stereo.h
1681test_lib_defmake ROAR_HAVE_LIBSPEEXDSP   %            libspeexdsp   speexdsp   -- speex/speex.h speex/speex_echo.h
1682test_lib_defmake ROAR_HAVE_LIBCELT       %            libcelt       celt       -- celt/celt.h celt/celt_header.h
1683test_lib_defmake ROAR_HAVE_LIBCELT0      %            libcelt0      celt0      -- celt/celt.h celt/celt_header.h
1684test_lib_defmake ROAR_HAVE_LIBOGGZ       %            liboggz       oggz       -- oggz/oggz.h
1685test_lib_defmake ROAR_HAVE_LIBSNDFILE    %            libsndfile    sndfile    -- sndfile.h
1686test_lib_defmake ROAR_HAVE_LIBFISHSOUND  roarfish     libfishsound  fishsound  -- fishsound/fishsound.h
1687test_lib_defmake ROAR_HAVE_LIBFLAC       %            libFLAC       FLAC       -- FLAC/all.h
1688test_lib_defmake ROAR_HAVE_LIBSAMPLERATE %            libsamplerate samplerate -- samplerate.h
1689test_lib_defmake ROAR_HAVE_LIBSHOUT      %            libshout      shout      -- shout/shout.h
1690test_lib_defmake ROAR_HAVE_LIBPULSE      libroarpulse libpulse      pulse      -- pulse/pulseaudio.h pulse/simple.h
1691test_lib_defmake ROAR_HAVE_LIBPULSESIMPLE %           libpulse-simple pulse-simple -- pulse/simple.h
1692test_lib_defmake ROAR_HAVE_LIBY2         libroaryiff  libyiff       Y2         -- Y2/Y.h Y2/Ylib.h
1693test_lib_defmake ROAR_HAVE_LIBARTSC      %            libartsc      artsc      -- kde/artsc/artsc.h
1694test_lib_defmake ROAR_HAVE_LIBOSSAUDIO   %            libossaudio   ossaudio   -- sys/ioctl.h
1695test_lib_defmake ROAR_HAVE_LIBSNDIO      %            libsndio      sndio      -- sndio.h
1696test_lib_defmake ROAR_HAVE_LIBRSOUND     libroarrsound librsound    rsound     -- rsound.h
1697test_lib_defmake ROAR_HAVE_LIBPORTAUDIO  %            PortAudio     portaudio  -- portaudio.h
1698test_lib_defmake ROAR_HAVE_LIBPABLIO     %            PABLIO        pablio     -- pablio/pablio.h
1699test_lib_defmake ROAR_HAVE_LIBSSL        %            OpenSSL       ssl        -- openssl/bio.h openssl/evp.h
1700test_lib_defmake ROAR_HAVE_LIBSLP        %            OpenSLP       slp        -- slp.h
1701test_lib_defmake ROAR_HAVE_LIBUUID       %            libuuid       uuid       -- uuid/uuid.h
1702test_lib_defmake ROAR_HAVE_LIBDNET       %            libdnet       dnet       -- sys/socket.h netdnet/dn.h netdnet/dnetdb.h
1703test_lib_defmake ROAR_HAVE_LIBPTHREAD    %            libpthread    pthread    -- pthread.h
1704OLD_MINIMAL=$MINIMAL
1705MINIMAL=false
1706test_lib_defmake ROAR_HAVE_BSDSOCKETS    %            BSDSockets    c          -- sys/types.h sys/socket.h
1707test_lib_defmake ROAR_HAVE_UNIX          %            UNIX          c          -- sys/types.h sys/socket.h sys/un.h
1708test_lib_defmake ROAR_HAVE_IPV4          %            IPv4          c          -- sys/types.h sys/socket.h 'netinet/in.h' winsock2.h
1709MINIMAL=$OLD_MINIMAL
1710test_lib_defmake ROAR_HAVE_IPX           %            IPX           c          -- netipx/ipx.h
1711test_lib_defmake ROAR_HAVE_OSS           %            OSS           c          -- sys/ioctl.h sys/soundcard.h
1712test_lib_defmake ROAR_HAVE_OSS_BSD       %            BSDOSS        c          -- sys/ioctl.h soundcard.h
1713test_lib_defmake ROAR_HAVE_LIBWINMM      %            WinMM         winmm      -- windows.h mmsystem.h
1714test_lib_defmake ROAR_HAVE_LIBASOUND     %            ALSA          asound     -- alsa/asoundlib.h alsa/pcm_external.h alsa/control_external.h
1715test_lib_defmake ROAR_HAVE_LIBDL         %            DynLinkerLib  dl         -- dlfcn.h
1716test_lib_defmake ROAR_HAVE_LIBZ          %            zlib          z          -- zlib.h
1717test_lib_defmake ROAR_HAVE_LIBSENDFILE   %            sendfile      sendfile   -- sys/sendfile.h
1718test_lib_defmake ROAR_HAVE_LIBSOCKET     %            libsocket     socket     -- sys/socket.h
1719test_lib_defmake ROAR_HAVE_LIBWSOCK32    %            WinSockP0     wsock32    -- winsock2.h
1720test_lib_defmake ROAR_HAVE_LIBWS2_32     %            WinSockP1     ws2_32     -- winsock2.h
1721test_lib_defmake ROAR_HAVE_LIBX11        %            X11           X11        -- X11/Xlib.h X11/Xatom.h
1722test_lib_defmake ROAR_HAVE_GTK_P_2_0     %            GTK+2.0       gtk+-2.0/t -- gtk/gtk.h gdk/gdkkeysyms.h
1723test_lib_defmake ROAR_HAVE_LIBGCRYPT     %            libgcrypt     gcrypt     -- gcrypt.h
1724test_lib_defmake ROAR_HAVE_LIBJACK       %            libjack       jack/t     -- jack/jack.h
1725test_lib_defmake ROAR_HAVE_LIBDBUS       %            libdbus       dbus-1/t   -- dbus-1.0/dbus/dbus.h
1726
1727echo >&3
1728
1729test_version ROAR_HAVE_CELT_VERSION      libcelt       celt
1730test_version ROAR_HAVE_SPEEX_VERSION     libspeex      speex
1731test_version ROAR_HAVE_PULSE_VERSION     libpulse      libpulse
1732test_version ROAR_HAVE_GTK_P_2_0_VERSION GTK+2.0       gtk+-2.0
1733test_version ROAR_HAVE_FLAC_VERSION      libflac       flac
1734test_version ROAR_HAVE_PA19_VERSION      portaudio-19  portaudio-2.0
1735
1736echo >&3
1737
1738# Those tests should not be disabled as they do not reduce the lib size just
1739# break --minimal on full systems
1740
1741OLD_MINIMAL=$MINIMAL
1742MINIMAL=false
1743# Test types:
1744#         DEF                            type/name    init value               -- headers
1745test_type ROAR_HAVE_T_ID_T               id_t
1746test_type ROAR_HAVE_T_PID_T              pid_t
1747test_type ROAR_HAVE_T_UID_T              uid_t
1748test_type ROAR_HAVE_T_GID_T              gid_t
1749test_type ROAR_HAVE_T_SOCKLEN_T          socklen_t    0                        -- sys/socket.h
1750test_type ROAR_HAVE_T_MODE_T             mode_t
1751test_type ROAR_HAVE_T_OFF_T              off_t
1752test_type ROAR_HAVE_T_SSIZE_T            ssize_t
1753test_type ROAR_HAVE_T_TIME_T             time_t
1754test_type ROAR_HAVE_T_SA_FAMILY_T        sa_family_t  0                        -- sys/socket.h
1755MINIMAL=$OLD_MINIMAL
1756
1757echo >&3
1758
1759# add a better test here
1760#test_lib 'linux sendfile()'       -- sys/sendfile.h && echo '#define ROAR_HAVE_LINUX_SENDFILE' >&3
1761
1762
1763echo -n 'checking for IPv6... '
1764
1765if $MINIMAL
1766then
1767 echo "disabled by user (minimalstic build)"
1768else
1769 echo '#include <sys/socket.h>'  > $TF_C
1770 echo '#include <netinet/in.h>' >> $TF_C
1771 echo 'int main (void) { struct sockaddr_in6 in6; return 0; }' >> $TF_C
1772
1773 if $CCTF 2> /dev/null;
1774 then
1775  echo '#define ROAR_HAVE_IPV6' >&3
1776  echo yes
1777 else
1778  echo no
1779 fi
1780fi
1781
1782
1783echo -n 'checking for _exit()... '
1784
1785echo '#include <unistd.h>'    > $TF_C
1786echo 'int main (void) { _exit(0); return 0; }' >> $TF_C
1787
1788if $CCTF 2> /dev/null;
1789then
1790 echo '#define ROAR_HAVE_U_EXIT' >&3
1791 echo '#define ROAR_U_EXIT _exit' >&3
1792 echo yes
1793else
1794 echo '#define ROAR_U_EXIT exit' >&3
1795 echo no
1796fi
1797
1798#                 def                 name      call                         -- header
1799test_func_defmake ROAR_HAVE_MALLOC    malloc    'malloc(0)'                  -- stdlib.h
1800test_func_defmake ROAR_HAVE_CALLOC    calloc    'calloc(0, 0)'               -- stdlib.h
1801test_func_defmake ROAR_HAVE_REALLOC   realloc   'realloc((void*)0, 0)'       -- stdlib.h
1802test_func_defmake ROAR_HAVE_FREE      free      'free((void*)0)'             -- stdlib.h
1803test_func_defmake ROAR_HAVE_STRDUP    strdup    'strdup((void*)0)'           -- string.h
1804test_func_defmake ROAR_HAVE_STRNDUP   strndup   'strndup((void*)0)'          -- string.h
1805test_func_defmake ROAR_HAVE_STRLEN    strlen    'strlen((void*)0)'           -- string.h
1806test_func_defmake ROAR_HAVE_STRNLEN   strnlen   'strnlen((void*)0)'          -- string.h
1807test_func_defmake ROAR_HAVE_SETENV    setenv    'setenv("", "", 0)'          -- stdlib.h
1808test_func_defmake ROAR_HAVE_PUTENV    putenv    'putenv("")'                 -- stdlib.h
1809test_func_defmake ROAR_HAVE_STRTOK_R  strtok_r  'strtok_r("","",(char**)0)'  -- string.h
1810test_func_defmake ROAR_HAVE_STRLCPY   strlcpy   'strlcpy((char*)0, "", 0)'   -- string.h
1811test_func_defmake ROAR_HAVE_STRLCAT   strlcat   'strlcat((char*)0, "", 0)'   -- string.h
1812test_func_defmake ROAR_HAVE_QSORT     qsort     'qsort((void*)0, 0, 0, (int(*)(const void *, const void *))0)' -- stdlib.h
1813test_func_defmake ROAR_HAVE_NICE      nice      'nice(0)'                    -- unistd.h
1814test_func_defmake ROAR_HAVE_GETHOSTID gethostid 'gethostid()'                -- unistd.h
1815test_func_defmake ROAR_HAVE_GETGID    getgid    'getgid()'                   -- sys/types.h unistd.h
1816test_func_defmake ROAR_HAVE_GETUID    getuid    'getuid()'                   -- sys/types.h unistd.h
1817test_func_defmake ROAR_HAVE_SETGID    setgid    'setgid(0)'                  -- sys/types.h unistd.h
1818test_func_defmake ROAR_HAVE_SETUID    setuid    'setuid(0)'                  -- sys/types.h unistd.h
1819test_func_defmake ROAR_HAVE_SETSID    setsid    'setsid()'                   -- sys/types.h unistd.h
1820test_func_defmake ROAR_HAVE_GETPWNAM  getpwnam  'getpwnam("")'               -- sys/types.h pwd.h
1821test_func_defmake ROAR_HAVE_GETGRNAM  getgrnam  'getgrnam("")'               -- sys/types.h grp.h
1822test_func_defmake ROAR_HAVE_GETTIMEOFDAY gettimeofday 'struct timeval tv; gettimeofday(&tv, NULL)' -- sys/time.h time.h
1823test_func_defmake ROAR_HAVE_USLEEP    usleep    'usleep(0)'                  -- sys/types.h unistd.h
1824test_func_defmake ROAR_HAVE_SLEEP     sleep     'sleep(0)'                   -- unistd.h
1825test_func_defmake ROAR_HAVE_NANOSLEEP nanosleep 'nanosleep((void*)0, (void*)0)' -- time.h
1826test_func_defmake ROAR_HAVE_ALARM     alarm     'alarm(0)'                   -- sys/types.h unistd.h
1827test_func_defmake ROAR_HAVE_TIME      time      'time((void*)0)'             -- time.h
1828test_func_defmake ROAR_HAVE_CTIME     ctime     'ctime((void*)0)'            -- time.h
1829test_func_defmake ROAR_HAVE_CTIME_R   ctime_r   'ctime_r((void*)0,(char*)0)' -- time.h
1830test_func_defmake ROAR_HAVE_KILL      kill      'kill(0,0)'                  -- sys/types.h signal.h
1831test_func_defmake ROAR_HAVE_UNAME     uname     'uname((void*)0)'            -- sys/utsname.h
1832test_func_defmake ROAR_HAVE_GETHOSTNAME gethostname 'gethostname((void*)0, 0)' -- unistd.h
1833test_func_defmake ROAR_HAVE_SYSLOG    syslog    'syslog(0, "")'              -- syslog.h
1834test_func_defmake ROAR_HAVE_OPENLOG   openlog   'openlog("", 0, 0)'          -- syslog.h
1835test_func_defmake ROAR_HAVE_CLOSELOG  closelog  'closelog()'                 -- syslog.h
1836test_func_defmake ROAR_HAVE_FOPEN     fopen     'fopen("","")'               -- stdio.h
1837test_func_defmake ROAR_HAVE_FDOPEN    fdopen    'fdopen(0,"")'               -- stdio.h
1838test_func_defmake ROAR_HAVE_FREOPEN   freopen   'freopen("","",(void*)0)'    -- stdio.h
1839test_func_defmake ROAR_HAVE_FCLOSE    fclose    'fclose(0)'                  -- stdio.h
1840test_func_defmake ROAR_HAVE_FILENO    fileno    'fileno(0)'                  -- stdio.h
1841test_func_defmake ROAR_HAVE_FTELL     ftell     'ftell(0)'                   -- stdio.h
1842test_func_defmake ROAR_HAVE_FSEEK     fseek     'fseek(0, 0, 0)'             -- stdio.h
1843test_func_defmake ROAR_HAVE_POPEN     popen     'popen("", "")'              -- stdio.h
1844test_func_defmake ROAR_HAVE_PCLOSE    pclose    'pclose(0)'                  -- stdio.h
1845test_func_defmake ROAR_HAVE_STAT      stat      'stat((char*)0, (void*)0)'   -- sys/types.h sys/stat.h unistd.h
1846test_func_defmake ROAR_HAVE_SYSTEM    system    'system("")'                 -- stdlib.h
1847test_func_defmake ROAR_HAVE_GETSOCKNAME getsockname 'getsockname(0, 0, 0)'   $lib_wsock32 -- sys/socket.h winsock.h
1848test_func_defmake ROAR_HAVE_GETPEERNAME getpeername 'getpeername(0, 0, 0)'   $lib_wsock32 -- sys/socket.h winsock.h
1849test_func_defmake ROAR_HAVE_GETSOCKOPT getsockopt 'getsockopt(0, 0, 0, (void*)0, (void*)0)' -- sys/types.h sys/socket.h
1850test_func_defmake ROAR_HAVE_SETSOCKOPT setsockopt 'setsockopt(0, 0, 0, (void*)0, (void*)0)' -- sys/types.h sys/socket.h
1851test_func_defmake ROAR_HAVE_GETADDRINFO getaddrinfo 'getaddrinfo((void*)0, (void*)0, (void*)0, (void**)0)' -- sys/types.h sys/socket.h netdb.h
1852test_func_defmake ROAR_HAVE_RAND      rand      'rand()'                     -- stdlib.h
1853test_func_defmake ROAR_HAVE_RAND_R    rand_r    'rand_r((unsigned int*)0)'   -- stdlib.h
1854test_func_defmake ROAR_HAVE_SRAND     srand     'srand((unsigned int)0)'     -- stdlib.h
1855test_func_defmake ROAR_HAVE_FCNTL     fcntl     'fcntl(0, 0)'                -- unistd.h fcntl.h
1856test_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
1857test_func_defmake ROAR_HAVE_LINUX_SENDFILE sendfile 'sendfile(-1, -1, (void*)0, 0)' -- sys/sendfile.h
1858test_func_defmake ROAR_HAVE_GETVERSIONEX     GetVersionEx     'OSVERSIONINFO osinfo; osinfo.dwOSVersionInfoSize = sizeof(osinfo);GetVersionEx(&osinfo);'                -- windows.h
1859
1860test_func_defmake ROAR_HAVE_AO_APPEND_GLOBAL_OPTION ao_append_global_option 'ao_append_global_option("","")' ao -- ao/ao.h
1861
1862test_func_defmake ROAR_HAVE_DLADDR    dladdr    'dladdr((void*)0, (Dl_info*)0)' dl -- dlfcn.h
1863echo "STATE: funcname_dladdr=$funcname_dladdr" >&5
1864
1865if [ "$funcname_dladdr" = 'false' ]
1866then
1867 infotext='retested with _GNU_SOURCE'
1868 _old="$NEED_GNU_SOURCE"
1869 NEED_GNU_SOURCE=true
1870 test_func_defmake ROAR_HAVE_DLADDR    dladdr    'dladdr((void*)0, (Dl_info*)0)' dl -- dlfcn.h
1871 [ "$funcname_dladdr" = 'false' ] && NEED_GNU_SOURCE="$_old"
1872 infotext=''
1873fi
1874
1875test_func_defmake ROAR_HAVE_CLOCK_GETRES  clock_getres  'struct timespec ts; clock_getres((clockid_t)0, &ts)'  -- time.h
1876test_func_defmake ROAR_HAVE_CLOCK_GETTIME clock_gettime 'struct timespec ts; clock_gettime((clockid_t)0, &ts)' -- time.h
1877test_func_defmake ROAR_HAVE_CLOCK_SETTIME clock_settime 'struct timespec ts; clock_settime((clockid_t)0, &ts)' -- time.h
1878
1879echo "STATE: funcname_clock_getres=$funcname_clock_getres" >&5
1880echo "STATE: libname_rt=$libname_rt" >&5
1881
1882if [ "$funcname_clock_getres" = 'false' ]
1883then
1884 if $libname_rt
1885 then
1886  infotext='retested using realtime library'
1887  test_func_defmake ROAR_HAVERT_CLOCK_GETRES  clock_getres  'struct timespec ts; clock_getres((clockid_t)0, &ts)'  $rt -- time.h
1888  test_func_defmake ROAR_HAVERT_CLOCK_GETTIME clock_gettime 'struct timespec ts; clock_gettime((clockid_t)0, &ts)' $rt -- time.h
1889  test_func_defmake ROAR_HAVERT_CLOCK_SETTIME clock_settime 'struct timespec ts; clock_settime((clockid_t)0, &ts)' $rt -- time.h
1890  infotext=''
1891  if $funcname_clock_getres
1892  then
1893   echo "clock_rt=-l$rt" >&4
1894  fi
1895 fi
1896fi
1897
1898test_const_defmake ROAR_HAVE_CONST_CLOCK_REALTIME CLOCK_REALTIME clockid_t CLOCK_REALTIME -- time.h
1899test_const_defmake ROAR_HAVE_CONST_CLOCK_MONOTONIC CLOCK_MONOTONIC clockid_t CLOCK_MONOTONIC -- time.h
1900test_const_defmake ROAR_HAVE_CONST_CLOCK_PROCESS_CPUTIME_ID CLOCK_PROCESS_CPUTIME_ID clockid_t CLOCK_PROCESS_CPUTIME_ID -- time.h
1901test_const_defmake ROAR_HAVE_CONST_CLOCK_THREAD_CPUTIME_ID CLOCK_THREAD_CPUTIME_ID clockid_t CLOCK_THREAD_CPUTIME_ID -- time.h
1902test_const_defmake ROAR_HAVE_CONST_M_PI_2 M_PI_2 double M_PI_2 -- math.h
1903
1904
1905test_var_defmake   ROAR_HAVE_VAR_H_ERRNO h_errno int h_errno -- netdb.h
1906
1907echo -n 'checking for basic IO calls... '
1908
1909cat <<EOF > $TF_C
1910#include <sys/types.h>
1911#include <sys/stat.h>
1912#include <fcntl.h>
1913#include <string.h>
1914#include <unistd.h>
1915
1916int main(void) {
1917 open(NULL, 0, 0);
1918 close(0);
1919 read(0, NULL, 0);
1920 write(0, NULL, 0);
1921 lseek(0, 0, 0);
1922 return 0;
1923}
1924EOF
1925
1926if $CCTF 2> /dev/null;
1927then
1928 echo '#define ROAR_HAVE_IO_POSIX' >&3
1929 echo posix
1930else
1931 echo none
1932fi
1933
1934echo -n 'checking for basic FS calls... '
1935
1936cat <<EOF > $TF_C
1937#include <string.h>
1938#include <unistd.h>
1939
1940int main(void) {
1941 chdir(NULL);
1942 unlink(NULL);
1943 return 0;
1944}
1945EOF
1946
1947if $CCTF 2> /dev/null;
1948then
1949 echo '#define ROAR_HAVE_FS_POSIX' >&3
1950 echo posix
1951else
1952 echo none
1953fi
1954
1955
1956test_func_defmake ROAR_HAVE_CHROOT     chroot     'chroot((void*)0)'           -- unistd.h
1957test_func_defmake ROAR_HAVE_MLOCK      mlock      'mlock((void*)0, 0)'         -- sys/mman.h
1958test_func_defmake ROAR_HAVE_MUNLOCK    munlock    'munlock((void*)0, 0)'       -- sys/mman.h
1959test_func_defmake ROAR_HAVE_MLOCKALL   mlockall   'mlockall(MCL_CURRENT|MCL_FUTURE)' -- sys/mman.h
1960test_func_defmake ROAR_HAVE_MUNLOCKALL munlockall 'munlockall()'               -- sys/mman.h
1961test_func_defmake ROAR_HAVE_MMAP       mmap       'mmap((void*)0,0,0,0,0,0)'   -- sys/mman.h
1962
1963echo -n 'checking for fsync()... '
1964
1965echo '#include <unistd.h>' > $TF_C
1966echo 'int main (void) { fsync(0); return 0; }' >> $TF_C
1967
1968if $CCTF 2> /dev/null;
1969then
1970 echo '#define ROAR_HAVE_FSYNC' >&3
1971 FSYNC=true
1972 echo yes
1973else
1974 FSYNC=false
1975 echo no
1976fi
1977
1978echo -n 'checking for fdatasync()... '
1979
1980echo '#include <unistd.h>' > $TF_C
1981echo 'int main (void) { fdatasync(0); return 0; }' >> $TF_C
1982
1983if $CCTF 2> /dev/null;
1984then
1985 echo '#define ROAR_HAVE_FDATASYNC' >&3
1986 echo '#define ROAR_FDATASYNC fdatasync' >&3
1987 echo yes
1988else
1989 $FSYNC && echo '#define ROAR_FDATASYNC fsync' >&3
1990 echo no
1991fi
1992
1993
1994#test_func_defmake ROAR_HAVE_STRCASESTR strcasestr 'strcasestr("", "")'       -- string.h
1995echo -n 'checking for strcasestr()... '
1996
1997echo '#define _GNU_SOURCE' > $TF_C
1998echo '#include <string.h>' >> $TF_C
1999echo 'int main (void) { strcasestr("", ""); return 0; }' >> $TF_C
2000
2001if $CCTF 2> /dev/null;
2002then
2003 echo '#define ROAR_HAVE_STRCASESTR' >&3
2004 NEED_GNU_SOURCE=true
2005 echo yes
2006else
2007 echo no
2008fi
2009
2010echo -n 'checking for fopencookie()... '
2011
2012echo '#define _GNU_SOURCE' > $TF_C
2013echo '#include <stdio.h>' >> $TF_C
2014echo 'int main (void) { cookie_io_functions_t f; fopencookie(NULL, "", f); return 0; }' >> $TF_C
2015
2016if $CCTF 2> /dev/null;
2017then
2018 echo '#define ROAR_HAVE_FOPENCOOKIE' >&3
2019 NEED_GNU_SOURCE=true
2020 echo yes
2021else
2022 echo no
2023fi
2024
2025echo -n 'checking for funopen()... '
2026
2027echo '#define __BSD_VISIBLE 1'  > $TF_C
2028echo '#include <stdio.h>'      >> $TF_C
2029echo 'int main (void) { funopen(NULL, NULL, NULL, NULL, NULL); return 0; }' >> $TF_C
2030
2031if $CCTF 2> /dev/null;
2032then
2033 echo '#define ROAR_HAVE_FUNOPEN' >&3
2034 echo '#define ROAR_NEED_BSD_VISIBLE' >&3
2035 echo yes
2036else
2037 echo no
2038fi
2039
2040test_func_defmake ROAR_HAVE_PIPE      pipe      'pipe(NULL)'                 -- unistd.h
2041test_func_defmake ROAR_HAVE_FORK      fork      'fork()'                     -- unistd.h
2042test_func_defmake ROAR_HAVE_WAIT      wait      'wait(NULL)'                 -- string.h sys/wait.h
2043test_func_defmake ROAR_HAVE_SINF      sinf      'sinf(0.)'                 m -- math.h
2044
2045echo -n 'checking for square root func... '
2046
2047if $TARGET_CYGWIN
2048then
2049 echo 'sqrt() (cygwin)'
2050elif [ "$SYSNAME" = 'FreeBSD' ]
2051then
2052 echo 'sqrt() (FreeBSD, fix your gcc)'
2053elif [ "$SYSNAME" = 'Linux' ]
2054then
2055 echo '#include <math.h>' > $TF_C
2056 echo 'int main (void) { sqrtl(0); return 0; }' >> $TF_C
2057
2058 if $CCTF -lm 2> /dev/null;
2059 then
2060  echo '#define ROAR_HAVE_SQRTL' >&3
2061  echo 'sqrtl()'
2062 else
2063  echo 'sqrt()'
2064 fi
2065else
2066 echo 'sqrt()'
2067fi
2068
2069echo -n 'checking for inline funcs... '
2070
2071echo 'inline int test (void) { return 0; }' > $TF_C
2072echo 'int main (void) { return test(); }'  >> $TF_C
2073
2074if $CCTF 2> /dev/null;
2075then
2076 echo '#define ROAR_HAVE_INLINE' >&3
2077 echo yes
2078else
2079 echo no
2080fi
2081
2082
2083echo -n 'checking for -pthread... '
2084
2085echo '#include <pthread.h>'                            > $TF_C
2086echo 'int main (void) { pthread_self(); return 0; }'  >> $TF_C
2087
2088if $CCTF -pthread 2> /dev/null;
2089then
2090 echo '#define ROAR_HAVE_CC_PTHREAD_OPTION' >&3
2091 echo 'opt_pthread=-pthread' >&4
2092 echo 'pthread=$(opt_pthread)' >&4
2093 echo yes
2094else
2095 echo 'opt_pthread=' >&4
2096 echo 'pthread=$(lib_pthread)' >&4
2097 echo no
2098fi
2099
2100
2101echo -n 'checking for broken peercred... '
2102echo '#include <sys/types.h>'      >  $TF_C
2103echo '#include <sys/socket.h>'     >> $TF_C
2104echo '#include <sys/un.h>'         >> $TF_C
2105echo 'int main (void) { struct ucred cred; return 0; }'  >> $TF_C
2106
2107if $CCTF 2> /dev/null;
2108then
2109 echo working
2110else
2111 if $CCTF -D_GNU_SOURCE 2> /dev/null;
2112 then
2113  NEED_GNU_SOURCE=true
2114  echo need to set _GNU_SOURCE
2115 else
2116  echo '#define ROAR_BROKEN_PEERCRED' >&3
2117  echo broken
2118 fi
2119fi
2120
2121
2122test_func_defmake ROAR_HAVE_GETPEEREID getpeereid 'getpeereid(0, NULL, NULL)' -- sys/types.h sys/socket.h
2123
2124echo -n 'checking for select()... '
2125cat <<EOF > $TF_C
2126#ifndef WITHOUT_SYS_SELECT_H
2127#include <sys/select.h>
2128#endif
2129#ifdef WITH_WINSOCK_H
2130#include <winsock.h>
2131#endif
2132#include <sys/time.h>
2133#include <sys/types.h>
2134#include <unistd.h>
2135
2136int main (void) {
2137 fd_set rfds;
2138 struct timeval tv;
2139
2140 FD_ZERO(&rfds);
2141 FD_SET(0, &rfds);
2142
2143 tv.tv_sec  = 0;
2144 tv.tv_usec = 0;
2145
2146 select(1, &rfds, NULL, NULL, &tv);
2147
2148 return 0;
2149}
2150EOF
2151
2152if $CCTF 2> /dev/null;
2153then
2154 echo '#define ROAR_HAVE_SELECT' >&3
2155 echo '#define ROAR_HAVE_H_SYS_SELECT' >&3
2156 echo yes, POSIX.1-2001
2157elif $CCTF -DWITHOUT_SYS_SELECT_H 2> /dev/null;
2158then
2159 echo '#define ROAR_HAVE_SELECT' >&3
2160 echo yes, old style
2161elif $CCTF -DWITHOUT_SYS_SELECT_H -DWITH_WINSOCK_H $lib_wsock32 >&5 2>&5;
2162then
2163 echo '#define ROAR_HAVE_SELECT' >&3
2164 echo yes, WinSock
2165else
2166 echo no
2167fi
2168
2169echo -n 'checking for shutdown()... '
2170cat <<EOF > $TF_C
2171#include <sys/types.h>
2172#ifndef WITHOUT_SYS_SOCKET_H
2173#include <sys/socket.h>
2174#endif
2175#ifdef WITH_WINSOCK_H
2176#include <winsock.h>
2177#endif
2178
2179int main (void) { shutdown(0, 0); return 0; }
2180EOF
2181
2182if [ "$SYSNAME" = 'SunOS' ]
2183then
2184 _l='-lsocket'
2185else
2186 _l=''
2187fi
2188
2189if $CCTF $_l 2> /dev/null;
2190then
2191 echo '#define ROAR_HAVE_SHUTDOWN'     >&3
2192 echo '#define ROAR_SHUTDOWN shutdown' >&3
2193 echo yes
2194elif $CCTF -DWITHOUT_SYS_SOCKET_H -DWITH_WINSOCK_H $lib_wsock32 2> /dev/null;
2195then
2196 echo '#define ROAR_HAVE_SHUTDOWN'     >&3
2197 echo '#define ROAR_SHUTDOWN shutdown' >&3
2198 echo yes, WinSock
2199else
2200 echo '#define ROAR_SHUTDOWN(x,y) (-1)' >&3
2201 echo no
2202fi
2203
2204echo -n 'checking for accept()... '
2205cat <<EOF > $TF_C
2206#include <sys/types.h>
2207#ifndef WITHOUT_SYS_SOCKET_H
2208#include <sys/socket.h>
2209#endif
2210#ifdef WITH_WINSOCK_H
2211#include <winsock.h>
2212#endif
2213
2214int main (void) { accept(0, 0, 0); return 0; }
2215EOF
2216
2217if [ "$SYSNAME" = 'SunOS' ]
2218then
2219 _l='-lsocket'
2220else
2221 _l=''
2222fi
2223
2224if $CCTF $_l 2> /dev/null;
2225then
2226 echo '#define ROAR_HAVE_ACCEPT'     >&3
2227 echo '#define ROAR_ACCEPT accept'   >&3
2228 echo yes
2229elif $CCTF -DWITHOUT_SYS_SOCKET_H -DWITH_WINSOCK_H $lib_wsock32 2> /dev/null;
2230then
2231 echo '#define ROAR_HAVE_ACCEPT'     >&3
2232 echo '#define ROAR_ACCEPT accept'   >&3
2233 echo yes, WinSock
2234else
2235 echo '#define ROAR_ACCEPT(x,y,z) (-1)' >&3
2236 echo no
2237fi
2238
2239test_func_defmake ROAR_HAVE_GETOBJECTBYNAME getobjectbyname 'getobjectbyname(NULL)' dnet -- stdlib.h netdnet/dn.h netdnet/dnetdb.h
2240test_func_defmake ROAR_HAVE_GETSERVBYNAME   getservbyname   'getservbyname((void*)0, (void*)0)' -- netdb.h
2241
2242
2243# --- PulseAudio tests ---
2244test_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
2245
2246test_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; }'
2247
2248test_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; }'
2249
2250test_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; }'
2251
2252test_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; }'
2253# --- End of PulseAudio tests ---
2254
2255
2256echo -n 'checking for struct rsound'\''s sample size member... '
2257
2258cat > $TF_C << EOF
2259#define RSD_EXPOSE_STRUCT
2260#include <rsound.h>
2261
2262int main (void) {
2263 rsound_t var;
2264
2265 var.samplesize = 0;
2266
2267 return 0;
2268}
2269EOF
2270if $CCTF 2> /dev/null;
2271then
2272 echo '#define ROAR_HAVE_RSOUND_SAMPLESIZE'     >&3
2273 echo '#define ROAR_HAVE_RSOUND_SAMPLESIZE_MEMBER samplesize'   >&3
2274 echo samplesize
2275else
2276 echo '#define ROAR_HAVE_RSOUND_SAMPLESIZE_MEMBER framesize'   >&3
2277 echo framesize
2278fi
2279
2280echo -n 'checking for safe 32 bit integer overflow... '
2281
2282cat > $TF_C << EOF
2283#include <stdio.h>
2284#include <stdint.h>
2285#define TYPE uint32_t
2286#define MAX  ((TYPE)4294967295U)
2287
2288int main (void) {
2289 TYPE a = MAX;
2290
2291 a += 2;
2292
2293 if ( a == 1 ) {
2294  printf("#define ROAR_HAVE_SAFE_OVERFLOW\n");
2295  return 0;
2296 }
2297
2298 return 1;
2299}
2300EOF
2301
2302if $CCTF 2> /dev/null;
2303then
2304 $EXEC_HELPER $TF_E >&3 2> /dev/null
2305 if [ "$?" = '0' ]
2306 then
2307  echo yes
2308 else
2309  echo no
2310 fi
2311else
2312 echo 'no (can not compile!, no stdint.h?)'
2313fi
2314
2315echo -n 'checking for __LP64__... '
2316if $TARGET_WIN32
2317then
2318 echo 'no need to set (win32 build)'
2319else
2320cat > $TF_C << EOF
2321#include <stdio.h>
2322
2323int main (void) {
2324#ifdef __LP64__
2325 fprintf(stderr, "set by compiler\n");
2326#else
2327 if ( sizeof(int) == sizeof(void*) ) {
2328  fprintf(stderr, "no need to set\n");
2329 } else {
2330  fprintf(stderr, "need to set\n");
2331  printf("\n#ifndef __LP64__\n#define __LP64__\n#endif\n\n");
2332 }
2333#endif
2334 return 0;
2335}
2336EOF
2337 if $CCTF 2> /dev/null;
2338 then
2339  $EXEC_HELPER $TF_E >&3
2340 else
2341  echo 'error, can not compile'
2342  exit 1
2343 fi
2344fi
2345
2346echo -n 'checking for 64 bit types... '
2347if $TARGET_WIN32
2348then
2349 echo 'int64_t, uint64_t (win32 build)'
2350 echo '#define ROAR_NATIVE_INT64  int64_t'  >&3
2351 echo '#define ROAR_NATIVE_UINT64 uint64_t' >&3
2352else
2353cat > $TF_C << EOF
2354#include <stdio.h>
2355#include <stdint.h>
2356
2357int main (void) {
2358 char * i64 = NULL, * ui64 = NULL;
2359
2360 if ( sizeof(int) == 8 ) {
2361  i64 = "int"; ui64 = "unsigned int";
2362 } else if ( sizeof(long int) == 8 ) {
2363  i64 = "long int"; ui64 = "unsigned long int";
2364 } else if ( sizeof(long long int) == 8 ) {
2365  i64 = "long long int"; ui64 = "unsigned long long int";
2366 } else if ( sizeof(int64_t) == 8 ) {
2367  i64 = "int64_t"; ui64 = "uint64_t";
2368 } else {
2369  fprintf(stderr, "none\n");
2370  return 0;
2371 }
2372
2373 fprintf(stderr, "%s, %s\n", i64, ui64);
2374 printf("#define ROAR_NATIVE_INT64 %s\n#define ROAR_NATIVE_UINT64 %s\n", i64, ui64);
2375
2376 return 0;
2377}
2378EOF
2379 if $CCTF 2> /dev/null;
2380 then
2381  $EXEC_HELPER $TF_E >&3
2382 else
2383  echo 'error, can not compile'
2384  exit 1
2385 fi
2386fi
2387
2388
2389echo -n 'checking if cp supports -v... '
2390if cp -v --help > /dev/null 2> /dev/null
2391then
2392 echo "cp_v=-v" >&4
2393 echo yes
2394else
2395 echo "cp_v=" >&4
2396 echo no
2397fi
2398
2399echo -n 'checking for cdrom device... '
2400if [ -n "$CDROM" ]
2401then
2402 if [ "$CDROM" = '(none)' ]
2403 then
2404  echo "none (disabled by user)"
2405 else
2406  if $CROSS_COMPILE
2407  then
2408   echo "$CDROM (cross compile)"
2409  elif [ -e "$CDROM" ]
2410  then
2411   echo "$CDROM (forced by user)"
2412  else
2413   echo "$CDROM (not existing, forced by user)"
2414  fi
2415  echo '#define ROAR_DEFAULT_CDROM "'"$CDROM"'"' >&3
2416  echo '#define ROAR_HAVE_CDROM' >&3
2417 fi
2418elif $CROSS_COMPILE
2419then
2420 echo 'none (cross compiling, use --cdrom to enable CDROM support)'
2421else
2422 CDROM=$(ls /dev/cdrom /dev/rcd0c 2> /dev/null | head -n 1);
2423 if [ -e "$CDROM" ]
2424 then
2425  echo "$CDROM"
2426  echo '#define ROAR_DEFAULT_CDROM "'"$CDROM"'"' >&3
2427  echo '#define ROAR_HAVE_CDROM' >&3
2428 else
2429  echo 'none'
2430  echo '#define ROAR_HAVE_CDROM' >&3
2431 fi
2432fi
2433
2434echo -n 'checking for default tty device... '
2435if [ -n "$TTY_DEV" ]
2436then
2437 if [ "$TTY_DEV" = '(none)' ]
2438 then
2439  echo "none (disabled by user)"
2440 else
2441  if $CROSS_COMPILE
2442  then
2443   echo "$TTY_DEV (cross compile)"
2444  elif [ -e "$TTY_DEV" ]
2445  then
2446   echo "$TTY_DEV (forced by user)"
2447  else
2448   echo "$TTY_DEV (not existing, forced by user)"
2449  fi
2450  echo '#define ROAR_DEFAULT_TTY "'"$TTY_DEV"'"' >&3
2451 fi
2452elif $CROSS_COMPILE
2453then
2454 echo 'none (cross compiling, use --tty to set default device)'
2455else
2456 TTY_DEV=$(ls /dev/tty 2> /dev/null | head -n 1);
2457 if [ -e "$TTY_DEV" ]
2458 then
2459  echo "$TTY_DEV"
2460  echo '#define ROAR_DEFAULT_TTY "'"$TTY_DEV"'"' >&3
2461 else
2462  echo 'none'
2463 fi
2464fi
2465
2466echo -n 'checking for OSS device... '
2467if [ -n "$OSS_DEV" ]
2468then
2469 if [ "$OSS_DEV" = '(none)' ]
2470 then
2471  echo "none (disabled by user)"
2472 else
2473  if $CROSS_COMPILE
2474  then
2475   echo "$OSS_DEV (cross compile)"
2476  elif [ -e "$OSS_DEV" ]
2477  then
2478   echo "$OSS_DEV (forced by user)"
2479  else
2480   echo "$OSS_DEV (not existing, forced by user)"
2481  fi
2482  echo '#define ROAR_DEFAULT_OSS_DEV "'"$OSS_DEV"'"' >&3
2483 fi
2484elif $CROSS_COMPILE
2485then
2486 echo 'none (cross compiling, use --oss-dev to set default device)'
2487else
2488 OSS_DEV=$(ls /dev/dsp /dev/audio 2> /dev/null | head -n 1);
2489 if [ -e "$OSS_DEV" ]
2490 then
2491  echo "$OSS_DEV"
2492  echo '#define ROAR_DEFAULT_OSS_DEV "'"$OSS_DEV"'"' >&3
2493 else
2494  echo 'none'
2495 fi
2496fi
2497
2498echo -n 'checking for OSS mixer device... '
2499if [ -n "$OSS_MIX_DEV" ]
2500then
2501 if [ "$OSS_MIX_DEV" = '(none)' ]
2502 then
2503  echo "none (disabled by user)"
2504 else
2505  if $CROSS_COMPILE
2506  then
2507   echo "$OSS_MIX_DEV (cross compile)"
2508  elif [ -e "$OSS_MIX_DEV" ]
2509  then
2510   echo "$OSS_MIX_DEV (forced by user)"
2511  else
2512   echo "$OSS_MIX_DEV (not existing, forced by user)"
2513  fi
2514  echo '#define ROAR_DEFAULT_OSS_MIX_DEV "'"$OSS_MIX_DEV"'"' >&3
2515 fi
2516elif $CROSS_COMPILE
2517then
2518 echo 'none (cross compiling, use --oss-mixer-dev to set default device)'
2519else
2520 OSS_MIX_DEV=$(ls /dev/mixer 2> /dev/null | head -n 1);
2521 if [ -e "$OSS_MIX_DEV" ]
2522 then
2523  echo "$OSS_MIX_DEV"
2524  echo '#define ROAR_DEFAULT_OSS_MIX_DEV "'"$OSS_MIX_DEV"'"' >&3
2525 else
2526  echo 'none'
2527 fi
2528fi
2529
2530echo 'checking for DECnet status file... '"$PROC_NET_DECNET"
2531echo '#define ROAR_PROC_NET_DECNET "'"$PROC_NET_DECNET"'"' >&3
2532
2533echo -n 'checking for DECnet neighbour file... '
2534if [ -n "$PROC_NET_DECNET_NEIGH" ]
2535then
2536 if [ "$PROC_NET_DECNET_NEIGH" = '(none)' ]
2537 then
2538  echo "none (disabled by user)"
2539 else
2540  if $CROSS_COMPILE
2541  then
2542   echo "$PROC_NET_DECNET_NEIGH (cross compile)"
2543  elif [ -e "$PROC_NET_DECNET_NEIGH" ]
2544  then
2545   echo "$PROC_NET_DECNET_NEIGH (forced by user)"
2546  else
2547   echo "$PROC_NET_DECNET_NEIGH (not existing, forced by user)"
2548  fi
2549  echo '#define ROAR_PROC_NET_DECNET_NEIGH "'"$PROC_NET_DECNET_NEIGH"'"' >&3
2550 fi
2551elif $CROSS_COMPILE
2552then
2553 echo 'none (cross compiling, use --proc-net-decnet-neigh to set default device)'
2554else
2555 PROC_NET_DECNET_NEIGH=$(ls /proc/net/decnet_neigh 2> /dev/null | head -n 1);
2556 if [ -e "$PROC_NET_DECNET_NEIGH" ]
2557 then
2558  echo "$PROC_NET_DECNET_NEIGH"
2559  echo '#define ROAR_PROC_NET_DECNET_NEIGH "'"$PROC_NET_DECNET_NEIGH"'"' >&3
2560 else
2561  echo 'none'
2562 fi
2563fi
2564
2565echo -n 'checking for IP neighbour (ARP) file... '
2566if [ -n "$PROC_NET_ARP" ]
2567then
2568 if [ "$PROC_NET_ARP" = '(none)' ]
2569 then
2570  echo "none (disabled by user)"
2571 else
2572  if $CROSS_COMPILE
2573  then
2574   echo "$PROC_NET_ARP (cross compile)"
2575  elif [ -e "$PROC_NET_ARP" ]
2576  then
2577   echo "$PROC_NET_ARP (forced by user)"
2578  else
2579   echo "$PROC_NET_ARP (not existing, forced by user)"
2580  fi
2581  echo '#define ROAR_PROC_NET_ARP "'"$PROC_NET_ARP"'"' >&3
2582 fi
2583elif $CROSS_COMPILE
2584then
2585 echo 'none (cross compiling, use --proc-net-arp to set default device)'
2586else
2587 PROC_NET_ARP=$(ls /proc/net/arp 2> /dev/null | head -n 1);
2588 if [ -e "$PROC_NET_ARP" ]
2589 then
2590  echo "$PROC_NET_ARP"
2591  echo '#define ROAR_PROC_NET_ARP "'"$PROC_NET_ARP"'"' >&3
2592 else
2593  echo 'none'
2594 fi
2595fi
2596
2597echo -n 'checking for default audio group... '
2598if [ "$DEFAULT_GRP" = '(none)' ]
2599then
2600 echo "none (disabled by user)"
2601else
2602 echo "$DEFAULT_GRP"
2603 echo '#define ROAR_DEFAULT_SOCKGRP "'"$DEFAULT_GRP"'"' >&3
2604fi
2605
2606echo -n 'checking for user id of root/superuser... '
2607if [ "$ROOT_UID" = '(none)' ]
2608then
2609 echo "none (disabled by user)"
2610elif [ "$ROOT_UID" = '' ]
2611then
2612 ROOT_USER='root'
2613 ROOT_UID=`id -u $ROOT_USER`
2614 if [ "$ROOT_UID" = '' ]
2615 then
2616  echo "none (please report this)"
2617 else
2618  echo "$ROOT_UID($ROOT_USER)"
2619  echo '#define ROAR_ROOT_UID '"$ROOT_UID" >&3
2620 fi
2621else
2622 echo "$ROOT_UID"
2623 echo '#define ROAR_ROOT_UID '"$ROOT_UID" >&3
2624fi
2625
2626$NEED_GNU_SOURCE && echo '#define ROAR_NEED_GNU_SOURCE' >&3
2627
2628cat >&3 << EOF
2629
2630#if defined(ROAR_HAVE_LIBCELT0) && !defined(ROAR_HAVE_LIBCELT)
2631#define ROAR_HAVE_LIBCELT
2632#endif
2633
2634#endif
2635
2636//ll
2637EOF
2638
2639echo >&5
2640echo '//ll' >&5
2641
2642echo >&4
2643echo >&4
2644
2645cd plugins
2646
2647#if $LIBAO
2648#then
2649# echo 'running libao plugin configure...'
2650#  cd ao/
2651# if [ "$AO_INST_DIR" = '' ]
2652# then
2653#  ./configure --force-have-roar --pkg-config "$PKG_CONFIG"                           && \
2654#    echo "subdir_plugins_ao=plugins/ao" >&4
2655# else
2656#  ./configure --force-have-roar --pkg-config "$PKG_CONFIG" --inst-dir "$AO_INST_DIR" && \
2657#    echo "subdir_plugins_ao=plugins/ao" >&4
2658# fi
2659# cd ..
2660#else
2661# echo "running libao plugin configure... disabled by user"
2662#fi
2663
2664if $XMMS
2665then
2666 echo 'running xmms plugin configure...'
2667 cd xmms/
2668  ./configure --force-have-roar --pkg-config "$PKG_CONFIG" --inst-dir "$XMMS_INST_DIR" && \
2669    echo "subdir_plugins_xmms=plugins/xmms" >&4
2670 cd ..
2671else
2672 echo "running xmms plugin configure... disabled by user"
2673fi
2674
2675#if $AUDACIOUS
2676#then
2677# echo 'running Audacious plugin configure...'
2678# cd audacious/
2679#  ./configure --force-have-roar --pkg-config "$PKG_CONFIG" --inst-dir "$AUDACIOUS_INST_DIR" && \
2680#    echo "subdir_plugins_audacious=plugins/audacious" >&4
2681# cd ..
2682#else
2683# echo "running Audacious plugin configure... disabled by user"
2684#fi
2685
2686cd ..
2687
2688rm -f $TF_C $TF_E
2689
2690mv config.h include/roaraudio/
2691echo 'config.h created and moved into include/roaraudio/'
2692
2693if $TARGET_CYGWIN
2694then
2695 rm -f $TF_E.exe
2696 echo 'patching Makefiles for cygwin...'
2697 find . -name Makefile -print0 | xargs -0 sed 's/\.so/.dll'/g -i
2698fi
2699
2700#ll
Note: See TracBrowser for help on using the repository browser.