[PATCH] More autoconfisciation
Richard Guenther
rguenth at tat.physik.uni-tuebingen.de
Tue Jan 14 18:04:46 UTC 2003
The attached patch moves the rest of the compiler/library dependend config
to autoconf.
Tested by building and running regtests on ppc-linux with gcc2.95 and
gcc3.2 and on IRIX with CC (doesnt build all tests unfortunately, not
before and not after the autoconf patches).
Ok?
2002Jan14 Richard Guenther <richard.guenther at uni-tuebingen.de>
* configure: hand off more variables to autoconf.
scripts/configure.ac: more tests.
scripts/configure: re-generated.
Index: configure
===================================================================
RCS file: /home/pooma/Repository/r2/configure,v
retrieving revision 1.108
diff -u -r1.108 configure
--- configure 10 Jan 2003 23:38:18 -0000 1.108
+++ configure 14 Jan 2003 18:01:03 -0000
@@ -367,23 +367,7 @@
$pool = 1;
### special characteristics that some architectures have
-$no_stringstream = 0; # if 1, lacks <stringstream> header
-$no_complete_iomanips = 0; # if 1, missing some IO manipulators (left etc)
-$no_templated_friends = 0; # if 1, cannot use template classes as friends
-$no_ostream_iterator_1arg = 0; # if 1, cannot use ostream_iterator w/1 param
-$no_restrict = 0; # if 1, does not allow 'restrict' keyword
-$no_placement_delete = 0; # if 1, does not allow placement delete opers
-$no_dependent_templ_args = 0; # if 1, has problems with dep template args
$small_dim_specializations = 0; # if 1, include extra specializations for <dims
-$no_templated_complex = 0; # if 1, complex is not templated
-$no_std_complex = 0; # if 1, complex is not in std:: namespace
-$o_binary_open_mode = 0; # if 1, O_BINARY is defined
-$no_std_iosbase = 0; # if 1, does not have std::ios_base class
-$inc_sys_stat_h_file_modes = 0; # if 1, include <sys/stat.h> for file modes
-$no_std_min_max = 0; # if 1, no std::min, std::max
-$no_std_iterator = 0; # if 1, iterator traits broken (i.e. Windows)
-$clock_uses_gettimeofday = 0; # if 1, use gettimeofday in Clock
-$clock_uses_clock_gettime = 0; # if 1, use clock_gettime in Clock
### default settings for source code options like data types and bounds checks
$default_float_type = "double";
@@ -847,7 +831,7 @@
{
$cpp = $arghash{$cppnm}[1];
# if no link cmd is specified, use $cpp
- if (scalar @{$arghash{$linknm}} == 0)
+ if (scalar @{$arghash{$linknm}} <= 1)
{
$link = $cpp;
}
@@ -1731,17 +1715,14 @@
add_autoconf_define("POOMA_MISSING_IOMANIPS");
# if the C++ compiler does not allow templated friends, must say so
- add_yesno_define("POOMA_NO_TEMPLATE_FRIENDS",
- $no_templated_friends);
+ add_autoconf_define("POOMA_NO_TEMPLATE_FRIENDS");
# if the C++ compiler does not allow restrict, must say so
- add_yesno_define("POOMA_NO_RESTRICT",
- $no_restrict);
+ add_autoconf_define("POOMA_NO_RESTRICT");
# if the system does not have a version of ostream_iterator that can
# be constructed with one template arg, must use two
- add_yesno_define("POOMA_NO_OSTREAM_ITERATOR_1ARG",
- $no_ostream_iterator_1arg);
+ add_autoconf_define("POOMA_NO_OSTREAM_ITERATOR_1ARG");
# if the compiler does not allow definitions of placement delete operations
add_autoconf_define("POOMA_NO_PLACEMENT_DELETE");
@@ -1754,38 +1735,44 @@
# on others (e.g., template<int D1, int D2=D1, ...>, must say so
add_autoconf_define("POOMA_NO_DEPENDENT_TEMPLATE_ARGS");
+ # if the C++ compiler does not allow defaults to template parameters
+ # for template functions to be specified, must say so
+ add_autoconf_define("POOMA_NO_TEMPLATEFUNC_DEFAULTARGS");
+
# if the C++ library does not have templated complex number class, say so
add_autoconf_define("POOMA_NO_TEMPLATED_COMPLEX");
# if the C++ library does not have complex number class in std::, say so
add_autoconf_define("POOMA_NO_STD_COMPLEX");
- # if the C++ library has O_BINARY defined
- add_yesno_define("POOMA_HAS_O_BINARY_OPEN_MODE",
- $o_binary_open_mode);
+# # if the C++ library has O_BINARY defined
+# add_yesno_define("POOMA_HAS_O_BINARY_OPEN_MODE",
+# $o_binary_open_mode);
+
+ # if the C++ library does not have the ios header, say so
+ add_autoconf_define("POOMA_NO_IOS_HEADER");
# if the C++ library does not have ios_base class in std::, say so
add_autoconf_define("POOMA_NO_STD_IOSBASE");
- # if must include <sys/stat.h> for POSIX file modes, say so
- add_yesno_define("POOMA_INC_SYS_STAT_H_FOR_FILE_MODES",
- $inc_sys_stat_h_file_modes);
+ # if the C++ library does not have std::ios_base::fmtflags type, say so
+ add_autoconf_define("POOMA_NO_IOSBASE_FMTFLAGS");
+
+# # if must include <sys/stat.h> for POSIX file modes, say so
+# add_yesno_define("POOMA_INC_SYS_STAT_H_FOR_FILE_MODES",
+# $inc_sys_stat_h_file_modes);
# if the C++ library does not have std::min, std::max, etc.
- add_yesno_define("POOMA_NO_STD_MIN_MAX",
- $no_std_min_max);
+ add_autoconf_define("POOMA_NO_STD_MIN_MAX");
# use gettimeofday for Clock
- add_yesno_define("POOMA_CLOCK_USES_GETTIMEOFDAY",
- $clock_uses_gettimeofday);
+ add_autoconf_define("POOMA_CLOCK_USES_GETTIMEOFDAY");
# use clock_gettime for Clock
- add_yesno_define("POOMA_CLOCK_USES_CLOCK_GETTIME",
- $clock_uses_clock_gettime);
+ add_autoconf_define("POOMA_CLOCK_USES_CLOCK_GETTIME");
# if the C++ library has a nonstandard iterator or iterator_traits
- add_yesno_define("POOMA_NONSTANDARD_ITERATOR",
- $no_std_iterator);
+ add_autoconf_define("POOMA_NONSTANDARD_ITERATOR");
}
@@ -1972,10 +1959,10 @@
print FSUITE "LD = $link\n";
print FSUITE "\n";
print FSUITE "### flags for applications\n";
- print FSUITE "CXX_OPT_LIB_ARGS = $cppargs $cppshare $cppopt_lib\n";
- print FSUITE "CXX_DBG_LIB_ARGS = $cppargs $cppshare $cppdbg_lib\n";
- print FSUITE "CXX_OPT_APP_ARGS = $cppargs $cppopt_app\n";
- print FSUITE "CXX_DBG_APP_ARGS = $cppargs $cppdbg_app\n";
+ print FSUITE "CXX_OPT_LIB_ARGS = \@cppargs\@ $cppshare $cppopt_lib\n";
+ print FSUITE "CXX_DBG_LIB_ARGS = \@cppargs\@ $cppshare $cppdbg_lib\n";
+ print FSUITE "CXX_OPT_APP_ARGS = \@cppargs\@ $cppopt_app\n";
+ print FSUITE "CXX_DBG_APP_ARGS = \@cppargs\@ $cppdbg_app\n";
print FSUITE "\n";
print FSUITE "C_OPT_LIB_ARGS = $cargs $cshare $copt_lib\n";
print FSUITE "C_DBG_LIB_ARGS = $cargs $cshare $cdbg_lib\n";
@@ -2333,8 +2320,8 @@
print MFILE "LD_PARALLEL = 1\n";
print MFILE "\n";
print MFILE "### flags for applications\n";
- print MFILE "POOMA_CXX_OPT_ARGS = $cppargs $cppopt_app\n";
- print MFILE "POOMA_CXX_DBG_ARGS = $cppargs $cppdbg_app\n";
+ print MFILE "POOMA_CXX_OPT_ARGS = \@cppargs\@ $cppopt_app\n";
+ print MFILE "POOMA_CXX_DBG_ARGS = \@cppargs\@ $cppdbg_app\n";
print MFILE "\n";
print MFILE "POOMA_CC_OPT_ARGS = $cargs $copt_app\n";
print MFILE "POOMA_CC_DBG_ARGS = $cargs $cdbg_app\n";
Index: scripts/configure.ac
===================================================================
RCS file: /home/pooma/Repository/r2/scripts/configure.ac,v
retrieving revision 1.1
diff -u -r1.1 configure.ac
--- scripts/configure.ac 10 Jan 2003 23:38:18 -0000 1.1
+++ scripts/configure.ac 14 Jan 2003 18:01:05 -0000
@@ -185,4 +185,148 @@
])
AC_SUBST(POOMA_NO_IOSBASE_FMTFLAGS)
+dnl
+dnl check for restrict support and form
+dnl
+AC_MSG_CHECKING([wether we have restrict support])
+acx_cv_c_restrict=unsupported
+for acx_kw in restrict __restrict__ __restrict; do
+ AC_TRY_COMPILE([], [float * $acx_kw x;], [acx_cv_c_restrict=$acx_kw; break])
+done
+if test "$acx_cv_c_restrict" = "unsupported"; then
+ POOMA_NO_RESTRICT=POOMA_YES
+ AC_MSG_RESULT([no])
+else
+ POOMA_NO_RESTRICT=POOMA_NO
+ AC_MSG_RESULT([$acx_cv_c_restrict])
+ if test "$acx_cv_c_restrict" != "restrict"; then
+ CXXFLAGS="$CXXFLAGS -Drestrict=$acx_cv_c_restrict"
+ fi
+fi
+AC_SUBST(POOMA_NO_RESTRICT)
+
+dnl
+dnl check for clock_gettime/gettimeofday
+dnl
+AC_MSG_CHECKING([for clock method to use])
+POOMA_CLOCK_USES_CLOCK_GETTIME=POOMA_NO
+POOMA_CLOCK_USES_GETTIMEOFDAY=POOMA_NO
+AC_TRY_LINK([
+#include <time.h>
+], [
+ timespec ts;
+#if defined(CLOCK_SGI_CYCLE)
+ clock_gettime(CLOCK_SGI_CYCLE, &ts);
+#else
+ clock_gettime(CLOCK_REALTIME, &ts);
+#endif
+], [
+AC_MSG_RESULT([clock_gettime])
+POOMA_CLOCK_USES_CLOCK_GETTIME=POOMA_YES
+], [
+ AC_TRY_LINK([
+ #include <sys/time.h>
+ #include <time.h>
+ ], [
+ timeval tv;
+ gettimeofday(&tv, 0);
+ ], [
+ AC_MSG_RESULT([gettimeofday])
+ POOMA_CLOCK_USES_GETTIMEOFDAY=POOMA_YES
+ ], [
+ AC_MSG_RESULT([clock])
+ ])
+])
+AC_SUBST(POOMA_CLOCK_USES_CLOCK_GETTIME)
+AC_SUBST(POOMA_CLOCK_USES_GETTIMEOFDAY)
+
+dnl
+dnl Check for support of templated friends.
+dnl
+AC_MSG_CHECKING([for support of templated firends])
+AC_TRY_COMPILE([
+template <class X>
+class A {
+ void bar();
+public:
+ template <class Y>
+ void foo(const A<Y>& a) {
+ a.bar();
+ }
+ template <class Y>
+ friend class A;
+};
+], [
+ A<int> a;
+ A<double> b;
+ a.foo(b);
+], [
+AC_MSG_RESULT([yes])
+POOMA_NO_TEMPLATE_FRIENDS=POOMA_NO
+], [
+AC_MSG_RESULT([no])
+POOMA_NO_TEMPLATE_FRIENDS=POOMA_YES
+])
+AC_SUBST(POOMA_NO_TEMPLATE_FRIENDS)
+
+dnl
+dnl Check for std::ostream_iterator.
+dnl
+AC_MSG_CHECKING([numer of template arguments of std::ostream_iterator])
+AC_TRY_COMPILE([
+#include <iterator>
+#include <iostream>
+], [
+ std::ostream_iterator<double> i(std::cout);
+], [
+AC_MSG_RESULT([1])
+POOMA_NO_OSTREAM_ITERATOR_1ARG=POOMA_NO
+], [
+AC_MSG_RESULT([2])
+POOMA_NO_OSTREAM_ITERATOR_1ARG=POOMA_YES
+])
+AC_SUBST(POOMA_NO_OSTREAM_ITERATOR_1ARG)
+
+dnl
+dnl Check for std::min(), std::max().
+dnl
+AC_MSG_CHECKING([for std::min(), std::max()])
+AC_TRY_LINK([
+#include <algorithm>
+], [
+ int a, b, c;
+ a = std::min(b, c);
+ b = std::max(a, c);
+], [
+AC_MSG_RESULT([yes])
+POOMA_NO_STD_MIN_MAX=POOMA_NO
+], [
+AC_MSG_RESULT([no])
+POOMA_NO_STD_MIN_MAX=POOMA_YES
+])
+AC_SUBST(POOMA_NO_STD_MIN_MAX)
+
+dnl
+dnl Check for standard conforming iterators.
+dnl
+AC_MSG_CHECKING([for standard conforming iterators])
+AC_TRY_LINK([
+#include <iterator>
+#include <vector>
+], [
+ std::vector<int> v;
+ typedef std::iterator_traits<std::vector<int>::const_iterator>::difference_type Diff_t;
+ std::reverse_iterator<std::vector<int>::iterator> ri(v.end());
+], [
+AC_MSG_RESULT([yes])
+POOMA_NONSTANDARD_ITERATOR=POOMA_NO
+], [
+AC_MSG_RESULT([no])
+POOMA_NONSTANDARD_ITERATOR=POOMA_YES
+])
+AC_SUBST(POOMA_NONSTANDARD_ITERATOR)
+
+cppargs=$CXXFLAGS
+AC_SUBST(cppargs)
+
AC_OUTPUT(PoomaConfiguration.h suite.mk Makefile.pooma)
More information about the pooma-dev
mailing list