1
dnl Copyright (C) 2009 Sun Microsystems
2
dnl This file is free software; Sun Microsystems
3
dnl gives unlimited permission to copy and/or distribute it,
4
dnl with or without modifications, as long as this notice is preserved.
6
dnl Which version of the canonical setup we're using
7
AC_DEFUN([PANDORA_CANONICAL_VERSION],[0.22])
9
AC_DEFUN([PANDORA_FORCE_DEPEND_TRACKING],[
10
dnl Force dependency tracking on for Sun Studio builds
11
AS_IF([test "x${enable_dependency_tracking}" = "x"],[
12
enable_dependency_tracking=yes
16
dnl The standard setup for how we build Pandora projects
17
AC_DEFUN([PANDORA_CANONICAL_TARGET],[
18
AC_REQUIRE([PANDORA_FORCE_DEPEND_TRACKING])
19
ifdef([m4_define],,[define([m4_define], defn([define]))])
20
ifdef([m4_undefine],,[define([m4_undefine], defn([undefine]))])
21
m4_define([PCT_ALL_ARGS],[$*])
22
m4_define([PCT_USE_GNULIB],[no])
23
m4_define([PCT_REQUIRE_CXX],[no])
24
m4_define([PCT_IGNORE_SHARED_PTR],[no])
25
m4_define([PCT_FORCE_GCC42],[no])
26
m4_foreach([pct_arg],[$*],[
29
m4_undefine([PCT_USE_GNULIB])
30
m4_define([PCT_USE_GNULIB],[yes])
33
m4_undefine([PCT_REQUIRE_CXX])
34
m4_define([PCT_REQUIRE_CXX],[yes])
36
[ignore-shared-ptr], [
37
m4_undefine([PCT_IGNORE_SHARED_PTR])
38
m4_define([PCT_IGNORE_SHARED_PTR],[yes])
41
m4_undefine([PCT_FORCE_GCC42])
42
m4_define([PCT_FORCE_GCC42],[yes])
46
# We need to prevent canonical target
47
# from injecting -O2 into CFLAGS - but we won't modify anything if we have
48
# set CFLAGS on the command line, since that should take ultimate precedence
49
AS_IF([test "x${ac_cv_env_CFLAGS_set}" = "x"],
51
AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"],
56
AM_INIT_AUTOMAKE(-Wall -Werror nostdinc subdir-objects)
58
m4_if(PCT_USE_GNULIB,yes,[ gl_EARLY ])
60
AC_REQUIRE([AC_PROG_CC])
61
AC_REQUIRE([PANDORA_MAC_GCC42])
62
AC_REQUIRE([PANDORA_64BIT])
64
dnl Once we can use a modern autoconf, we can use this
71
gl_USE_SYSTEM_EXTENSIONS
72
m4_if(PCT_FORCE_GCC42, [yes], [
73
AS_IF([test "$GCC" = "yes"], PANDORA_ENSURE_GCC_VERSION)
76
AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
77
AC_CHECK_DECL([__ICC], [INTELCC="yes"], [INTELCC="no"])
78
AS_IF([test "x$INTELCC" = "xyes"], [enable_rpath=no])
82
dnl autoconf doesn't automatically provide a fail-if-no-C++ macro
83
dnl so we check c++98 features and fail if we don't have them, mainly
85
PANDORA_CHECK_CXX_STANDARD
86
m4_if(PCT_REQUIRE_CXX, [yes], [
87
AS_IF([test "$ac_cv_cxx_stdcxx_98" = "no"],[
88
AC_MSG_ERROR([No working C++ Compiler has been found. ${PACKAGE} requires a C++ compiler that can handle C++98])
93
m4_if(PCT_IGNORE_SHARED_PTR, [no], [
94
AS_IF([test "$ac_cv_shared_ptr_namespace" = "missing"],[
95
AC_MSG_WARN([a usable shared_ptr implementation was not found. Let someone know what your platform is.])
99
m4_if(PCT_USE_GNULIB, [yes], [gl_INIT])
112
PANDORA_CHECK_C_VERSION
113
PANDORA_CHECK_CXX_VERSION
117
dnl We need to inject error into the cflags to test if visibility works or not
118
save_CFLAGS="${CFLAGS}"
119
CFLAGS="${CFLAGS} -Werror"
121
CFLAGS="${save_CFLAGS}"
123
PANDORA_HEADER_ASSERT
125
PANDORA_WARNINGS(PCT_ALL_ARGS)
127
PANDORA_ENABLE_DTRACE
130
PANDORA_HAVE_BETTER_MALLOC
132
AC_CHECK_PROGS([DOXYGEN], [doxygen])
133
AC_CHECK_PROGS([PERL], [perl])
135
AS_IF([test "x${gl_LIBOBJS}" != "x"],[
136
AS_IF([test "$GCC" = "yes"],[
137
AM_CPPFLAGS="-isystem \$(top_srcdir)/gnulib -isystem \$(top_builddir)/gnulib ${AM_CPPFLAGS}"
139
AM_CPPFLAGS="-I\$(top_srcdir)/gnulib -I\$(top_builddir)/gnulib ${AM_CPPFLAGS}"
143
AM_CPPFLAGS="-I\${top_srcdir} -I\${top_builddir} ${AM_CPPFLAGS}"
144
AM_CFLAGS="${AM_CFLAGS} ${CC_WARNINGS} ${CC_PROFILING} ${CC_COVERAGE}"
145
AM_CXXFLAGS="${AM_CXXFLAGS} ${CXX_WARNINGS} ${CC_PROFILING} ${CC_COVERAGE}"
147
AC_SUBST([AM_CFLAGS])
148
AC_SUBST([AM_CXXFLAGS])
149
AC_SUBST([AM_CPPFLAGS])