Blame acinclude.m4

Packit 8a864e
dnl OJ_CHECK_SIZEOF(TYPE, HEADER [, CROSS-SIZE])
Packit 8a864e
AC_DEFUN([OJ_CHECK_SIZEOF],
Packit 8a864e
[changequote(<<, >>)dnl
Packit 8a864e
dnl The name to #define.
Packit 8a864e
define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
Packit 8a864e
dnl The cache variable name.
Packit 8a864e
define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
Packit 8a864e
changequote([, ])dnl
Packit 8a864e
AC_MSG_CHECKING(size of $1)
Packit 8a864e
AC_CACHE_VAL(AC_CV_NAME,
Packit 8a864e
[AC_TRY_RUN([#include <stdio.h>
Packit 8a864e
#include <$2>
Packit 8a864e
main()
Packit 8a864e
{
Packit 8a864e
  FILE *f=fopen("conftestval", "w");
Packit 8a864e
  if (!f) exit(1);
Packit 8a864e
  fprintf(f, "%d\n", sizeof($1));
Packit 8a864e
  exit(0);
Packit 8a864e
}], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$3] , , AC_CV_NAME=$3))])dnl
Packit 8a864e
AC_MSG_RESULT($AC_CV_NAME)
Packit 8a864e
AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
Packit 8a864e
undefine([AC_TYPE_NAME])dnl
Packit 8a864e
undefine([AC_CV_NAME])dnl
Packit 8a864e
])
Packit 8a864e
Packit 8a864e
Packit 8a864e
dnl @synopsis AC_CXX_PLACEMENT_OPERATOR_DELETE
Packit 8a864e
dnl
Packit 8a864e
dnl If the compiler supports void delete(size_t,void*), define
Packit 8a864e
dnl HAVE_PLACEMENT_OPERATOR_DELETE.
Packit 8a864e
dnl
Packit 8a864e
dnl @author Matthias Clasen
Packit 8a864e
dnl
Packit 8a864e
AC_DEFUN([AC_CXX_PLACEMENT_OPERATOR_DELETE],
Packit 8a864e
[AC_CACHE_CHECK(whether the compiler supports placement operator delete,
Packit 8a864e
ac_cv_cxx_placement_operator_delete,
Packit 8a864e
[AC_LANG_SAVE
Packit 8a864e
 AC_LANG_CPLUSPLUS
Packit 8a864e
 AC_TRY_COMPILE([#include <stddef.h>],
Packit 8a864e
  [class Thing {
Packit 8a864e
   public:
Packit 8a864e
    Thing() { };
Packit 8a864e
    void *operator new(size_t,bool) { };
Packit 8a864e
    void operator delete(size_t,void*) { };
Packit 8a864e
   };],
Packit 8a864e
   ac_cv_cxx_placement_operator_delete=yes, 
Packit 8a864e
   ac_cv_cxx_placement_operator_delete=no)
Packit 8a864e
 AC_LANG_RESTORE
Packit 8a864e
])
Packit 8a864e
if test "$ac_cv_cxx_placement_operator_delete" = yes; then
Packit 8a864e
  AC_DEFINE(HAVE_PLACEMENT_OPERATOR_DELETE,,
Packit 8a864e
            [define if the compiler supports placement operator delete])
Packit 8a864e
fi
Packit 8a864e
])
Packit 8a864e
Packit 8a864e
Packit 8a864e
dnl @synopsis AC_CXX_BOOL
Packit 8a864e
dnl
Packit 8a864e
dnl If the compiler recognizes bool as a separate built-in type,
Packit 8a864e
dnl define HAVE_BOOL. Note that a typedef is not a separate
Packit 8a864e
dnl type since you cannot overload a function such that it accepts either
Packit 8a864e
dnl the basic type or the typedef.
Packit 8a864e
dnl
Packit 8a864e
dnl @version $Id: acinclude.m4,v 1.9.2.1 2004/06/30 13:16:25 keichwa Exp $
Packit 8a864e
dnl @author Luc Maisonobe
Packit 8a864e
dnl
Packit 8a864e
AC_DEFUN([AC_CXX_BOOL],
Packit 8a864e
[AC_CACHE_CHECK(whether the compiler recognizes bool as a built-in type,
Packit 8a864e
ac_cv_cxx_bool,
Packit 8a864e
[AC_LANG_SAVE
Packit 8a864e
 AC_LANG_CPLUSPLUS
Packit 8a864e
 AC_TRY_COMPILE([
Packit 8a864e
int f(int  x){return 1;}
Packit 8a864e
int f(char x){return 1;}
Packit 8a864e
int f(bool x){return 1;}
Packit 8a864e
],[bool b = true; return f(b);],
Packit 8a864e
 ac_cv_cxx_bool=yes, ac_cv_cxx_bool=no)
Packit 8a864e
 AC_LANG_RESTORE
Packit 8a864e
])
Packit 8a864e
if test "$ac_cv_cxx_bool" = yes; then
Packit 8a864e
  AC_DEFINE(HAVE_BOOL,,[define if bool is a built-in type])
Packit 8a864e
fi
Packit 8a864e
])
Packit 8a864e
Packit 8a864e
dnl @synopsis AC_CXX_TYPENAME
Packit 8a864e
dnl
Packit 8a864e
dnl If the compiler recognizes the typename keyword, define HAVE_TYPENAME.
Packit 8a864e
dnl
Packit 8a864e
dnl @version $Id: acinclude.m4,v 1.9.2.1 2004/06/30 13:16:25 keichwa Exp $
Packit 8a864e
dnl @author Luc Maisonobe
Packit 8a864e
dnl
Packit 8a864e
AC_DEFUN([AC_CXX_TYPENAME],
Packit 8a864e
[AC_CACHE_CHECK(whether the compiler recognizes typename,
Packit 8a864e
ac_cv_cxx_typename,
Packit 8a864e
[AC_LANG_SAVE
Packit 8a864e
 AC_LANG_CPLUSPLUS
Packit 8a864e
 AC_TRY_COMPILE([template<typename T>class X {public:X(){}};],
Packit 8a864e
[X<float> z; return 0;],
Packit 8a864e
 ac_cv_cxx_typename=yes, ac_cv_cxx_typename=no)
Packit 8a864e
 AC_LANG_RESTORE
Packit 8a864e
])
Packit 8a864e
if test "$ac_cv_cxx_typename" = yes; then
Packit 8a864e
  AC_DEFINE(HAVE_TYPENAME,,[define if the compiler recognizes typename])
Packit 8a864e
fi
Packit 8a864e
])
Packit 8a864e
Packit 8a864e
dnl @synopsis AC_CXX_NEW_FOR_SCOPING
Packit 8a864e
dnl
Packit 8a864e
dnl If the compiler accepts the new for scoping rules (the scope of a
Packit 8a864e
dnl variable declared inside the parentheses is restricted to the
Packit 8a864e
dnl for-body), define HAVE_NEW_FOR_SCOPING.
Packit 8a864e
dnl
Packit 8a864e
dnl @version $Id: acinclude.m4,v 1.9.2.1 2004/06/30 13:16:25 keichwa Exp $
Packit 8a864e
dnl @author Luc Maisonobe
Packit 8a864e
dnl
Packit 8a864e
AC_DEFUN([AC_CXX_NEW_FOR_SCOPING],
Packit 8a864e
[AC_CACHE_CHECK(whether the compiler accepts the new for scoping rules,
Packit 8a864e
ac_cv_cxx_new_for_scoping,
Packit 8a864e
[AC_LANG_SAVE
Packit 8a864e
 AC_LANG_CPLUSPLUS
Packit 8a864e
 AC_TRY_COMPILE(,[
Packit 8a864e
  int z = 0;
Packit 8a864e
  for (int i = 0; i < 10; ++i)
Packit 8a864e
    z = z + i;
Packit 8a864e
  for (int i = 0; i < 10; ++i)
Packit 8a864e
    z = z - i;
Packit 8a864e
  return z;],
Packit 8a864e
 ac_cv_cxx_new_for_scoping=yes, ac_cv_cxx_new_for_scoping=no)
Packit 8a864e
 AC_LANG_RESTORE
Packit 8a864e
])
Packit 8a864e
if test "$ac_cv_cxx_new_for_scoping" = yes; then
Packit 8a864e
  AC_DEFINE(HAVE_NEW_FOR_SCOPING,,[define if the compiler accepts the new for scoping rules])
Packit 8a864e
fi
Packit 8a864e
])
Packit 8a864e
Packit 8a864e
Packit 8a864e
dnl @synopsis AC_CXX_DYNAMIC_CAST
Packit 8a864e
dnl
Packit 8a864e
dnl If the compiler supports dynamic_cast<>, define HAVE_DYNAMIC_CAST.
Packit 8a864e
dnl
Packit 8a864e
dnl @version $Id: acinclude.m4,v 1.9.2.1 2004/06/30 13:16:25 keichwa Exp $
Packit 8a864e
dnl @author Luc Maisonobe
Packit 8a864e
dnl
Packit 8a864e
AC_DEFUN([AC_CXX_DYNAMIC_CAST],
Packit 8a864e
[AC_CACHE_CHECK(whether the compiler supports dynamic_cast<>,
Packit 8a864e
ac_cv_cxx_dynamic_cast,
Packit 8a864e
[AC_LANG_SAVE
Packit 8a864e
 AC_LANG_CPLUSPLUS
Packit 8a864e
 AC_TRY_COMPILE([#include <typeinfo>
Packit 8a864e
class Base { public : Base () {} virtual void f () = 0;};
Packit 8a864e
class Derived : public Base { public : Derived () {} virtual void f () {} };],[
Packit 8a864e
Derived d; Base& b=d; return dynamic_cast<Derived*>(&b) ? 0 : 1;],
Packit 8a864e
 ac_cv_cxx_dynamic_cast=yes, ac_cv_cxx_dynamic_cast=no)
Packit 8a864e
 AC_LANG_RESTORE
Packit 8a864e
])
Packit 8a864e
if test "$ac_cv_cxx_dynamic_cast" = yes; then
Packit 8a864e
  AC_DEFINE(HAVE_DYNAMIC_CAST,,[define if the compiler supports dynamic_cast<>])
Packit 8a864e
fi
Packit 8a864e
])
Packit 8a864e
Packit 8a864e
Packit 8a864e
dnl @synopsis AC_CXX_NAMESPACES
Packit 8a864e
dnl
Packit 8a864e
dnl If the compiler can prevent names clashes using namespaces, define
Packit 8a864e
dnl HAVE_NAMESPACES.
Packit 8a864e
dnl
Packit 8a864e
dnl @version $Id: acinclude.m4,v 1.9.2.1 2004/06/30 13:16:25 keichwa Exp $
Packit 8a864e
dnl @author Luc Maisonobe
Packit 8a864e
dnl
Packit 8a864e
AC_DEFUN([AC_CXX_NAMESPACES],
Packit 8a864e
[AC_CACHE_CHECK(whether the compiler implements namespaces,
Packit 8a864e
ac_cv_cxx_namespaces,
Packit 8a864e
[AC_LANG_SAVE
Packit 8a864e
 AC_LANG_CPLUSPLUS
Packit 8a864e
 AC_TRY_COMPILE([namespace Outer { namespace Inner { int i = 0; }}],
Packit 8a864e
                [using namespace Outer::Inner; return i;],
Packit 8a864e
 ac_cv_cxx_namespaces=yes, ac_cv_cxx_namespaces=no)
Packit 8a864e
 AC_LANG_RESTORE
Packit 8a864e
])
Packit 8a864e
if test "$ac_cv_cxx_namespaces" = yes; then
Packit 8a864e
  AC_DEFINE(HAVE_NAMESPACES,,[define if the compiler implements namespaces])
Packit 8a864e
fi
Packit 8a864e
])
Packit 8a864e
Packit 8a864e
Packit 8a864e
dnl @synopsis ACX_CHECK_PATHNAME_STYLE_DOS
Packit 8a864e
dnl
Packit 8a864e
dnl Check if host OS uses DOS-style pathnames. This includes the use
Packit 8a864e
dnl of drive letters and backslashes. Under DOS, Windows, and OS/2,
Packit 8a864e
dnl defines HAVE_PATHNAME_STYLE_DOS and PATH_SEPARATOR to ';'.
Packit 8a864e
dnl Otherwise, defines PATH_SEPARATOR to ':'.
Packit 8a864e
dnl
Packit 8a864e
dnl Use for enabling code to handle drive letters, backslashes in
Packit 8a864e
dnl filenames and semicolons in the PATH.
Packit 8a864e
dnl
Packit 8a864e
dnl @version $Id: acinclude.m4,v 1.9.2.1 2004/06/30 13:16:25 keichwa Exp $
Packit 8a864e
dnl @author Mark Elbrecht <snowball3@bigfoot.com>
Packit 8a864e
dnl
Packit 8a864e
AC_DEFUN([ACX_CHECK_PATHNAME_STYLE_DOS],
Packit 8a864e
[AC_MSG_CHECKING(for Windows and DOS and OS/2 style pathnames)
Packit 8a864e
AC_CACHE_VAL(acx_cv_pathname_style_dos,
Packit 8a864e
[AC_REQUIRE([AC_CANONICAL_HOST])
Packit 8a864e
Packit 8a864e
acx_cv_pathname_style_dos="no"
Packit 8a864e
case ${host_os} in
Packit 8a864e
  *djgpp | *mingw32 | *emx*) acx_cv_pathname_style_dos="yes" ;;
Packit 8a864e
esac
Packit 8a864e
])
Packit 8a864e
AC_MSG_RESULT($acx_cv_pathname_style_dos)
Packit 8a864e
if test $acx_cv_pathname_style_dos = "yes"; then
Packit 8a864e
  AC_DEFINE(HAVE_PATHNAME_STYLE_DOS)
Packit 8a864e
  AC_DEFINE(PATH_SEPARATOR, ';')
Packit 8a864e
else
Packit 8a864e
  AC_DEFINE(PATH_SEPARATOR, ':')
Packit 8a864e
fi
Packit 8a864e
])
Packit 8a864e
Packit 8a864e
Packit 8a864e
dnl @synopsis AC_CXX_EXPLICIT_INSTANTIATIONS
Packit 8a864e
dnl
Packit 8a864e
dnl If the C++ compiler supports explicit instanciations syntax,
Packit 8a864e
dnl define HAVE_INSTANTIATIONS.
Packit 8a864e
dnl
Packit 8a864e
dnl @version $Id: acinclude.m4,v 1.9.2.1 2004/06/30 13:16:25 keichwa Exp $
Packit 8a864e
dnl @author Luc Maisonobe
Packit 8a864e
dnl
Packit 8a864e
AC_DEFUN([AC_CXX_EXPLICIT_INSTANTIATIONS],
Packit 8a864e
[AC_CACHE_CHECK(whether the compiler supports explicit instantiations,
Packit 8a864e
ac_cv_cxx_explinst,
Packit 8a864e
[AC_LANG_SAVE
Packit 8a864e
 AC_LANG_CPLUSPLUS
Packit 8a864e
 AC_TRY_COMPILE([template <class T> class A { T t; }; template class A<int>;],
Packit 8a864e
 [], ac_cv_cxx_explinst=yes, ac_cv_cxx_explinst=no)
Packit 8a864e
 AC_LANG_RESTORE
Packit 8a864e
])
Packit 8a864e
if test "$ac_cv_cxx_explinst" = yes; then
Packit 8a864e
  AC_DEFINE(HAVE_INSTANTIATIONS,,
Packit 8a864e
            [define if the compiler supports explicit instantiations])
Packit 8a864e
fi
Packit 8a864e
])
Packit 8a864e
Packit 8a864e
AC_DEFUN([AC_DEFINE_DIR], [ 
Packit 8a864e
  ac_expanded=`( 
Packit 8a864e
    test "x$prefix" = xNONE && prefix="$ac_default_prefix" 
Packit 8a864e
    test "x$exec_prefix" = xNONE && exec_prefix="${prefix}" 
Packit 8a864e
    eval echo \""[$]$2"\" 
Packit 8a864e
  )` 
Packit 8a864e
  ifelse($3, , 
Packit 8a864e
    AC_DEFINE_UNQUOTED($1, "$ac_expanded"), 
Packit 8a864e
    AC_DEFINE_UNQUOTED($1, "$ac_expanded", $3)) 
Packit 8a864e
]) 
Packit 8a864e
Packit 8a864e
dnl @synopsis AC_CXX_MUTABLE
Packit 8a864e
dnl
Packit 8a864e
dnl If the compiler allows modifying class data members flagged with
Packit 8a864e
dnl the mutable keyword even in const objects (for example in the
Packit 8a864e
dnl body of a const member function), define HAVE_MUTABLE.
Packit 8a864e
dnl
Packit 8a864e
dnl @version $Id: acinclude.m4,v 1.9.2.1 2004/06/30 13:16:25 keichwa Exp $
Packit 8a864e
dnl @author Luc Maisonobe
Packit 8a864e
dnl
Packit 8a864e
AC_DEFUN([AC_CXX_MUTABLE],
Packit 8a864e
[AC_CACHE_CHECK(whether the compiler supports the mutable keyword,
Packit 8a864e
ac_cv_cxx_mutable,
Packit 8a864e
[AC_LANG_SAVE
Packit 8a864e
 AC_LANG_CPLUSPLUS
Packit 8a864e
 AC_TRY_COMPILE([
Packit 8a864e
class A { mutable int i;
Packit 8a864e
          public:
Packit 8a864e
          int f (int n) const { i = n; return i; }
Packit 8a864e
        };
Packit 8a864e
],[A a; return a.f (1);],
Packit 8a864e
 ac_cv_cxx_mutable=yes, ac_cv_cxx_mutable=no)
Packit 8a864e
 AC_LANG_RESTORE
Packit 8a864e
])
Packit 8a864e
if test "$ac_cv_cxx_mutable" = yes; then
Packit 8a864e
  AC_DEFINE(HAVE_MUTABLE,,[define if the compiler supports the mutable keyword])
Packit 8a864e
fi
Packit 8a864e
])