This file is indexed.

/usr/lib/roaraudio/build-system/configure.tests is in libroar-dev 1.0~beta11-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
#!/bin/false
# vim:ft=sh

#     Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2012
#
# This file is part of roard a part of RoarAudio,
# a cross-platform sound system for both, home and professional use.
# See README for details.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3
# as published by the Free Software Foundation.
#
# RoarAudio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this software; see the file COPYING.  If not, write to
# the Free Software Foundation, 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.

test_libroar() {
 _min="$1"
 [ "$_min" = '' ] && _min='current'

 echo -n "checking for version of roaraudio... "

 if roar-config --compare-versions current ge "$_min"
 then
  echo "`roar-config --version`, good"
  return 0
 else
  _ver="`roar-config --version 2> /dev/null`"
  if [ "$_ver" = '' ]
  then
   echo "unknown. bad."
  else
   echo "$_ver, too old (minimum required: $_min)"
  fi
  return 1
 fi
}

test_pkgversion() {
 echo -n "checking for version of this package... "
 VERSION=`head -n 1 ChangeLog | cut -d' ' -f2`
 echo "$VERSION"
 return 0
}

test_buildstamp() {
 echo -n "checking for build stamp of this package... "
 BUILD_STAMP="`date -u +'%F %X'` (`id -un`@`uname -n`)"
 echo "$BUILD_STAMP"
 return 0
}

test_cc() {
 echo -n "checking for C compiler... "
 if [ "$CC" != '' ]
 then
  echo $CC
  return 0
 else
  CC=$(which gcc cc 2> /dev/null | grep ^/ | head -n 1)
  if [ "$CC" = '' ]
  then
   echo 'none'
   exit 1;
  fi
  echo $CC
  return 0
 fi
}

test_ranlib() {
 echo -n "checking for ranlib... "
 if [ "$RANLIB" != '' ]
 then
  echo $RANLIB
  return 0
 else
  _guess=`echo $CC | sed 's/[gp]*cc\(-.*\)*//'`
  RANLIB=$(which ${_guess}ranlib ranlib 2> /dev/null | grep ^/ | head -n 1)
  if [ "$RANLIB" = '' ]
  then
   echo 'none'
   return 1
  fi
  echo $RANLIB
  return 0
 fi
}

test_pkgconfig() {
 echo -n "checking for pkg-config... "
 PKG_CONFIG=$(which pkg-config false 2> /dev/null | grep ^/ | head -n 1)
 if $PKG_CONFIG --help > /dev/null 2> /dev/null
 then
  echo $PKG_CONFIG
  return 0
 else
  echo no
  return 1
 fi
}

test_sysname() {
 echo -n "checking for sysname... "
 SYSNAME=$(uname -s)
 echo "$SYSNAME"
 return 0
}

test_crosscompile() {
 echo -n 'checking if we cross compile... '
 if $CROSS_COMPILE
 then
  echo yes

  echo -n "checking for exec helper... "
  if [ "$EXEC_HELPER" = '' ]
  then
   if $TARGET_WIN32
   then
    EXEC_HELPER=$(which wine 2> /dev/null | grep ^/ | head -n 1)
    if [ "$EXEC_HELPER" = '' ]
    then
     echo 'none (please install wine)'
    else
     echo "$EXEC_HELPER"
    fi
   else
    echo 'none (unknown)'
   fi
  else
   echo "$EXEC_HELPER"
  fi

  echo -n "checking for sysname of target... "
  if $TARGET_CYGWIN
  then
   SYSNAME=cygwin
  elif $TARGET_WIN32
  then
   SYSNAME=win32
  else
   SYSNAME=unknown
  fi
  echo "$SYSNAME"
  return 0
 else
  echo no
  return 1
 fi
}

test_wextra() {
 # Check for -Wextra
 #Wextra
 echo -n "checking if compiler supports -Wextra... "
 echo 'int main (void) { return 0; }' > $TF_C
 if $CCTF -Wextra 2> /dev/null;
 then
  echo yes
  Wextra=true
  return 0
 else
  echo no
  Wextra=false
  return 1
 fi
}

test_cp_v() {
 echo -n 'checking if cp supports -v... '
 if cp -v --help > /dev/null 2> /dev/null
 then
  echo "cp_v=-v" >&4
  echo yes
  return 0
 else
  echo "cp_v=" >&4
  echo no
  return 1
 fi
}

