Skip to content

Commit

Permalink
Removed various historical Autoconf tests.
Browse files Browse the repository at this point in the history
Removed various historical tests from the Autoconf build system that are
not needed anymore. This is a first step of harmonization with the CMake
build system, further commits will probably follow.
  • Loading branch information
jriesmeier committed Feb 29, 2024
1 parent e833f96 commit d6c091d
Show file tree
Hide file tree
Showing 4 changed files with 340 additions and 1,961 deletions.
310 changes: 0 additions & 310 deletions config/aclocal.m4
Original file line number Diff line number Diff line change
Expand Up @@ -433,143 +433,6 @@ fi
])


dnl AC_CHECK_CLASS_TEMPLATE checks if the C++-Compiler is capable of
dnl using class templates in the easiest form i. e. all methods are
dnl inline, no template methods and no typedefs in the class
dnl
dnl AC_CHECK_CLASS_TEMPLATE
AC_DEFUN(AC_CHECK_CLASS_TEMPLATE,
[AC_MSG_CHECKING([for C++ class template])
AH_TEMPLATE(HAVE_CLASS_TEMPLATE, [Define if your C++ compiler can work with class templates.])
AC_CACHE_VAL(ac_cv_check_class_template,
[AC_TRY_COMPILE_AND_LINK([
template <class T>
class x
{
private:
T a;
public:
void set(T i) { a = i; }
x(T i) { set(i); }
T get() { return a; }
};
],[
int i;
x<int> a(4);
i = a.get();
a.set(18);
i = a.get();
a.set(i-1);
], eval "ac_cv_check_class_template=yes", eval "ac_cv_check_class_template=no")dnl
])dnl
if eval "test \"`echo '$ac_cv_check_class_template'`\" = yes"; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_CLASS_TEMPLATE)
else
AC_MSG_RESULT(no)
fi
])


dnl AC_CHECK_FUNCTION_TEMPLATE checks if the C++-Compiler is capable of
dnl using function templates.
dnl
dnl AC_CHECK_FUNCTION_TEMPLATE
AC_DEFUN(AC_CHECK_FUNCTION_TEMPLATE,
[AC_MSG_CHECKING([for C++ function template])
AH_TEMPLATE(HAVE_FUNCTION_TEMPLATE, [Define if your C++ compiler can work with function templates.])
AC_CACHE_VAL(ac_cv_check_function_template,
[AC_TRY_COMPILE_AND_LINK([
template <class T>
int f(T* a)
{
if (a) return 1;
return 0;
}
],[
int i, a;
i = f(&a);
], eval "ac_cv_check_function_template=yes", eval "ac_cv_check_function_template=no")dnl
])dnl
if eval "test \"`echo '$ac_cv_check_function_template'`\" = yes"; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_FUNCTION_TEMPLATE)
else
AC_MSG_RESULT(no)
fi
])


dnl AC_CHECK_STATIC_TEMPLATE_METHOD checks if the C++-Compiler is capable of
dnl using static methods in template classes
dnl
dnl AC_CHECK_STATIC_TEMPLATE_METHOD
AC_DEFUN(AC_CHECK_STATIC_TEMPLATE_METHOD,
[AC_MSG_CHECKING([for C++ static methods in class templates])
AH_TEMPLATE(HAVE_STATIC_TEMPLATE_METHOD, [Define if your C++ compiler can work with static methods in class templates.])
AC_CACHE_VAL(ac_cv_check_static_template_method,
[AC_TRY_COMPILE_AND_LINK([
void additive(int & i)
{
i++;
}
template <class T, class Function>
class x
{
public:
x() { }
static void do1(Function f, int & a) { f(a); }
static void do2(T b) { T a = b; };
};
],[
int a = 1;
x<int, void (*)(int &)>::do1(additive, a);
x<int, void (*)(int &)>::do2(a);
], eval "ac_cv_check_static_template_method=yes", eval "ac_cv_check_static_template_method=no")dnl
])dnl
if eval "test \"`echo '$ac_cv_check_static_template_method'`\" = yes"; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_STATIC_TEMPLATE_METHOD)
else
AC_MSG_RESULT(no)
fi
])


