~drizzle-trunk/drizzle/development

1085.1.4 by Monty Taylor
pandora-build v1
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.
5
6
dnl Which version of the canonical setup we're using
1259.7.2 by Monty Taylor
Fixed a variable save.
7
AC_DEFUN([PANDORA_CANONICAL_VERSION],[0.95])
1085.1.4 by Monty Taylor
pandora-build v1
8
9
AC_DEFUN([PANDORA_FORCE_DEPEND_TRACKING],[
1259.2.2 by Monty Taylor
Added option for OSX Fat Binaries.
10
  AC_ARG_ENABLE([fat-binaries],
11
    [AS_HELP_STRING([--enable-fat-binaries],
12
      [Enable fat binary support on OSX @<:@default=off@:>@])],
13
    [ac_enable_fat_binaries="$enableval"],
14
    [ac_enable_fat_binaries="no"])
15
1085.1.4 by Monty Taylor
pandora-build v1
16
  dnl Force dependency tracking on for Sun Studio builds
17
  AS_IF([test "x${enable_dependency_tracking}" = "x"],[
18
    enable_dependency_tracking=yes
19
  ])
1259.2.2 by Monty Taylor
Added option for OSX Fat Binaries.
20
  dnl If we're building OSX Fat Binaries, we have to turn off -M options
21
  AS_IF([test "x${ac_enable_fat_binaries}" = "xyes"],[
22
    enable_dependency_tracking=no
23
  ])
1085.1.4 by Monty Taylor
pandora-build v1
24
])
25
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
26
dnl The standard setup for how we build Pandora projects
27
AC_DEFUN([PANDORA_CANONICAL_TARGET],[
1085.1.4 by Monty Taylor
pandora-build v1
28
  AC_REQUIRE([PANDORA_FORCE_DEPEND_TRACKING])
1085.1.7 by Monty Taylor
pandora-build r0.7
29
  ifdef([m4_define],,[define([m4_define],   defn([define]))])
30
  ifdef([m4_undefine],,[define([m4_undefine],   defn([undefine]))])
31
  m4_define([PCT_ALL_ARGS],[$*])
1085.1.4 by Monty Taylor
pandora-build v1
32
  m4_define([PCT_USE_GNULIB],[no])
33
  m4_define([PCT_REQUIRE_CXX],[no])
34
  m4_define([PCT_IGNORE_SHARED_PTR],[no])
1085.1.7 by Monty Taylor
pandora-build r0.7
35
  m4_define([PCT_FORCE_GCC42],[no])
1126.6.1 by Monty Taylor
pandora-build v0.58
36
  m4_define([PCT_SRC_IN_SRC],[no])
1192.3.47 by Monty Taylor
pandora-build v0.79
37
  m4_define([PCT_VERSION_FROM_VC],[no])
1192.3.46 by Monty Taylor
pandora-build v0.76
38
  m4_define([PCT_USE_VISIBILITY],[yes])
1085.3.4 by Monty Taylor
pandora-build v0.8
39
  m4_foreach([pct_arg],[$*],[
1085.1.4 by Monty Taylor
pandora-build v1
40
    m4_case(pct_arg,
41
      [use-gnulib], [
42
        m4_undefine([PCT_USE_GNULIB])
43
        m4_define([PCT_USE_GNULIB],[yes])
44
      ],
45
      [require-cxx], [
46
        m4_undefine([PCT_REQUIRE_CXX])
47
        m4_define([PCT_REQUIRE_CXX],[yes])
48
      ],
49
      [ignore-shared-ptr], [
50
        m4_undefine([PCT_IGNORE_SHARED_PTR])
51
        m4_define([PCT_IGNORE_SHARED_PTR],[yes])
1085.1.7 by Monty Taylor
pandora-build r0.7
52
      ],
53
      [force-gcc42], [
54
        m4_undefine([PCT_FORCE_GCC42])
55
        m4_define([PCT_FORCE_GCC42],[yes])
1126.6.1 by Monty Taylor
pandora-build v0.58
56
      ],
1192.3.46 by Monty Taylor
pandora-build v0.76
57
      [skip-visibility], [
58
        m4_undefine([PCT_USE_VISIBILITY])
59
        m4_define([PCT_USE_VISIBILITY],[no])
60
      ],
1126.6.1 by Monty Taylor
pandora-build v0.58
61
      [src-in-src], [
62
        m4_undefine([PCT_SRC_IN_SRC])
63
        m4_define([PCT_SRC_IN_SRC],[yes])
1192.3.47 by Monty Taylor
pandora-build v0.79
64
      ],
65
      [version-from-vc], [
66
        m4_undefine([PCT_VERSION_FROM_VC])
67
        m4_define([PCT_VERSION_FROM_VC],[yes])
1085.1.4 by Monty Taylor
pandora-build v1
68
    ])
69
  ])
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
70
71
  # We need to prevent canonical target
72
  # from injecting -O2 into CFLAGS - but we won't modify anything if we have
73
  # set CFLAGS on the command line, since that should take ultimate precedence
74
  AS_IF([test "x${ac_cv_env_CFLAGS_set}" = "x"],
75
        [CFLAGS=""])
76
  AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"],
77
        [CXXFLAGS=""])
78
  
79
  AC_CANONICAL_TARGET
80
  
1192.3.7 by Monty Taylor
Added code necessary for building plugins dynamically.
81
  AM_INIT_AUTOMAKE(-Wall -Werror nostdinc subdir-objects foreign)
1093.9.24 by Monty Taylor
Added support for automake 1.11 and silent build rules.
82
  m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
1085.1.4 by Monty Taylor
pandora-build v1
83
84
  m4_if(PCT_USE_GNULIB,yes,[ gl_EARLY ])
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
85
  
86
  AC_REQUIRE([AC_PROG_CC])
1085.1.7 by Monty Taylor
pandora-build r0.7
87
  AC_REQUIRE([PANDORA_MAC_GCC42])
1093.4.1 by Monty Taylor
pandora-build v0.22 - fixes solaris build.
88
  AC_REQUIRE([PANDORA_64BIT])
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
89
1192.3.47 by Monty Taylor
pandora-build v0.79
90
  m4_if(PCT_VERSION_FROM_VC,yes,[
91
    PANDORA_VC_VERSION
92
  ])
93
  PANDORA_VERSION
94
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
95
  dnl Once we can use a modern autoconf, we can use this
96
  dnl AC_PROG_CC_C99
1093.7.6 by Monty Taylor
pandora-build v0.34
97
  AC_REQUIRE([AC_PROG_CXX])
1093.9.23 by Monty Taylor
pandora-build v0.49
98
  PANDORA_EXTENSIONS
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
99
  AM_PROG_CC_C_O
100
1093.4.1 by Monty Taylor
pandora-build v0.22 - fixes solaris build.
101
1085.1.7 by Monty Taylor
pandora-build r0.7
102
  m4_if(PCT_FORCE_GCC42, [yes], [
103
    AS_IF([test "$GCC" = "yes"], PANDORA_ENSURE_GCC_VERSION)
104
  ])
1093.2.2 by mordred
pandora-build v0.18
105
1099.1.12 by Monty Taylor
Rearranged two orderings.
106
  PANDORA_PLATFORM
107
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
108
  PANDORA_LIBTOOL
109
1085.1.4 by Monty Taylor
pandora-build v1
110
  dnl autoconf doesn't automatically provide a fail-if-no-C++ macro
111
  dnl so we check c++98 features and fail if we don't have them, mainly
112
  dnl for that reason
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
113
  PANDORA_CHECK_CXX_STANDARD
1085.1.4 by Monty Taylor
pandora-build v1
114
  m4_if(PCT_REQUIRE_CXX, [yes], [
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
115
    AS_IF([test "$ac_cv_cxx_stdcxx_98" = "no"],[
116
      AC_MSG_ERROR([No working C++ Compiler has been found. ${PACKAGE} requires a C++ compiler that can handle C++98])
117
    ])
1192.3.28 by Monty Taylor
pandora-build v0.72 - Moved remaining hard-coded tests into pandora-build
118
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
119
  ])
120
  
121
  PANDORA_SHARED_PTR
1085.1.4 by Monty Taylor
pandora-build v1
122
  m4_if(PCT_IGNORE_SHARED_PTR, [no], [
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
123
    AS_IF([test "$ac_cv_shared_ptr_namespace" = "missing"],[
124
      AC_MSG_WARN([a usable shared_ptr implementation was not found. Let someone know what your platform is.])
125
    ])
126
  ])
127
  
1126.6.1 by Monty Taylor
pandora-build v0.58
128
  m4_if(PCT_USE_GNULIB, [yes], [
129
    gl_INIT
130
    AC_CONFIG_LIBOBJ_DIR([gnulib])
131
  ])
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
132
1192.3.28 by Monty Taylor
pandora-build v0.72 - Moved remaining hard-coded tests into pandora-build
133
  PANDORA_CHECK_C_VERSION
134
  PANDORA_CHECK_CXX_VERSION
135
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
136
  AC_C_BIGENDIAN
137
  AC_C_CONST
138
  AC_C_INLINE
139
  AC_C_VOLATILE
1093.2.2 by mordred
pandora-build v0.18
140
  AC_C_RESTRICT
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
141
142
  AC_HEADER_TIME
143
  AC_TYPE_SIZE_T
1085.1.4 by Monty Taylor
pandora-build v1
144
  AC_SYS_LARGEFILE
145
1192.3.28 by Monty Taylor
pandora-build v0.72 - Moved remaining hard-coded tests into pandora-build
146
  # off_t is not a builtin type
147
  AC_CHECK_SIZEOF(off_t, 4)
148
  AS_IF([test "$ac_cv_sizeof_off_t" -eq 0],[
149
    AC_MSG_ERROR("${PACKAGE} needs an off_t type.")
150
  ])
151
152
  AC_CHECK_SIZEOF(size_t)
153
  AS_IF([test "$ac_cv_sizeof_size_t" -eq 0],[
154
    AC_MSG_ERROR("${PACKAGE} needs an size_t type.")
155
  ])
156
157
  AC_DEFINE_UNQUOTED([SIZEOF_SIZE_T],[$ac_cv_sizeof_size_t],[Size of size_t as computed by sizeof()])
158
  AC_CHECK_SIZEOF(long long)
159
  AC_DEFINE_UNQUOTED([SIZEOF_LONG_LONG],[$ac_cv_sizeof_long_long],[Size of long long as computed by sizeof()])
160
  AC_CACHE_CHECK([if time_t is unsigned], [ac_cv_time_t_unsigned],[
161
  AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
162
      [[
163
#include <time.h>
164
      ]],
165
      [[
166
      int array[(((time_t)-1) > 0) ? 1 : -1];
167
      ]])
168
    ],[
169
      ac_cv_time_t_unsigned=yes
170
    ],[
171
      ac_cv_time_t_unsigned=no
172
    ])