test_bin_format() {
 echo -n "checking for binary format... "
 echo "TEST BIN FORMAT:" >&5

 {
  echo "#include <stdio.h>"
  echo
  echo "int main (void) {"
  echo " char buf[512];"
  echo " size_t len;"
  echo
  echo " len = fread(buf, 1, sizeof(buf), stdin);"
  echo " if ( len < 4 )"
  echo "  return 1;"
  echo
  echo " if ( buf[0] == '\\177' && buf[1] == 'E' && buf[2] == 'L' && buf[3] == 'F' ) {"
  echo "  printf(\"ELF%c\", (char)10);"
  echo "  return 0;"
  echo " }"
  echo
  echo " if ( buf[0] == 'M' && buf[1] == 'Z' ) {"
  echo "  printf(\"MZ%c\", (char)10);"
  echo "  return 0;"
  echo " }"
  echo
  echo " return 1;"
  echo "}"
 } > $TF_C

 echo "--- BEGIN OF CODE BLOCK ---" >&5
 cat $TF_C >&5
 echo "--- END OF CODE BLOCK ---" >&5

 echo "BIN FORMAT() HAS COMPILER/LINKER OUTPUT:" >&5
 echo "--- BEGIN OF CHILD OUTPUT BLOCK ---" >&5
 $CCTF >&5 2>&5;
 R=$?
 echo "--- END OF CHILD OUTPUT BLOCK ---" >&5

 if [ "$R" = '0' ]
 then
  BIN_FORMAT=`$EXEC_HELPER $TF_E < $TF_E 2> /dev/null`
  R=$?
  if [ "$R" = '0' ]
  then
   echo "$BIN_FORMAT"
   echo "BIN FORMAT() IS '$BIN_FORMAT'" >&5
   return 0
  else
   BIN_FORMAT=unknown
   echo 'unknown'
   echo "BIN FORMAT() NOT KNOWN" >&5
   return 1
  fi
 else
  BIN_FORMAT=unknown
  echo 'unknown'
  echo "BIN FORMAT() NOT KNOWN" >&5
  return 1
 fi
}

test_linkdeps() {
 if [ "$LINK_DEPS" = 'auto' ]
 then
  if [ "$BIN_FORMAT" = 'ELF' ]
  then
   LINK_DEPS='indirect'
  else
   LINK_DEPS='full'
  fi
 fi

 echo "LINK_DEPS=$LINK_DEPS" >&4
 echo "checking for linkage model... $LINK_DEPS"
 return 0
}

test_lib () {
 _have_libs=false
 _have_headers=false
 _defs=''
 echo > $TF_C

 $NEED_GNU_SOURCE && _defs="$_defs -D_GNU_SOURCE"

 name="$1"
 last_tested_object="$name"
 echo -n "checking for $name... "
 echo "TEST LIB: $name" >&5
 shift;

 if [ "$infotext" = '' ]
 then
  _info=''
 else
  _info=" ($infotext)"
 fi

 LIBS=''

 while [ "$1" != '--' ]
 do
  echo "LIB($name) HAS LIB INFO: $1" >&5
  case "$1" in
   'c'|'-lc')
    :; # no need to do anything
   ;;
   '-'*)
    LIBS="$LIBS $1"
    _have_libs=true
   ;;
   *)
    LIBS="$LIBS -l$1"
    _have_libs=true
   ;;
  esac
  shift;
 done

 shift;

 echo "LIB($name) IS TESTED USING LIBS: $LIBS" >&5

 while [ "$1" != '' ]
 do
  _h="$1";
  shift;
  _envname=`echo "$_h" | to_escaped`
  eval "_t=\$libname_$_envname"
  echo "LIB($name) DEPENDS ON $_h($_envname) with state '$_t'" >&5
  if [ "$_t" = 'false' ]
  then
   echo "// not including <$_h> as it was tested as not present"  >> $TF_C
  else
   echo "#include <$_h>"  >> $TF_C
   _have_headers=true
  fi
 done

 echo 'int main (void) { return 0; }' >> $TF_C

 if [ "$_have_libs" = 'false' -a "$_have_headers" = 'false' ]
 then
  echo "no (nothing left to test)$_info"
  echo "LIB($name) HAS NOTHING TO TEST" >&5
  return 1
 fi

 echo "LIB($name) IS TESTED USING TEST CODE:" >&5
 echo "--- BEGIN OF CODE BLOCK ---" >&5
 cat $TF_C >&5
 echo "--- END OF CODE BLOCK ---" >&5

 echo "LIB($name) HAS COMPILER/LINKER OUTPUT:" >&5
 echo "--- BEGIN OF CHILD OUTPUT BLOCK ---" >&5
 $CCTF $_defs $LIBS >&5 2>&5;
 R=$?
 echo "--- END OF CHILD OUTPUT BLOCK ---" >&5

 if [ "$R" = '0' ]
 then
  echo "yes$_info"
  echo "LIB($name) WAS FOUND" >&5
 else
  echo "no$_info"
  echo "LIB($name) NOT FOUND" >&5
 fi

 return $R
}

