~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
1579.2.3 by Monty Taylor
Updated pandora-build files to version 0.133
7
AC_DEFUN([PANDORA_CANONICAL_VERSION],[0.133])
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_REQUIRE_CXX],[no])
1085.1.7 by Monty Taylor
pandora-build r0.7
33
  m4_define([PCT_FORCE_GCC42],[no])
1273.12.3 by Monty Taylor
pandora-build v0.104
34
  m4_define([PCT_DONT_SUPPRESS_INCLUDE],[no])
1192.3.47 by Monty Taylor
pandora-build v0.79
35
  m4_define([PCT_VERSION_FROM_VC],[no])
1192.3.46 by Monty Taylor
pandora-build v0.76
36
  m4_define([PCT_USE_VISIBILITY],[yes])
1085.3.4 by Monty Taylor
pandora-build v0.8
37
  m4_foreach([pct_arg],[$*],[
1085.1.4 by Monty Taylor
pandora-build v1
38
    m4_case(pct_arg,
39
      [require-cxx], [
40
        m4_undefine([PCT_REQUIRE_CXX])
41
        m4_define([PCT_REQUIRE_CXX],[yes])
42
      ],
1085.1.7 by Monty Taylor
pandora-build r0.7
43
      [force-gcc42], [
44
        m4_undefine([PCT_FORCE_GCC42])
45
        m4_define([PCT_FORCE_GCC42],[yes])
1126.6.1 by Monty Taylor
pandora-build v0.58
46
      ],
1192.3.46 by Monty Taylor
pandora-build v0.76
47
      [skip-visibility], [
48
        m4_undefine([PCT_USE_VISIBILITY])
49
        m4_define([PCT_USE_VISIBILITY],[no])
50
      ],
1273.12.3 by Monty Taylor
pandora-build v0.104
51
      [dont-suppress-include], [
52
        m4_undefine([PCT_DONT_SUPPRESS_INCLUDE])
53
        m4_define([PCT_DONT_SUPPRESS_INCLUDE],[yes])
54
      ],
1192.3.47 by Monty Taylor
pandora-build v0.79
55
      [version-from-vc], [
56
        m4_undefine([PCT_VERSION_FROM_VC])
57
        m4_define([PCT_VERSION_FROM_VC],[yes])
1085.1.4 by Monty Taylor
pandora-build v1
58
    ])
59
  ])
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
60
1273.12.1 by Monty Taylor
pandora-build v0.100 - Fixes several bugs found by cb1kenobi. Add several thoughts from folks at LCA.
61
  AC_CONFIG_MACRO_DIR([m4])
62
1273.12.8 by Monty Taylor
Fixed m4 on solaris. Urg.
63
  m4_if(m4_substr(m4_esyscmd(test -d src && echo 0),0,1),0,[
1273.12.1 by Monty Taylor
pandora-build v0.100 - Fixes several bugs found by cb1kenobi. Add several thoughts from folks at LCA.
64
    AC_CONFIG_HEADERS([src/config.h])
65
  ],[
66
    AC_CONFIG_HEADERS([config.h])
67
  ])
68
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
69
  # We need to prevent canonical target
70
  # from injecting -O2 into CFLAGS - but we won't modify anything if we have
71
  # set CFLAGS on the command line, since that should take ultimate precedence
72
  AS_IF([test "x${ac_cv_env_CFLAGS_set}" = "x"],
73
        [CFLAGS=""])
74
  AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"],
75
        [CXXFLAGS=""])
76
  
77
  AC_CANONICAL_TARGET
78
  
1273.12.3 by Monty Taylor
pandora-build v0.104
79
  m4_if(PCT_DONT_SUPRESS_INCLUDE,yes,[
1579.1.2 by Monty Taylor
Updated AM_INIT_AUTOMAKE to work with atomics test on automake 1.9. (I hate RHEL)
80
    AM_INIT_AUTOMAKE(-Wall -Werror -Wno-portability subdir-objects foreign)
1273.12.3 by Monty Taylor
pandora-build v0.104
81
  ],[
1579.1.2 by Monty Taylor
Updated AM_INIT_AUTOMAKE to work with atomics test on automake 1.9. (I hate RHEL)
82
    AM_INIT_AUTOMAKE(-Wall -Werror -Wno-portability nostdinc subdir-objects foreign)
1273.12.3 by Monty Taylor
pandora-build v0.104
83
  ])
