Index: configure
===================================================================
--- configure	(revision 5056)
+++ configure	(revision 5059)
@@ -144,4 +144,7 @@
 
 _CARGS="$@";
+
+# other stuff we need to reset:
+infotext=''
 
 # some very basic string functions:
@@ -668,4 +671,11 @@
  shift;
 
+ if [ "$infotext" = '' ]
+ then
+  _info=''
+ else
+  _info=" ($infotext)"
+ fi
+
  LIBS=''
 
@@ -720,8 +730,8 @@
  if [ "$R" = '0' ]
  then
-  echo 'yes'
+  echo "yes$_info"
   echo "LIB($name) WAS FOUND" >&5
  else
-  echo 'no'
+  echo "no$_info"
   echo "LIB($name) NOT FOUND" >&5
  fi
@@ -875,5 +885,14 @@
  shift;
 
+ if [ "$infotext" = '' ]
+ then
+  _info=''
+ else
+  _info=" ($infotext)"
+ fi
+
  LIBS=''
+
+ _funcname=`echo "$NAME" | to_escaped`
 
  while [ "$1" != '--' ]
@@ -932,12 +951,108 @@
  if [ "$R" = '0' ]
  then
+  eval funcname_$_funcname=true
   echo "#define $DEF" >&3
   echo "FUNCTION($NAME) IS OK" >&5
+  echo "yes$_info"
+ else
+  eval funcname_$_funcname=false
+  echo "FUNCTION($NAME) IS NOT OK" >&5
+  echo "no$_info"
+ 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
  else
-  echo "FUNCTION($NAME) IS NOT OK" >&5
+  echo "CONST($NAME) IS NOT OK" >&5
   echo no
  fi
-
 }
 
@@ -1391,4 +1506,6 @@
 #                #define                 subdir       name           -lxxx      -- header
 test_lib_defmake ROAR_HAVE_LIBM          %            'MathLibrary'  m          -- math.h
+rt=''
+libname_rt=false
 if test_lib 'realtime Library' rt -- sys/mman.h mqueue.h semaphore.h
 then
@@ -1396,4 +1513,6 @@
   echo '#define ROAR_HAVE_LIBRT'
   echo '#define ROAR_NEED_LIBRT'
+  libname_rt=true
+  rt=rt
  } >&3
 fi
@@ -1587,4 +1706,32 @@
 test_func_defmake ROAR_HAVE_AO_APPEND_GLOBAL_OPTION ao_append_global_option 'ao_append_global_option("","")' ao -- ao/ao.h
 
+test_func_defmake ROAR_HAVE_CLOCK_GETRES  clock_getres  'struct timespec ts; clock_getres((clockid_t)0, &ts)'  -- time.h
+test_func_defmake ROAR_HAVE_CLOCK_GETTIME clock_gettime 'struct timespec ts; clock_gettime((clockid_t)0, &ts)' -- time.h
+test_func_defmake ROAR_HAVE_CLOCK_SETTIME clock_settime 'struct timespec ts; clock_settime((clockid_t)0, &ts)' -- time.h
+
+echo "STATE: funcname_clock_getres=$funcname_clock_getres" >&5
+echo "STATE: libname_rt=$libname_rt" >&5
+
+if [ "$funcname_clock_getres" = 'false' ]
+then
+ if $libname_rt
+ then
+  infotext='retested using realtime library'
+  test_func_defmake ROAR_HAVERT_CLOCK_GETRES  clock_getres  'struct timespec ts; clock_getres((clockid_t)0, &ts)'  $rt -- time.h
+  test_func_defmake ROAR_HAVERT_CLOCK_GETTIME clock_gettime 'struct timespec ts; clock_gettime((clockid_t)0, &ts)' $rt -- time.h
+  test_func_defmake ROAR_HAVERT_CLOCK_SETTIME clock_settime 'struct timespec ts; clock_settime((clockid_t)0, &ts)' $rt -- time.h
+  infotext=''
+  if $funcname_clock_getres
+  then
+   echo "clock_rt=-l$rt" >&4
+  fi
+ fi
+fi
+
+test_const_defmake ROAR_HAVE_CONST_CLOCK_REALTIME CLOCK_REALTIME clockid_t CLOCK_REALTIME -- time.h
+test_const_defmake ROAR_HAVE_CONST_CLOCK_MONOTONIC CLOCK_MONOTONIC clockid_t CLOCK_MONOTONIC -- time.h
+test_const_defmake ROAR_HAVE_CONST_CLOCK_PROCESS_CPUTIME_ID CLOCK_PROCESS_CPUTIME_ID clockid_t CLOCK_PROCESS_CPUTIME_ID -- time.h
+test_const_defmake ROAR_HAVE_CONST_CLOCK_THREAD_CPUTIME_ID CLOCK_THREAD_CPUTIME_ID clockid_t CLOCK_THREAD_CPUTIME_ID -- time.h
+
 
 echo -n 'checking for basic IO calls... '