dnl AC_CHECK_EXPLICIT_TEMPLATE_SPECIALIZATION checks if the C++-Compiler
dnl supports the explicit template specialization syntax, i.e.
dnl template<> int classname<int>::functionname()
dnl
dnl AC_CHECK_EXPLICIT_TEMPLATE_SPECIALIZATION
AC_DEFUN(AC_CHECK_EXPLICIT_TEMPLATE_SPECIALIZATION,
[AC_MSG_CHECKING([for C++ explicit template specialization syntax])
AH_TEMPLATE(HAVE_EXPLICIT_TEMPLATE_SPECIALIZATION, [Define if your C++ compiler supports the explicit template specialization syntax.])
AC_CACHE_VAL(ac_cv_check_explicit_template_specialization,
[AC_TRY_COMPILE([
template<class T>
class X
{
public:
int fn();
};
template<>
int X<int>::fn()
{
return 0;
}
],[X<int> x], eval "ac_cv_check_explicit_template_specialization=yes", eval "ac_cv_check_explicit_template_specialization=no")dnl
])dnl
if eval "test \"`echo '$ac_cv_check_explicit_template_specialization'`\" = yes"; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_EXPLICIT_TEMPLATE_SPECIALIZATION)
else
AC_MSG_RESULT(no)
fi
])


dnl AC_CHECK_GNU_LIBTOOL checks whether libtool is GNU libtool.
dnl This macro requires that 'libtool' exists in the current path,
dnl i.e. AC_CHECK_PROGS(LIBTOOL, libtool, :) should be executed and evaluated
Expand Down Expand Up @@ -863,67 +726,6 @@ esac
])