84
1093.9.24 by Monty Taylor
Added support for automake 1.11 and silent build rules.
85
  m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
1085.1.4 by Monty Taylor
pandora-build v1
86
1273.12.8 by Monty Taylor
Fixed m4 on solaris. Urg.
87
  m4_if(m4_substr(m4_esyscmd(test -d gnulib && echo 0),0,1),0,[
1273.12.1 by Monty Taylor
pandora-build v0.100 - Fixes several bugs found by cb1kenobi. Add several thoughts from folks at LCA.
88
    gl_EARLY
89
  ])
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
90
  
91
  AC_REQUIRE([AC_PROG_CC])
1530.5.5 by Monty Taylor
Made sure we order tests in the right way - we want to make sure that we upgrade the gcc version before we test for C++0x support.
92
  m4_if(PCT_FORCE_GCC42, [yes], [
93
    AC_REQUIRE([PANDORA_ENSURE_GCC_VERSION])
94
  ])
1093.4.1 by Monty Taylor
pandora-build v0.22 - fixes solaris build.
95
  AC_REQUIRE([PANDORA_64BIT])
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
96
1192.3.47 by Monty Taylor
pandora-build v0.79
97
  m4_if(PCT_VERSION_FROM_VC,yes,[
98
    PANDORA_VC_VERSION
1273.23.5 by Monty Taylor
Merged in changes fixing VC detection.
99
  ],[
100
    PANDORA_TEST_VC_DIR
1192.3.47 by Monty Taylor
pandora-build v0.79
101
  ])
102
  PANDORA_VERSION
103
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
104
  dnl Once we can use a modern autoconf, we can use this
105
  dnl AC_PROG_CC_C99
1093.7.6 by Monty Taylor
pandora-build v0.34
106
  AC_REQUIRE([AC_PROG_CXX])
1093.9.23 by Monty Taylor
pandora-build v0.49
107
  PANDORA_EXTENSIONS
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
108
  AM_PROG_CC_C_O
109
1093.4.1 by Monty Taylor
pandora-build v0.22 - fixes solaris build.
110
1093.2.2 by mordred
pandora-build v0.18
111
1099.1.12 by Monty Taylor
Rearranged two orderings.
112
  PANDORA_PLATFORM
113
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
114
  PANDORA_LIBTOOL
115
1085.1.4 by Monty Taylor
pandora-build v1
116
  dnl autoconf doesn't automatically provide a fail-if-no-C++ macro
117
  dnl so we check c++98 features and fail if we don't have them, mainly
118
  dnl for that reason
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
119
  PANDORA_CHECK_CXX_STANDARD
1085.1.4 by Monty Taylor
pandora-build v1
120
  m4_if(PCT_REQUIRE_CXX, [yes], [
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
121
    AS_IF([test "$ac_cv_cxx_stdcxx_98" = "no"],[
122
      AC_MSG_ERROR([No working C++ Compiler has been found. ${PACKAGE} requires a C++ compiler that can handle C++98])
123
    ])
1192.3.28 by Monty Taylor
pandora-build v0.72 - Moved remaining hard-coded tests into pandora-build
124
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
125
  ])
126
  
1273.12.8 by Monty Taylor
Fixed m4 on solaris. Urg.
127
  m4_if(m4_substr(m4_esyscmd(test -d gnulib && echo 0),0,1),0,[
1126.6.1 by Monty Taylor
pandora-build v0.58
128
    gl_INIT
129
    AC_CONFIG_LIBOBJ_DIR([gnulib])
130
  ])
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
131
1192.3.28 by Monty Taylor
pandora-build v0.72 - Moved remaining hard-coded tests into pandora-build
132
  PANDORA_CHECK_C_VERSION
