Changeset 5059:ceb1b45d179d in roaraudio for configure


Ignore:
Timestamp:
06/17/11 12:27:53 (13 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

test for clock_*()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • configure

    r5056 r5059  
    144144 
    145145_CARGS="$@"; 
     146 
     147# other stuff we need to reset: 
     148infotext='' 
    146149 
    147150# some very basic string functions: 
     
    668671 shift; 
    669672 
     673 if [ "$infotext" = '' ] 
     674 then 
     675  _info='' 
     676 else 
     677  _info=" ($infotext)" 
     678 fi 
     679 
    670680 LIBS='' 
    671681 
     
    720730 if [ "$R" = '0' ] 
    721731 then 
    722   echo 'yes' 
     732  echo "yes$_info" 
    723733  echo "LIB($name) WAS FOUND" >&5 
    724734 else 
    725   echo 'no' 
     735  echo "no$_info" 
    726736  echo "LIB($name) NOT FOUND" >&5 
    727737 fi 
     
    875885 shift; 
    876886 
     887 if [ "$infotext" = '' ] 
     888 then 
     889  _info='' 
     890 else 
     891  _info=" ($infotext)" 
     892 fi 
     893 
    877894 LIBS='' 
     895 
     896 _funcname=`echo "$NAME" | to_escaped` 
    878897 
    879898 while [ "$1" != '--' ] 
     
    932951 if [ "$R" = '0' ] 
    933952 then 
     953  eval funcname_$_funcname=true 
    934954  echo "#define $DEF" >&3 
    935955  echo "FUNCTION($NAME) IS OK" >&5 
     956  echo "yes$_info" 
     957 else 
     958  eval funcname_$_funcname=false 
     959  echo "FUNCTION($NAME) IS NOT OK" >&5 
     960  echo "no$_info" 
     961 fi 
     962 
     963} 
     964 
     965test_const_defmake () { 
     966 DEF="$1" 
     967 NAME="$2" 
     968 shift; 
     969 shift; 
     970 echo -n "checking for constant $NAME... " 
     971 
     972 TYPE="$1" 
     973 CONST="$2" 
     974 shift; 
     975 shift; 
     976 
     977 LIBS='' 
     978 
     979 while [ "$1" != '--' ] 
     980 do 
     981  case "$1" in 
     982   'c'|'-lc') 
     983    :; # no need to do anything 
     984   ;; 
     985   '-'*) 
     986    LIBS="$LIBS $1" 
     987   ;; 
     988   *) 
     989    LIBS="-l$1" 
     990   ;; 
     991  esac 
     992  shift; 
     993 done 
     994 
     995 shift; # skip '--' 
     996 
     997 echo "TEST CONST: $NAME" >&5 
     998 
     999 { 
     1000  while [ "$1" != '' ] 
     1001  do 
     1002   _h="$1"; 
     1003   shift; 
     1004   _envname=`echo "$_h" | to_escaped` 
     1005   eval "_t=\$libname_$_envname" 
     1006   echo "LIB($name) DEPENDS ON $_h($_envname) with state '$_t'" >&5 
     1007   if [ "$_t" = 'false' ] 
     1008   then 
     1009    echo "// not including <$_h> as it was tested as not present" 
     1010   else 
     1011    echo "#include <$_h>" 
     1012   fi 
     1013  done 
     1014 
     1015  case "$TYPE" in 
     1016   ':int') 
     1017    _type='int' 
     1018   ;; 
     1019   ':float') 
     1020    _type='float' 
     1021   ;; 
     1022   ':ptr') 
     1023    _type='void *' 
     1024   ;; 
     1025   *) 
     1026    _type="$TYPE" 
     1027   ;; 
     1028  esac 
     1029 
     1030  echo 'int main (void) {' 
     1031  echo " $_type x;" 
     1032  echo " x = ($_type)$CONST;" 
     1033  echo ' return 0;' 
     1034  echo '}' 
     1035 
     1036 } > $TF_C 
     1037 
     1038 echo "--- BEGIN OF CODE BLOCK ---" >&5 
     1039 cat $TF_C >&5 
     1040 echo "--- END OF CODE BLOCK ---" >&5 
     1041 
     1042 echo "CONST($NAME) HAS COMPILER/LINKER OUTPUT:" >&5 
     1043 echo "--- BEGIN OF CHILD OUTPUT BLOCK ---" >&5 
     1044 $CCTF $LIBS >&5 2>&5; 
     1045 R=$? 
     1046 echo "--- END OF CHILD OUTPUT BLOCK ---" >&5 
     1047 
     1048 if [ "$R" = '0' ] 
     1049 then 
     1050  echo "#define $DEF" >&3 
     1051  echo "CONST($NAME) IS OK" >&5 
    9361052  echo yes 
    9371053 else 
    938   echo "FUNCTION($NAME) IS NOT OK" >&5 
     1054  echo "CONST($NAME) IS NOT OK" >&5 
    9391055  echo no 
    9401056 fi 
    941  
    9421057} 
    9431058 
     
    13911506#                #define                 subdir       name           -lxxx      -- header 
    13921507test_lib_defmake ROAR_HAVE_LIBM          %            'MathLibrary'  m          -- math.h 
     1508rt='' 
     1509libname_rt=false 
    13931510if test_lib 'realtime Library' rt -- sys/mman.h mqueue.h semaphore.h 
    13941511then 
     
    13961513  echo '#define ROAR_HAVE_LIBRT' 
    13971514  echo '#define ROAR_NEED_LIBRT' 
     1515  libname_rt=true 
     1516  rt=rt 
    13981517 } >&3 
    13991518fi 
     
    15871706test_func_defmake ROAR_HAVE_AO_APPEND_GLOBAL_OPTION ao_append_global_option 'ao_append_global_option("","")' ao -- ao/ao.h 
    15881707 
     1708test_func_defmake ROAR_HAVE_CLOCK_GETRES  clock_getres  'struct timespec ts; clock_getres((clockid_t)0, &ts)'  -- time.h 
     1709test_func_defmake ROAR_HAVE_CLOCK_GETTIME clock_gettime 'struct timespec ts; clock_gettime((clockid_t)0, &ts)' -- time.h 
     1710test_func_defmake ROAR_HAVE_CLOCK_SETTIME clock_settime 'struct timespec ts; clock_settime((clockid_t)0, &ts)' -- time.h 
     1711 
     1712echo "STATE: funcname_clock_getres=$funcname_clock_getres" >&5 
     1713echo "STATE: libname_rt=$libname_rt" >&5 
     1714 
     1715if [ "$funcname_clock_getres" = 'false' ] 
     1716then 
     1717 if $libname_rt 
     1718 then 
     1719  infotext='retested using realtime library' 
     1720  test_func_defmake ROAR_HAVERT_CLOCK_GETRES  clock_getres  'struct timespec ts; clock_getres((clockid_t)0, &ts)'  $rt -- time.h 
     1721  test_func_defmake ROAR_HAVERT_CLOCK_GETTIME clock_gettime 'struct timespec ts; clock_gettime((clockid_t)0, &ts)' $rt -- time.h 
     1722  test_func_defmake ROAR_HAVERT_CLOCK_SETTIME clock_settime 'struct timespec ts; clock_settime((clockid_t)0, &ts)' $rt -- time.h 
     1723  infotext='' 
     1724  if $funcname_clock_getres 
     1725  then 
     1726   echo "clock_rt=-l$rt" >&4 
     1727  fi 
     1728 fi 
     1729fi 
     1730 
     1731test_const_defmake ROAR_HAVE_CONST_CLOCK_REALTIME CLOCK_REALTIME clockid_t CLOCK_REALTIME -- time.h 
     1732test_const_defmake ROAR_HAVE_CONST_CLOCK_MONOTONIC CLOCK_MONOTONIC clockid_t CLOCK_MONOTONIC -- time.h 
     1733test_const_defmake ROAR_HAVE_CONST_CLOCK_PROCESS_CPUTIME_ID CLOCK_PROCESS_CPUTIME_ID clockid_t CLOCK_PROCESS_CPUTIME_ID -- time.h 
     1734test_const_defmake ROAR_HAVE_CONST_CLOCK_THREAD_CPUTIME_ID CLOCK_THREAD_CPUTIME_ID clockid_t CLOCK_THREAD_CPUTIME_ID -- time.h 
     1735 
    15891736 
    15901737echo -n 'checking for basic IO calls... ' 
Note: See TracChangeset for help on using the changeset viewer.