From: Wolfgang Bangerth Date: Wed, 14 Jun 2000 11:49:00 +0000 (+0000) Subject: Configure for the proper declaration of the getrusage function. X-Git-Tag: v8.0.0~20400 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e30e106683d1f70402d0dbc08e6941bac3507d1;p=dealii.git Configure for the proper declaration of the getrusage function. git-svn-id: https://svn.dealii.org/trunk@3012 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/aclocal.m4 b/deal.II/aclocal.m4 index 4498dce30b..278763568e 100644 --- a/deal.II/aclocal.m4 +++ b/deal.II/aclocal.m4 @@ -76,3 +76,34 @@ AC_DEFUN(DEAL_II_GET_THREAD_FLAGS, dnl done AC_MSG_RESULT("$thread_flag") ]) + + + + +dnl On SunOS 4.x, the `getrusage' function exists, but is not declared +dnl in the respective header file `resource.h', as one would think when +dnl reading the man pages. Then we have to declare this function +dnl ourselves... +AC_DEFUN(DEAL_II_CHECK_GETRUSAGE, dnl + AC_MSG_CHECKING(whether getrusage is properly declared) + AC_REQUIRE([AC_LANG_CPLUSPLUS]) + AC_TRY_COMPILE( + [ +#include + ], + [ + rusage *ru; + getrusage(0,ru); + ], + [ + AC_MSG_RESULT("yes") + ], + [ + AC_MSG_RESULT("no") + CXXFLAGSG="$CXXFLAGSG -DNO_HAVE_GETRUSAGE" + CXXFLAGSO="$CXXFLAGSO -DNO_HAVE_GETRUSAGE" + ]) +) + + + diff --git a/deal.II/base/source/timer.cc b/deal.II/base/source/timer.cc index 0482171de2..25e93882ca 100644 --- a/deal.II/base/source/timer.cc +++ b/deal.II/base/source/timer.cc @@ -20,6 +20,18 @@ #include #include + +// on SunOS 4.x, getrusage is stated in the man pages and exists, but +// is not declared in resource.h. declare it ourselves +#ifdef NO_HAVE_GETRUSAGE +extern "C" { + int getrusage(int who, struct rusage* ru); +} +#endif + + + + Timer::Timer() : cumulative_time (0.) { @@ -27,6 +39,7 @@ Timer::Timer() } + void Timer::start () { running = true; @@ -36,6 +49,7 @@ void Timer::start () } + double Timer::stop () { if (running) @@ -50,6 +64,7 @@ double Timer::stop () } + double Timer::operator() () const { if (running) @@ -65,6 +80,7 @@ double Timer::operator() () const } + void Timer::reset () { cumulative_time = 0.; diff --git a/deal.II/configure b/deal.II/configure index 48a44a580d..5a6e883471 100755 --- a/deal.II/configure +++ b/deal.II/configure @@ -1,5 +1,9 @@ #! /bin/sh + + + + # Guess values for system-dependent variables and create Makefiles. # Generated automatically using autoconf version 2.13 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. @@ -579,7 +583,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:583: checking host system type" >&5 +echo "configure:587: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -600,7 +604,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:604: checking target system type" >&5 +echo "configure:608: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -618,7 +622,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:622: checking build system type" >&5 +echo "configure:626: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -657,7 +661,7 @@ cross_compiling=$ac_cv_prog_cxx_cross # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:661: checking for $ac_word" >&5 +echo "configure:665: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -687,7 +691,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:691: checking for $ac_word" >&5 +echo "configure:695: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -738,7 +742,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:742: checking for $ac_word" >&5 +echo "configure:746: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -770,7 +774,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:774: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:778: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -781,12 +785,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 785 "configure" +#line 789 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:790: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:794: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -812,12 +816,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:816: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:820: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:821: checking whether we are using GNU C" >&5 +echo "configure:825: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -826,7 +830,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:830: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:834: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -845,7 +849,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:849: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:853: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -879,7 +883,7 @@ fi # Extract the first word of "$CC", so it can be a program name with args. set dummy $CC; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:883: checking for $ac_word" >&5 +echo "configure:887: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -918,7 +922,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:922: checking for $ac_word" >&5 +echo "configure:926: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -950,7 +954,7 @@ test -n "$CXX" || CXX="gcc" echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:954: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 +echo "configure:958: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 ac_ext=C # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -961,12 +965,12 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext << EOF -#line 965 "configure" +#line 969 "configure" #include "confdefs.h" int main(){return(0);} EOF -if { (eval echo configure:970: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:974: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cxx_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -992,12 +996,12 @@ if test $ac_cv_prog_cxx_works = no; then { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:996: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1000: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 cross_compiling=$ac_cv_prog_cxx_cross echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 -echo "configure:1001: checking whether we are using GNU C++" >&5 +echo "configure:1005: checking whether we are using GNU C++" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1006,7 +1010,7 @@ else yes; #endif EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1010: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1014: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gxx=yes else ac_cv_prog_gxx=no @@ -1025,7 +1029,7 @@ ac_test_CXXFLAGS="${CXXFLAGS+set}" ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS= echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 -echo "configure:1029: checking whether ${CXX-g++} accepts -g" >&5 +echo "configure:1033: checking whether ${CXX-g++} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1059,7 +1063,7 @@ fi # Extract the first word of "$CXX", so it can be a program name with args. set dummy $CXX; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1063: checking for $ac_word" >&5 +echo "configure:1067: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_CXX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1118,7 +1122,7 @@ fi # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1122: checking for $ac_word" >&5 +echo "configure:1126: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1203,19 +1207,19 @@ fi if test $enablemultithreading = yes ; then echo $ac_n "checking for platform specific thread flags""... $ac_c" 1>&6 -echo "configure:1207: checking for platform specific thread flags" >&5 +echo "configure:1211: checking for platform specific thread flags" >&5 for i in threads mt pthread pthreads mthreads Kthread kthread; do CXXFLAGS="$CXXFLAGSG -$i" cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1223: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* thread_flag=$i @@ -1234,10 +1238,10 @@ rm -f conftest* echo $ac_n "checking for platform specific multi-threading defines""... $ac_c" 1>&6 -echo "configure:1238: checking for platform specific multi-threading defines" >&5 +echo "configure:1242: checking for platform specific multi-threading defines" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1259: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t"""not necessary"" 1>&6 @@ -1285,7 +1289,7 @@ fi if test $withmultithreading != no ; then echo $ac_n "checking for ACE""... $ac_c" 1>&6 -echo "configure:1289: checking for ACE" >&5 +echo "configure:1293: checking for ACE" >&5 if test -d $withmultithreading ; then echo "$ac_t""found" 1>&6 else @@ -1371,7 +1375,7 @@ else fi echo $ac_n "checking for kdoc""... $ac_c" 1>&6 -echo "configure:1375: checking for kdoc" >&5 +echo "configure:1379: checking for kdoc" >&5 if test -r $kdocdir/kdoc ; then echo "$ac_t""found" 1>&6 else @@ -1400,7 +1404,7 @@ if test "$docxx" = to-be-determined ; then # Extract the first word of ""doc++"", so it can be a program name with args. set dummy "doc++"; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1404: checking for $ac_word" >&5 +echo "configure:1408: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_docxx'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1434,7 +1438,7 @@ fi else echo $ac_n "checking for doc++""... $ac_c" 1>&6 -echo "configure:1438: checking for doc++" >&5 +echo "configure:1442: checking for doc++" >&5 if test -x "$docxx" ; then echo "$ac_t""yes" 1>&6 else @@ -1448,6 +1452,47 @@ fi + echo $ac_n "checking whether getrusage is properly declared""... $ac_c" 1>&6 +echo "configure:1457: checking whether getrusage is properly declared" >&5 + ac_ext=C +# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cxx_cross + + + cat > conftest.$ac_ext < + +int main() { + + rusage *ru; + getrusage(0,ru); + +; return 0; } +EOF +if { (eval echo configure:1479: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + + echo "$ac_t"""yes"" 1>&6 + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + + echo "$ac_t"""no"" 1>&6 + CXXFLAGSG="$CXXFLAGSG -DNO_HAVE_GETRUSAGE" + CXXFLAGSO="$CXXFLAGSO -DNO_HAVE_GETRUSAGE" + +fi +rm -f conftest* + + case "$target" in alpha*-linux*) CXXFLAGSG="$CXXFLAGSG -DNO_THROW" @@ -1462,17 +1507,17 @@ esac echo $ac_n "checking for consistency of CXXFLAGSG flags""... $ac_c" 1>&6 -echo "configure:1466: checking for consistency of CXXFLAGSG flags" >&5 +echo "configure:1511: checking for consistency of CXXFLAGSG flags" >&5 CXXFLAGS="$CXXFLAGSG" cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1521: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 @@ -1489,17 +1534,17 @@ fi rm -f conftest* echo $ac_n "checking for consistency of CXXFLAGSO flags""... $ac_c" 1>&6 -echo "configure:1493: checking for consistency of CXXFLAGSO flags" >&5 +echo "configure:1538: checking for consistency of CXXFLAGSO flags" >&5 CXXFLAGS="$CXXFLAGSO" cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1548: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 diff --git a/deal.II/configure.in b/deal.II/configure.in index e8ac7576bb..affa2380c6 100644 --- a/deal.II/configure.in +++ b/deal.II/configure.in @@ -299,9 +299,11 @@ AC_SUBST(docxx) dnl ------------------------------------------------------------- -dnl Check for specific machine types +dnl Check for specific machine types and other checks dnl ------------------------------------------------------------- +DEAL_II_CHECK_GETRUSAGE + case "$target" in dnl On Alpha, there was an internal compiler error in exceptions.h. dnl Disable "throw" for this platform