133
  PANDORA_CHECK_CXX_VERSION
134
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
135
  AC_C_BIGENDIAN
136
  AC_C_CONST
137
  AC_C_INLINE
138
  AC_C_VOLATILE
1093.2.2 by mordred
pandora-build v0.18
139
  AC_C_RESTRICT
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
140
141
  AC_HEADER_TIME
1273.12.3 by Monty Taylor
pandora-build v0.104
142
  AC_STRUCT_TM
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
143
  AC_TYPE_SIZE_T
1085.1.4 by Monty Taylor
pandora-build v1
144
  AC_SYS_LARGEFILE
1273.12.3 by Monty Taylor
pandora-build v0.104
145
  PANDORA_CLOCK_GETTIME
1085.1.4 by Monty Taylor
pandora-build v1
146
1192.3.28 by Monty Taylor
pandora-build v0.72 - Moved remaining hard-coded tests into pandora-build
147
  # off_t is not a builtin type
148
  AC_CHECK_SIZEOF(off_t, 4)
149
  AS_IF([test "$ac_cv_sizeof_off_t" -eq 0],[
150
    AC_MSG_ERROR("${PACKAGE} needs an off_t type.")
151
  ])
152
153
  AC_CHECK_SIZEOF(size_t)
154
  AS_IF([test "$ac_cv_sizeof_size_t" -eq 0],[
155
    AC_MSG_ERROR("${PACKAGE} needs an size_t type.")
156
  ])
157
158
  AC_DEFINE_UNQUOTED([SIZEOF_SIZE_T],[$ac_cv_sizeof_size_t],[Size of size_t as computed by sizeof()])
159
  AC_CHECK_SIZEOF(long long)
160
  AC_DEFINE_UNQUOTED([SIZEOF_LONG_LONG],[$ac_cv_sizeof_long_long],[Size of long long as computed by sizeof()])
161
  AC_CACHE_CHECK([if time_t is unsigned], [ac_cv_time_t_unsigned],[
162
  AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
163
      [[
164
#include <time.h>
165
      ]],
166
      [[
167
      int array[(((time_t)-1) > 0) ? 1 : -1];
168
      ]])
169
    ],[
170
      ac_cv_time_t_unsigned=yes
171
    ],[
172
      ac_cv_time_t_unsigned=no
173
    ])
174
  ])
175
  AS_IF([test "$ac_cv_time_t_unsigned" = "yes"],[
176
    AC_DEFINE([TIME_T_UNSIGNED], 1, [Define to 1 if time_t is unsigned])
177
  ])
178
1241.12.5 by Monty Taylor
Replace hand-rolled libm check with the standard autoconf one.
179
  AC_CHECK_LIBM
1192.3.46 by Monty Taylor
pandora-build v0.76
180
  
181
  AC_CHECK_FUNC(setsockopt, [], [AC_CHECK_LIB(socket, setsockopt)])
182
  AC_CHECK_FUNC(bind, [], [AC_CHECK_LIB(bind, bind)])
183
184
185
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
186
  PANDORA_OPTIMIZE
1085.1.7 by Monty Taylor
pandora-build r0.7
187
1192.3.28 by Monty Taylor
pandora-build v0.72 - Moved remaining hard-coded tests into pandora-build
188
  AC_LANG_PUSH(C++)
189
  # Test whether madvise() is declared in C++ code -- it is not on some
190
  # systems, such as Solaris
191
  AC_CHECK_DECLS([madvise], [], [], [AC_INCLUDES_DEFAULT[
192
  #if HAVE_SYS_MMAN_H
193
  #include <sys/types.h>
194
  #include <sys/mman.h>
195
  #endif
196
  ]])
197
  AC_LANG_POP()
198
199
  PANDORA_HAVE_GCC_ATOMICS