173
  ])
174
  AS_IF([test "$ac_cv_time_t_unsigned" = "yes"],[
175
    AC_DEFINE([TIME_T_UNSIGNED], 1, [Define to 1 if time_t is unsigned])
176
  ])
177
178
  dnl AC_FUNC_ALLOCA would test for stack direction if we didn't have a working
179
  dnl alloca - but we need to know it anyway for check_stack_overrun.
180
  PANDORA_STACK_DIRECTION
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
181
1241.12.5 by Monty Taylor
Replace hand-rolled libm check with the standard autoconf one.
182
  AC_CHECK_LIBM
1192.3.46 by Monty Taylor
pandora-build v0.76
183
  
184
  AC_CHECK_FUNC(setsockopt, [], [AC_CHECK_LIB(socket, setsockopt)])
185
  AC_CHECK_FUNC(bind, [], [AC_CHECK_LIB(bind, bind)])
186
187
188
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
189
  PANDORA_OPTIMIZE
1085.1.7 by Monty Taylor
pandora-build r0.7
190
1192.3.28 by Monty Taylor
pandora-build v0.72 - Moved remaining hard-coded tests into pandora-build
191
  AC_LANG_PUSH(C++)
192
  # Test whether madvise() is declared in C++ code -- it is not on some
193
  # systems, such as Solaris