test_lib_defmake () {
 def="$1"
 subdir="$2"
 shift
 shift
 name="$1"
 lib="$2"
 shift

 echo "TEST LIB: $name" >&5

 [ "$subdir" = '%' ] && subdir=''

 envlib=`echo "$lib"   | cut -d/ -f1 | to_escaped`
 envname=`echo "$name" | to_escaped`

 eval "envname2envlib_$envname=\$envlib"

 if [ "$envlib" = 'c' ]
 then
  envlib="$envname"
 fi

 echo "LIB($name) HAS envlib='$envlib', envname='$envname'" >&5

 if [ "$lib" != '--' ]
 then
  echo "EVAL: _no=\$no_lib_$envlib" >&5
  eval _no="\$no_lib_$envlib";
  $MINIMAL && _no='XXX'

  if [ "$_no" != '' ]
  then
    echo "checking for $name... disabled by user"
    echo "LIB($name) IS DISABLED BY USER" >&5
   [ "$subdir" != '' ] && \
    echo "subdir_$subdir=" >&4
   echo "lib_$envlib=" >&4
   eval "libname_$envname=false"
   return;
  fi
 fi

 lib="$lib/"

 libn=`echo $lib | cut -d/ -f1`
 is_fatal=`echo $lib | cut -d/ -f2`

 lib="$libn"

# echo "is_fatal(i)=$is_fatal" >&5

 if [ "$is_fatal" = '' -o "$is_fatal" = 'no' -o "$is_fatal" = 'false' ]
 then
  is_fatal=false
 else
  is_fatal=true
  shift; # maybe we have a pkg name, not a lib
 fi

 echo "LIB($name) HAS FATAL FLAG SET TO $is_fatal" >&5

# echo "is_fatal(b)=$is_fatal" >&5

 LIBS=$($PKG_CONFIG --silence-errors --cflags --libs $lib 2> /dev/null)
 if [ "$?" != '0' ]
 then
  if $is_fatal
  then
   echo "checking for $name... no (fatal config errors)"
   echo "LIB($name) HAS FATAL ERRORS" >&5
   echo "LIB($name) NOT FOUND" >&5
   [ "$subdir" != '' ] && \
    echo "subdir_$subdir=" >&4
   echo "lib_$envlib=" >&4
   return
  fi
  LIBS="-l$lib"
 fi

 echo "LIB($name) HAS LIBS: $LIBS" >&5

 if test_lib "$name" $LIBS "$@"
 then
  subdir_var='subdir_'"`echo $subdir | to_escaped`"
  echo "#define $def"            >&3
  [ "$subdir" != '' ] && \
   echo "$subdir_var=$subdir" >&4
  [ "$lib" != 'c' ] && \
   echo "lib_$envlib=$LIBS" >&4
  if [ "$lib" != 'c' ]
  then
   eval "lib_$envlib='$LIBS'"
  else
   echo "LIB($name) SETS libname_$envname=true" >&5
   eval "libname_$envname=true"
  fi
  return 0
 else
  [ "$subdir" != '' ] && \
   echo "subdir_$subdir=" >&4
  [ "$lib" != 'c' ] && \
   echo "lib_$envlib=" >&4
  echo "LIB($name) SETS libname_$envname=false" >&5
  eval "libname_$envname=false"
  return 1
 fi
 echo >&5
 echo >&5
}