200
1192.3.46 by Monty Taylor
pandora-build v0.76
201
  m4_if(PCT_USE_VISIBILITY,[yes],[
202
    dnl We need to inject error into the cflags to test if visibility works or not
203
    save_CFLAGS="${CFLAGS}"
204
    CFLAGS="${CFLAGS} -Werror"
1259.2.1 by Monty Taylor
Updates to pandora-build visibility settings.
205
    PANDORA_VISIBILITY
1192.3.46 by Monty Taylor
pandora-build v0.76
206
    CFLAGS="${save_CFLAGS}"
207
  ])
1090.3.5 by Monty Taylor
pandora-build v0.12
208
209
  PANDORA_HEADER_ASSERT
1085.1.7 by Monty Taylor
pandora-build r0.7
210
1085.1.4 by Monty Taylor
pandora-build v1
211
  PANDORA_WARNINGS(PCT_ALL_ARGS)
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
212
213
  PANDORA_ENABLE_DTRACE
214
1093.2.1 by Monty Taylor
pandora-build v0.16
215
  AC_LIB_PREFIX
216
  PANDORA_HAVE_BETTER_MALLOC
217
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
218
  AC_CHECK_PROGS([DOXYGEN], [doxygen])
219
  AC_CHECK_PROGS([PERL], [perl])
1273.12.9 by Monty Taylor
Merged up latest pandora-build.
220
  AC_CHECK_PROGS([DPKG_GENSYMBOLS], [dpkg-gensymbols], [:])
221
222
  AM_CONDITIONAL(HAVE_DPKG_GENSYMBOLS,[test "x${DPKG_GENSYMBOLS}" != "x:"])
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
223
1273.12.1 by Monty Taylor
pandora-build v0.100 - Fixes several bugs found by cb1kenobi. Add several thoughts from folks at LCA.
224
  PANDORA_WITH_GETTEXT
225
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
226
  AS_IF([test "x${gl_LIBOBJS}" != "x"],[
227
    AS_IF([test "$GCC" = "yes"],[
1273.12.1 by Monty Taylor
pandora-build v0.100 - Fixes several bugs found by cb1kenobi. Add several thoughts from folks at LCA.
228
      AM_CPPFLAGS="-isystem \${top_srcdir}/gnulib -isystem \${top_builddir}/gnulib ${AM_CPPFLAGS}"
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
229
    ],[
1273.12.1 by Monty Taylor
pandora-build v0.100 - Fixes several bugs found by cb1kenobi. Add several thoughts from folks at LCA.
230
    AM_CPPFLAGS="-I\${top_srcdir}/gnulib -I\${top_builddir}/gnulib ${AM_CPPFLAGS}"
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
231
    ])
232
  ])
1273.12.8 by Monty Taylor
Fixed m4 on solaris. Urg.
233
  m4_if(m4_substr(m4_esyscmd(test -d src && echo 0),0,1),0,[
1126.6.1 by Monty Taylor
pandora-build v0.58
234
    AM_CPPFLAGS="-I\$(top_srcdir)/src -I\$(top_builddir)/src ${AM_CPPFLAGS}"
1273.12.1 by Monty Taylor
pandora-build v0.100 - Fixes several bugs found by cb1kenobi. Add several thoughts from folks at LCA.
235
  ],[
236
    AM_CPPFLAGS="-I\$(top_srcdir) -I\$(top_builddir) ${AM_CPPFLAGS}"
1126.6.1 by Monty Taylor
pandora-build v0.58
237
  ])
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
238
1093.9.14 by Monty Taylor
pandora-build v0.43 Added -pipe to CFLAGS
239
  PANDORA_USE_PIPE
240
241
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
242
  AM_CFLAGS="${AM_CFLAGS} ${CC_WARNINGS} ${CC_PROFILING} ${CC_COVERAGE}"
243
  AM_CXXFLAGS="${AM_CXXFLAGS} ${CXX_WARNINGS} ${CC_PROFILING} ${CC_COVERAGE}"
244
245
  AC_SUBST([AM_CFLAGS])
246
  AC_SUBST([AM_CXXFLAGS])
247
  AC_SUBST([AM_CPPFLAGS])
1259.2.2 by Monty Taylor
Added option for OSX Fat Binaries.
248
  AC_SUBST([AM_LDFLAGS])
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
249
250
])