194
  AC_CHECK_DECLS([madvise], [], [], [AC_INCLUDES_DEFAULT[
195
  #if HAVE_SYS_MMAN_H
196
  #include <sys/types.h>
197
  #include <sys/mman.h>
198
  #endif
199
  ]])
200
  AC_LANG_POP()
201
202
  PANDORA_HAVE_GCC_ATOMICS
203
1192.3.46 by Monty Taylor
pandora-build v0.76
204
  m4_if(PCT_USE_VISIBILITY,[yes],[
205
    dnl We need to inject error into the cflags to test if visibility works or not
206
    save_CFLAGS="${CFLAGS}"
207
    CFLAGS="${CFLAGS} -Werror"
1259.2.1 by Monty Taylor
Updates to pandora-build visibility settings.
208
    PANDORA_VISIBILITY
1192.3.46 by Monty Taylor
pandora-build v0.76
209
    CFLAGS="${save_CFLAGS}"
210
  ])
1090.3.5 by Monty Taylor
pandora-build v0.12
211
212
  PANDORA_HEADER_ASSERT
1085.1.7 by Monty Taylor
pandora-build r0.7
213
1085.1.4 by Monty Taylor
pandora-build v1
214
  PANDORA_WARNINGS(PCT_ALL_ARGS)
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
215
216
  PANDORA_ENABLE_DTRACE