test_tool_defmake () {
 DEF="$1"
 NAME="$2"
 shift;
 shift;
 echo -n "checking for $NAME... "

 echo "TEST TOOL: $NAME" >&5

 if $RUNTIME_DETECT
 then
  echo "$1 (runtime detect)"
  echo "TOOL($NAME) WILL BE RUNTIME DETECTED" >&5
  echo "#define $DEF "\""$1"\" >&3
  return 0
 elif $MINIMAL
 then
  echo "disabled by user (minimalstic build)"
  echo "TOOL($NAME) IS DISABLED BY USER" >&5
  return 1
 else

  LIST=$(which "$@" 2> /dev/null | grep ^/ | head -n 1)

  if [ "$LIST" = '' ]
  then
   echo 'no'
   echo "TOOL($NAME) NOT FOUND" >&5
   return 1
  else
   echo $LIST
   echo "#define $DEF "\""$LIST"\" >&3
   echo "TOOL($NAME) IS AT $LIST" >&5
   return 0
  fi
 fi
}

test_func_defmake () {
 _defs=''
 DEF="$1"
 NAME="$2"
 shift;
 shift;
 echo -n "checking for $NAME()... "

 CALL="$1"
 shift;

 $NEED_GNU_SOURCE && _defs="$_defs -D_GNU_SOURCE"

 if [ "$infotext" = '' ]
 then
  _info=''
 else
  _info=" ($infotext)"
 fi

 LIBS=''

 _funcname=`echo "$NAME" | to_escaped`

 while [ "$1" != '--' ]
 do
  case "$1" in
   'c'|'-lc')
    :; # no need to do anything
   ;;
   '-'*)
    LIBS="$LIBS $1"
   ;;
   *)
    LIBS="-l$1"
   ;;
  esac
  shift;
 done

 shift; # skip '--'

 echo "TEST FUNCTION: $NAME" >&5

 {
  while [ "$1" != '' ]
  do
   _h="$1";
   shift;
   _envname=`echo "$_h" | to_escaped`
   eval "_t=\$libname_$_envname"
   echo "LIB($name) DEPENDS ON $_h($_envname) with state '$_t'" >&5
   if [ "$_t" = 'false' ]
   then
    echo "// not including <$_h> as it was tested as not present"
   else
    echo "#include <$_h>"
   fi
  done

  echo 'int main (void) {'
  echo " $CALL;"
  echo ' return 0;'
  echo '}'

 } > $TF_C

 echo "--- BEGIN OF CODE BLOCK ---" >&5
 cat $TF_C >&5
 echo "--- END OF CODE BLOCK ---" >&5

 echo "FUNCTION($NAME) HAS COMPILER/LINKER OUTPUT:" >&5
 echo "--- BEGIN OF CHILD OUTPUT BLOCK ---" >&5
 $CCTF $_defs $LIBS >&5 2>&5;
 R=$?
 echo "--- END OF CHILD OUTPUT BLOCK ---" >&5

 if [ "$R" = '0' ]
 then
  eval funcname_$_funcname=true
  echo "#define $DEF" >&3
  echo "FUNCTION($NAME) IS OK" >&5
  echo "yes$_info"
  return 0
 else
  eval funcname_$_funcname=false
  echo "FUNCTION($NAME) IS NOT OK" >&5
  echo "no$_info"
  return 1
 fi
}

test_const_defmake () {
 DEF="$1"
 NAME="$2"
 shift;
 shift;
 echo -n "checking for constant $NAME... "

 TYPE="$1"
 CONST="$2"
 shift;
 shift;

 LIBS=''

 while [ "$1" != '--' ]
 do
  case "$1" in
   'c'|'-lc')
    :; # no need to do anything
   ;;
   '-'*)
    LIBS="$LIBS $1"
   ;;
   *)
    LIBS="-l$1"
   ;;
  esac
  shift;
 done

 shift; # skip '--'

 echo "TEST CONST: $NAME" >&5

 {
  while [ "$1" != '' ]
  do
   _h="$1";
   shift;
   _envname=`echo "$_h" | to_escaped`
   eval "_t=\$libname_$_envname"
   echo "LIB($name) DEPENDS ON $_h($_envname) with state '$_t'" >&5
   if [ "$_t" = 'false' ]
   then
    echo "// not including <$_h> as it was tested as not present"
   else
    echo "#include <$_h>"
   fi
  done

  case "$TYPE" in
   ':int')
    _type='int'
   ;;
   ':float')
    _type='float'
   ;;
   ':ptr')
    _type='void *'
   ;;
   *)
    _type="$TYPE"
   ;;
  esac

  echo 'int main (void) {'
  echo " $_type x;"
  echo " x = ($_type)$CONST;"
  echo ' return 0;'
  echo '}'

 } > $TF_C

 echo "--- BEGIN OF CODE BLOCK ---" >&5
 cat $TF_C >&5
 echo "--- END OF CODE BLOCK ---" >&5

 echo "CONST($NAME) HAS COMPILER/LINKER OUTPUT:" >&5
 echo "--- BEGIN OF CHILD OUTPUT BLOCK ---" >&5
 $CCTF $LIBS >&5 2>&5;
 R=$?
 echo "--- END OF CHILD OUTPUT BLOCK ---" >&5

 if [ "$R" = '0' ]
 then
  echo "#define $DEF" >&3
  echo "CONST($NAME) IS OK" >&5
  echo yes
  return 0
 else
  echo "CONST($NAME) IS NOT OK" >&5
  echo no
  return 1
 fi
}