dnl AC_MY_C_CONST works like the standard script AC_C_CONST
dnl but defines HAVE_C_CONST instead of redefining "const" directly.
dnl
AC_DEFUN(AC_MY_C_CONST,
[AH_TEMPLATE(HAVE_C_CONST, [Define if "const" is supported by the C compiler.])
dnl This message is consistent in form with the other checking messages,
dnl and with the result message.
AC_CACHE_CHECK([for working const], ac_cv_my_c_const,
[AC_TRY_COMPILE(,
changequote(<<, >>)dnl
<<
/* Ultrix mips cc rejects this. */
typedef int charset[2]; const charset x;
/* SunOS 4.1.1 cc rejects this. */
char const *const *ccp;
char **p;
/* NEC SVR4.0.2 mips cc rejects this. */
struct point {int x, y;};
static struct point const zero = {0,0};
/* AIX XL C 1.02.0.0 rejects this.
It does not let you subtract one const X* pointer from another in an arm
of an if-expression whose if-part is not a constant expression */
const char *g = "string";
ccp = &g + (g ? g-g : 0);
/* HPUX 7.0 cc rejects these. */
++ccp;
p = (char**) ccp;
ccp = (char const *const *) p;
{ /* SCO 3.2v4 cc rejects this. */
char *t;
char const *s = 0 ? (char *) 0 : (char const *) 0;
*t++ = 0;
}
{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
int x[] = {25, 17};
const int *foo = &x[0];
++foo;
}
{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
typedef const int *iptr;
iptr p = 0;
++p;
}
{ /* AIX XL C 1.02.0.0 rejects this saying
"k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
struct s { int j; const int *ap[3]; };
struct s *b; b->j = 5;
}
{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
const int foo = 10;
}
>>,
changequote([, ])dnl
ac_cv_my_c_const=yes, ac_cv_my_c_const=no)])
if test $ac_cv_my_c_const = yes; then
AC_DEFINE(HAVE_C_CONST)
fi
])


dnl AC_MY_C_CHAR_UNSIGNED works like the standard script AC_C_CHAR_UNSIGNED
dnl but defines C_CHAR_UNSIGNED instead of __CHAR_UNSIGNED__.
dnl
Expand Down Expand Up @@ -1237,30 +1039,6 @@ fi
])


dnl AC_CHECK_CXX_VOLATILE checks if volatile is a built-in C++ keyword
dnl (which is not the case on older compilers).
dnl
dnl AC_CHECK_CXX_VOLATILE(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
AC_DEFUN(AC_CHECK_CXX_VOLATILE,
[AC_MSG_CHECKING([if volatile is known keyword])
AH_TEMPLATE(HAVE_CXX_VOLATILE, [Define if volatile is a known keyword.])
AC_CACHE_VAL(ac_cv_have_cxx_volatile,
[AC_TRY_COMPILE([],[
volatile int i=0;
],
eval "ac_cv_have_cxx_volatile=yes",
eval "ac_cv_have_cxx_volatile=no")])
if eval "test \"`echo $ac_cv_have_cxx_volatile`\" = yes"; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_CXX_VOLATILE)
ifelse([$1], , :, [$1])
else
AC_MSG_RESULT(no)
ifelse([$2], , , [$2])
fi
])


dnl Available from the GNU Autoconf Macro Archive at:
dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_typename.html
dnl
Expand All @@ -1281,94 +1059,6 @@ fi
])


dnl Available from the GNU Autoconf Macro Archive at:
dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_const_cast.html
dnl
AC_DEFUN([AC_CXX_CONST_CAST],
[AH_TEMPLATE(HAVE_CONST_CAST, [Define if the compiler supports const_cast<>.])
AC_CACHE_CHECK(whether the compiler supports const_cast<>,
ac_cv_cxx_const_cast,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE(,[int x = 0;const int& y = x;int& z = const_cast<int&>(y);return z;],
ac_cv_cxx_const_cast=yes, ac_cv_cxx_const_cast=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_const_cast" = yes; then
AC_DEFINE(HAVE_CONST_CAST)
fi
])


dnl Available from the GNU Autoconf Macro Archive at:
dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_dynamic_cast.html
dnl
AC_DEFUN([AC_CXX_DYNAMIC_CAST],
[AH_TEMPLATE(HAVE_DYNAMIC_CAST, [Define if the compiler supports dynamic_cast<>.])
AC_CACHE_CHECK(whether the compiler supports dynamic_cast<>,
ac_cv_cxx_dynamic_cast,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([#include <typeinfo>
class Base { public : Base () {} virtual void f () = 0;};
class Derived : public Base { public : Derived () {} virtual void f () {} };],[
Derived d; Base& b=d; return dynamic_cast<Derived*>(&b) ? 0 : 1;],
ac_cv_cxx_dynamic_cast=yes, ac_cv_cxx_dynamic_cast=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_dynamic_cast" = yes; then
AC_DEFINE(HAVE_DYNAMIC_CAST)
fi
])


dnl Available from the GNU Autoconf Macro Archive at:
dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_reinterpret_cast.html
dnl
AC_DEFUN([AC_CXX_REINTERPRET_CAST],
[AH_TEMPLATE(HAVE_REINTERPRET_CAST, [Define if the compiler supports reinterpret_cast<>.])
AC_CACHE_CHECK(whether the compiler supports reinterpret_cast<>,
ac_cv_cxx_reinterpret_cast,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([#include <typeinfo>
class Base { public : Base () {} virtual void f () = 0;};
class Derived : public Base { public : Derived () {} virtual void f () {} };
class Unrelated { public : Unrelated () {} };
int g (Unrelated&) { return 0; }],[
Derived d;Base& b=d;Unrelated& e=reinterpret_cast<Unrelated&>(b);return g(e);],
ac_cv_cxx_reinterpret_cast=yes, ac_cv_cxx_reinterpret_cast=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_reinterpret_cast" = yes; then
AC_DEFINE(HAVE_REINTERPRET_CAST)
fi
])


dnl Available from the GNU Autoconf Macro Archive at:
dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_static_cast.html
dnl
AC_DEFUN([AC_CXX_STATIC_CAST],
[AH_TEMPLATE(HAVE_STATIC_CAST, [Define if the compiler supports static_cast<>.])
AC_CACHE_CHECK(whether the compiler supports static_cast<>,
ac_cv_cxx_static_cast,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([#include <typeinfo>
class Base { public : Base () {} virtual void f () = 0; };
class Derived : public Base { public : Derived () {} virtual void f () {} };
int g (Derived&) { return 0; }],[
Derived d; Base& b = d; Derived& s = static_cast<Derived&> (b); return g (s);],
ac_cv_cxx_static_cast=yes, ac_cv_cxx_static_cast=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_static_cast" = yes; then
AC_DEFINE(HAVE_STATIC_CAST)
fi
])


dnl AC_CXX_STD_NOTHROW checks if the compiler supports non-throwing new using
dnl std::nothrow.
dnl
Expand Down
Loading

0 comments on commit d6c091d

Please sign in to comment.