217
1093.2.1 by Monty Taylor
pandora-build v0.16
218
  AC_LIB_PREFIX
219
  PANDORA_HAVE_BETTER_MALLOC
220
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
221
  AC_CHECK_PROGS([DOXYGEN], [doxygen])
222
  AC_CHECK_PROGS([PERL], [perl])
223
224
  AS_IF([test "x${gl_LIBOBJS}" != "x"],[
225
    AS_IF([test "$GCC" = "yes"],[
226
      AM_CPPFLAGS="-isystem \$(top_srcdir)/gnulib -isystem \$(top_builddir)/gnulib ${AM_CPPFLAGS}"
227
    ],[
228
    AM_CPPFLAGS="-I\$(top_srcdir)/gnulib -I\$(top_builddir)/gnulib ${AM_CPPFLAGS}"
229
    ])
230
  ])
1126.6.1 by Monty Taylor
pandora-build v0.58
231
  AS_IF([test "PCT_SRC_IN_SRC" = "yes"],[
232
    AM_CPPFLAGS="-I\$(top_srcdir)/src -I\$(top_builddir)/src ${AM_CPPFLAGS}"
233
  ])
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
234
1093.9.14 by Monty Taylor
pandora-build v0.43 Added -pipe to CFLAGS
235
  PANDORA_USE_PIPE
236
237
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
238
  AM_CPPFLAGS="-I\${top_srcdir} -I\${top_builddir} ${AM_CPPFLAGS}"
239
  AM_CFLAGS="${AM_CFLAGS} ${CC_WARNINGS} ${CC_PROFILING} ${CC_COVERAGE}"
240
  AM_CXXFLAGS="${AM_CXXFLAGS} ${CXX_WARNINGS} ${CC_PROFILING} ${CC_COVERAGE}"
241
242
  AC_SUBST([AM_CFLAGS])
243
  AC_SUBST([AM_CXXFLAGS])
244
  AC_SUBST([AM_CPPFLAGS])
1259.2.2 by Monty Taylor
Added option for OSX Fat Binaries.
245
  AC_SUBST([AM_LDFLAGS])
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
246
247
])