test_var_defmake () {
 DEF="$1"
 NAME="$2"
 shift;
 shift;
 echo -n "checking for global variable $NAME... "

 TYPE="$1"
 VAR="$2"
 shift;
 shift;

 LIBS=''

 while [ "$1" != '--' ]
 do
  case "$1" in
   'c'|'-lc')
    :; # no need to do anything
   ;;
   '-'*)
    LIBS="$LIBS $1"
   ;;
   *)
    LIBS="-l$1"
   ;;
  esac
  shift;
 done

 shift; # skip '--'

 echo "TEST VAR: $NAME" >&5

 {
  while [ "$1" != '' ]
  do
   _h="$1";
   shift;
   _envname=`echo "$_h" | to_escaped`
   eval "_t=\$libname_$_envname"
   echo "LIB($name) DEPENDS ON $_h($_envname) with state '$_t'" >&5
   if [ "$_t" = 'false' ]
   then
    echo "// not including <$_h> as it was tested as not present"
   else
    echo "#include <$_h>"
   fi
  done

  case "$TYPE" in
   ':int')
    _type='int'
   ;;
   ':float')
    _type='float'
   ;;
   ':ptr')
    _type='void *'
   ;;
   *)
    _type="$TYPE"
   ;;
  esac

  echo 'int main (void) {'
  echo " $_type x;"
  echo " x = ($_type)$VAR;"
  echo " $VAR = x;"
  echo ' return 0;'
  echo '}'
 } > $TF_C

 echo "--- BEGIN OF CODE BLOCK ---" >&5
 cat $TF_C >&5
 echo "--- END OF CODE BLOCK ---" >&5

 echo "VAR($NAME) HAS COMPILER/LINKER OUTPUT:" >&5
 echo "--- BEGIN OF CHILD OUTPUT BLOCK ---" >&5
 $CCTF $LIBS >&5 2>&5;
 R=$?
 echo "--- END OF CHILD OUTPUT BLOCK ---" >&5

 if [ "$R" = '0' ]
 then
  echo "#define $DEF" >&3
  echo "VAR($NAME) IS OK" >&5
  echo yes
  return 0
 else
  echo "VAR($NAME) IS NOT OK" >&5
  echo no
  return 1
 fi
}

test_version () {
 DEF="$1"
 NAME="$2"
 PKGNAME="$3"

 echo -n "checking for version of $NAME... "

 _ver=$($PKG_CONFIG --modversion $PKGNAME 2> /dev/null)

 if [ "$_ver" = '' ]
 then
  _ver=unknown
 fi

 echo $_ver

 _ver_def=$(echo $_ver | to_escaped | to_upper)
 echo "#define ${DEF}_$_ver_def" >&3

 echo "$_ver" | if grep '^[0-9]*\.[0-9]*\.[0-9]*$' > /dev/null
 then
  _ver_vdef=$(echo "$_ver" | sed 's/^\([0-9]*\)\.\([0-9]*\)\.\([0-9]\)*$/_ROAR_MKVERSION(\1, \2, \3)/')
  echo "#define ${DEF} $_ver_vdef" >&3
 else
  echo "#define ${DEF} 0" >&3
 fi

 return 0
}

test_type () {
 DEF="$1"
 NAME="$2"
 INITVAL="$3"
 DASHDASH="$4"
 shift; shift;

 if [ "$#" -ge '2' ]
 then
  shift; shift;
 fi

 HEADERS="stdint.h string.h unistd.h sys/types.h $*" #including headers here let
                                                     #them get checked for presence.

 [ "$INITVAL" = '' ] && INITVAL='0'

 echo -n "checking for type $NAME... "
 echo "TEST TYPE: $NAME" >&5

 echo "// type test for type $NAME"  >  $TF_C # need a clean file, write something
 for _h in $HEADERS
 do
  _envname=`echo "$_h" | to_escaped`
  eval "_t=\$libname_$_envname"
  echo "TYPE($NAME) DEPENDS ON $_h($_envname) with state '$_t'" >&5
  if [ "$_t" = 'false' ]
  then
   echo "// not including <$_h> as it was tested as not present"  >> $TF_C
  else
   echo "#include <$_h>"  >> $TF_C
  fi
 done
 echo "int main (void) { $NAME _var = $INITVAL; return 0; }" >> $TF_C

 echo "--- BEGIN OF CODE BLOCK ---" >&5
 cat $TF_C >&5
 echo "--- END OF CODE BLOCK ---" >&5

 echo "TYPE($NAME) HAS COMPILER/LINKER OUTPUT:" >&5
 echo "--- BEGIN OF CHILD OUTPUT BLOCK ---" >&5
 $CCTF >&5 2>&5;
 R=$?
 echo "--- END OF CHILD OUTPUT BLOCK ---" >&5

 if [ "$R" = '0' ]
 then
  echo "#define $DEF" >&3
  echo 'ok'
  echo "TYPE($NAME) IS OK" >&5
  return 0
 else
  echo 'not found'
  echo "TYPE($NAME) NOT FOUND" >&5
  return 1
 fi
}

test_pa_type () {
 DEF="$1"
 NAME="$2"
 TYPE="$3"
 V0="$4"
 V1="$5"
 TEST="$6"
 shift; shift; shift; shift; shift; shift;
 HEADER="$*"
 RS='%s'

 case "$TYPE" in
  'type')
   MSG="checking for type of $NAME()... "
  ;;
  'args:'*)
   MSG="checking for argument types of $NAME()... "
   RS=`echo "$TYPE" | cut -d: -f2`
  ;;
 esac;

 echo -n "$MSG"
 echo '#include <pulse/pulseaudio.h>'  >  $TF_C
 for _h in $HEADERS
 do
  echo "#include <$_h>"  >> $TF_C
 done
 echo '#include <string.h>'           >> $TF_C
 echo 'int main (void) { return 0; }' >> $TF_C
 echo "$TEST"                         >> $TF_C

 if $CCTF 2> /dev/null;
 then
  R="$V0"
 else
  R="$V1"
 fi

 echo "#define $DEF $R" >&3
 printf "$RS\n" "$R"
 return 0
}

test_winsock() {
 test_lib_defmake ${ROAR_BUILDSYSTEM_DEFPREFIX}HAVE_LIBWSOCK32    %            WinSockP0     wsock32    -- winsock2.h
 test_lib_defmake ${ROAR_BUILDSYSTEM_DEFPREFIX}HAVE_LIBWS2_32     %            WinSockP1     ws2_32     -- winsock2.h
 echo 'NETLIBS += $(lib_wsock32) $(lib_ws2_32)' >&4
 return 0
}

test_netlibs() {
 __old_MINIMAL=$MINIMAL
 MINIMAL=false
 test_winsock
 MINIMAL=$__old_MINIMAL
 return 0
}

test_pthread() {
 echo -n 'checking for -pthread... '

 echo '#include <pthread.h>'                            > $TF_C
 echo 'int main (void) { pthread_self(); return 0; }'  >> $TF_C

 if $CCTF -pthread 2> /dev/null;
 then
  echo "#define ${ROAR_BUILDSYSTEM_DEFPREFIX}HAVE_CC_PTHREAD_OPTION" >&3
  echo 'opt_pthread=-pthread' >&4
  echo 'pthread=$(opt_pthread)' >&4
  echo yes
  _ret=0
 else
  echo 'opt_pthread=' >&4
  echo 'pthread=$(lib_pthread)' >&4
  echo no
  test_lib_defmake ${ROAR_BUILDSYSTEM_DEFPREFIX}HAVE_LIBPTHREAD    %            libpthread    pthread    -- pthread.h
  _ret=$?
 fi

 [ "$_ret" = '0' ] && echo "#define ${ROAR_BUILDSYSTEM_DEFPREFIX}HAVE_PTHREAD" >&3
 return $_ret
}

#ll