~drizzle-trunk/drizzle/development

575.4.7 by Monty Taylor
More header cleanup.
1
dnl -*- bash -*-
1 by brian
clean slate
2
dnl Process this file with autoconf to produce a configure script.
3
992.1.25 by Monty Taylor
Moved myisam to new plugin system.
4
dnl  Copyright (C) 2009 Sun Microsystems
5
dnl
6
dnl  This program is free software; you can redistribute it and/or modify
7
dnl  it under the terms of the GNU General Public License as published by
8
dnl  the Free Software Foundation; version 2 of the License.
9
dnl
10
dnl  This program is distributed in the hope that it will be useful,
11
dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
dnl  GNU General Public License for more details.
14
dnl
15
dnl  You should have received a copy of the GNU General Public License
16
dnl  along with this program; if not, write to the Free Software
17
dnl  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
19
77.1.65 by Monty Taylor
We don't really require 2.61, 2.59 is actually fine.
20
AC_PREREQ(2.59)dnl		Minimum Autoconf version required.
1 by brian
clean slate
21
908.1.3 by Monty Taylor
Updated build system to use new version numbering. Just remember to run ./config/autorun.sh before running make distcheck for release and all should be peachy.
22
m4_include(m4/bzr_version.m4)
23
214 by Brian Aker
Rename of fields (fix issue with string and decimal .h clashing).
24
AC_CONFIG_SRCDIR([drizzled/drizzled.cc])
39 by Brian Aker
Move build helper files into config
25
AC_CONFIG_AUX_DIR(config)
236.1.9 by Monty Taylor
Cleaned up configure.ac line.
26
AC_CONFIG_HEADERS([config.h])
908.1.4 by Monty Taylor
Fix to fake-out libtoolize, since AC_INIT is in bzr_version.m4 now.
27
AC_CONFIG_MACRO_DIR([m4])
435.1.1 by Monty Taylor
Fixed -O3 optimization for gcc.
28
722.1.3 by Monty Taylor
Cleaned up a few build things.
29
# Setting CFLAGS here prevents AC_CANONICAL_TARGET from injecting them
30
SAVE_CFLAGS=${CFLAGS}
31
SAVE_CXXFLAGS=${CXXFLAGS}
32
CFLAGS=
33
CXXFLAGS=
435.1.1 by Monty Taylor
Fixed -O3 optimization for gcc.
34
28.1.33 by Monty Taylor
Added -Wall
35
AC_CANONICAL_TARGET
722.1.3 by Monty Taylor
Cleaned up a few build things.
36
37
CFLAGS=${SAVE_CFLAGS}
38
CXXFLAGS=${SAVE_CXXFLAGS}
39
779.4.10 by Monty Taylor
Cleaned up a few build things. Thank me... builds should be quicker now. :)
40
AM_INIT_AUTOMAKE(nostdinc subdir-objects -Wall -Werror)
779.3.21 by Monty Taylor
Fixed solaris fixes for linux. Oh, and I also seem to have fixed some more configure stuff.
41
722.1.3 by Monty Taylor
Cleaned up a few build things.
42
if test "x${enable_dependency_tracking}" = "x"
43
then
44
  enable_dependency_tracking=yes
45
fi
46
815.1.1 by Monty Taylor
Add timegm which is missing on Solaris.
47
gl_EARLY
722.1.3 by Monty Taylor
Cleaned up a few build things.
48
528 by Monty Taylor
Re-arragned a few things in configure.ac.
49
50
dnl Checks for programs.
755.1.6 by Monty Taylor
One more stupid change.
51
AC_PROG_CXX
554 by Monty
Added impl of macro missing from old systems.
52
815.1.1 by Monty Taylor
Add timegm which is missing on Solaris.
53
gl_USE_SYSTEM_EXTENSIONS
910.2.1 by Monty Taylor
Put in early check and instructive error message for too-old gcc.
54
if test "$GCC" = "yes"
55
then
919.3.1 by Monty Taylor
Force gcc-4.2 on Mac.
56
  # If you're on a Mac, and you didn't ask for a specific compiler
57
  # You're gonna get 4.2.
58
  if test "$host_vendor" = "apple" -a "x${ac_cv_env_CC_set}" = "x"
59
  then
60
    CPP="/usr/bin/gcc-4.2 -E"
61
    CC=/usr/bin/gcc-4.2
62
    CXX=/usr/bin/g++-4.2
63
  fi
910.2.2 by Monty Taylor
Split out protobuf version check from the check for protobuf version so that we can give better error message.
64
  AC_CACHE_CHECK([if GCC is recent enough], [drizzle_cv_gcc_recent],
65
    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
923.2.4 by Monty Taylor
Backed GCC requirement back down to 4.1. Stupid RHEL5.
66
#if !defined(__GNUC__) || (__GNUC__ < 4) || ((__GNUC__ >= 4) && (__GNUC_MINOR__ < 1))
910.2.1 by Monty Taylor
Put in early check and instructive error message for too-old gcc.
67
# error GCC is Too Old!
68
#endif
910.2.2 by Monty Taylor
Split out protobuf version check from the check for protobuf version so that we can give better error message.
69
      ]])],
70
      [drizzle_cv_gcc_recent=yes],
71
      [drizzle_cv_gcc_recent=no])])
968.2.24 by Monty Taylor
Split up OSX GCC error codes.
72
  if test "$drizzle_cv_gcc_recent" = "no" -a "$host_vendor" = "apple"
73
  then
968.2.28 by Monty Taylor
Added more informative error message.
74
    AC_MSG_ERROR([Your version of GCC is too old. Drizzle requires at least version 4.2 on OSX. You may need to install a version of XCode >= 3.1.2])
968.2.24 by Monty Taylor
Split up OSX GCC error codes.
75
  fi
910.2.2 by Monty Taylor
Split out protobuf version check from the check for protobuf version so that we can give better error message.
76
  if test "$drizzle_cv_gcc_recent" = "no"
77
  then
968.2.24 by Monty Taylor
Split up OSX GCC error codes.
78
    AC_MSG_ERROR([Your version of GCC is too old. Drizzle requires at least version 4.1])
910.2.2 by Monty Taylor
Split out protobuf version check from the check for protobuf version so that we can give better error message.
79
  fi
910.2.1 by Monty Taylor
Put in early check and instructive error message for too-old gcc.
80
fi
910.2.3 by Monty Taylor
Removed extra checks.
81
AC_CXX_HEADER_STDCXX_98
82
if test "$ac_cv_cxx_stdcxx_98" = "no"
83
then
917.1.5 by Monty Taylor
Added more verbose failure messages.
84
  AC_MSG_ERROR([No working C++ Compiler has been found. Drizzle requires a C++ compiler that can handle C++98])
910.2.3 by Monty Taylor
Removed extra checks.
85
fi
86
AC_PROG_CPP
87
AM_PROG_CC_C_O
88
917.1.5 by Monty Taylor
Added more verbose failure messages.
89
if test "$am_cv_prog_cc_stdc" = "no"
90
then
91
  AC_MSG_ERROR([Drizzle requires an ANSI C compiler (and a C++ compiler). Try gcc. See the Installation chapter in the Reference Manual.])
92
fi
93
94
910.2.1 by Monty Taylor
Put in early check and instructive error message for too-old gcc.
95
815.1.1 by Monty Taylor
Add timegm which is missing on Solaris.
96
gl_INIT
528 by Monty Taylor
Re-arragned a few things in configure.ac.
97
873.2.41 by Monty Taylor
Fixed the ol build for ol Solaris.
98
AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
99
779.3.21 by Monty Taylor
Fixed solaris fixes for linux. Oh, and I also seem to have fixed some more configure stuff.
100
AC_PROG_GCC_TRADITIONAL
755.1.6 by Monty Taylor
One more stupid change.
101
1 by brian
clean slate
102
103
# Set all version vars based on $VERSION. How do we do this more elegant ?
104
# Remember that regexps needs to quote [ and ] since this is run through m4
105
# We take some made up examples
106
#
107
#  VERSION                  5.1.40sp1-alpha     5.0.34a
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
108
#  DRIZZLE_NO_DASH_VERSION    5.1.40sp1           5.0.34a
109
#  DRIZZLE_NUMERIC_VERSION    5.1.40              5.0.34
110
#  DRIZZLE_BASE_VERSION       5.1                 5.0
111
#  DRIZZLE_VERSION_ID         50140               50034
1 by brian
clean slate
112
#
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
113
DRIZZLE_NO_DASH_VERSION=`echo $VERSION | sed -e "s|-.*$||"`
114
DRIZZLE_NUMERIC_VERSION=`echo $DRIZZLE_NO_DASH_VERSION | sed -e "s|[[a-z]][[a-z0-9]]*$||"`
115
DRIZZLE_BASE_VERSION=`echo $DRIZZLE_NUMERIC_VERSION | sed -e "s|\.[[^.]]*$||"`
116
DRIZZLE_VERSION_ID=`echo $DRIZZLE_NUMERIC_VERSION | \
1 by brian
clean slate
117
    awk -F. '{printf "%d%0.2d%0.2d", $1, $2, $3}'`
722.1.3 by Monty Taylor
Cleaned up a few build things.
118
AC_DEFINE_UNQUOTED(DRIZZLE_BASE_VERSION,["$DRIZZLE_BASE_VERSION"],
119
                   [Major and minor version])
120
AC_DEFINE_UNQUOTED([DRIZZLE_VERSION_ID],[$DRIZZLE_VERSION_ID],
121
		   [Version ID that can be easily used for numeric comparison])
1 by brian
clean slate
122
859.1.4 by Monty Taylor
Hack to allow use of hash_map in gcc 4.3.
123
AC_DEFINE([_BACKWARD_BACKWARD_WARNING_H],[1],[Hack to disable deprecation warning in gcc])
124
1 by brian
clean slate
125
# The port should be constant for a LONG time
301 by Brian Aker
Clean up port startup
126
DRIZZLE_TCP_PORT_DEFAULT=4427
1 by brian
clean slate
127
722.2.9 by Monty Taylor
I _think_ I've got the plug.in triggering rebuild thing going on right.
128
m4_include(m4/dtrace.m4)
722.1.3 by Monty Taylor
Cleaned up a few build things.
129
722.2.9 by Monty Taylor
I _think_ I've got the plug.in triggering rebuild thing going on right.
130
m4_include(m4/character_sets.m4)
722.1.3 by Monty Taylor
Cleaned up a few build things.
131
AC_SUBST(AVAILABLE_LANGUAGES)
132
840.1.2 by Monty Taylor
Fix for msgmerge possibly being gmsgmerge.
133
722.1.3 by Monty Taylor
Cleaned up a few build things.
134
# Set this for plugins to use
135
ac_build_drizzle="yes"
441 by Monty Taylor
Move unconditional defines to config.h.
136
137
1 by brian
clean slate
138
# Canonicalize the configuration name.
139
140
# Check whether --with-system-type or --without-system-type was given.
28.1.33 by Monty Taylor
Added -Wall
141
AC_ARG_WITH([system-type],
142
    [AS_HELP_STRING([--with-system-type],
143
       [Set the system type, like "sun-solaris10"])],
1 by brian
clean slate
144
    [SYSTEM_TYPE="$withval"],
145
    [SYSTEM_TYPE="$host_vendor-$host_os"])
28.1.33 by Monty Taylor
Added -Wall
146
AC_ARG_WITH([machine-type],
147
    [AS_HELP_STRING([--with-machine-type],
907.3.2 by Monty Taylor
Added tests for 64-bit solaris. Look in /usr/lib/amd64 and /usr/local/lib/amd64 if we are 64-bit.
148
       [Set the machine type, like "sparc"])],
1 by brian
clean slate
149
    [MACHINE_TYPE="$withval"],
150
    [MACHINE_TYPE="$host_cpu"])
151
AC_SUBST(SYSTEM_TYPE)
152
AC_DEFINE_UNQUOTED([SYSTEM_TYPE], ["$SYSTEM_TYPE"],
153
                   [Name of system, eg sun-solaris])
154
AC_SUBST(MACHINE_TYPE)
155
AC_DEFINE_UNQUOTED([MACHINE_TYPE], ["$MACHINE_TYPE"],
156
                   [Machine type name, eg sparc])
157
158
# Detect intel x86 like processor
159
BASE_MACHINE_TYPE=$MACHINE_TYPE
160
case $MACHINE_TYPE in
161
  i?86) BASE_MACHINE_TYPE=i386 ;;
162
esac
163
481.1.9 by Monty Taylor
Added autoconf tests for location of cstdint and cinttypes. Use those in C++ programs now, so that we don't have to define _STDC_LIMIT_MACROS, etc by hand. Stop, in fact, defining those by hand.
164
520.4.41 by mordred
Fixed configure.ac to work cleanly on Solaris - and define some good compile flags.
165
case "$target_os" in
166
  *linux*)
167
  TARGET_LINUX="true"
168
  AC_SUBST(TARGET_LINUX)
169
  AC_DEFINE([TARGET_OS_LINUX], [1], [Whether we build for Linux])
170
    ;;
271 by Brian Aker
OSX fix
171
  *apple-darwin*)
520.4.41 by mordred
Fixed configure.ac to work cleanly on Solaris - and define some good compile flags.
172
    TARGET_OSX="true"
173
    AC_SUBST(TARGET_OSX)
271 by Brian Aker
OSX fix
174
    AC_DEFINE([TARGET_OS_OSX], [1], [Whether we build for OSX])
1 by brian
clean slate
175
    ;;
520.4.41 by mordred
Fixed configure.ac to work cleanly on Solaris - and define some good compile flags.
176
  *solaris*)
177
    TARGET_SOLARIS="true"
178
    AC_SUBST(TARGET_SOLARIS)
179
    AC_DEFINE([TARGET_OS_SOLARIS], [1], [Whether we are building for Solaris])
180
    ;;
1 by brian
clean slate
181
  *)
182
    ;;
183
esac
435.1.1 by Monty Taylor
Fixed -O3 optimization for gcc.
184
520.4.41 by mordred
Fixed configure.ac to work cleanly on Solaris - and define some good compile flags.
185
DRIZZLE_CHECK_C_VERSION
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
186
DRIZZLE_CHECK_CXX_VERSION
1 by brian
clean slate
187
590.2.23 by Monty Taylor
Fixed a few things for solaris builds.
188
AC_SYS_LARGEFILE
189
230.3.1 by Monty Taylor
Bug 252805: ./configure not detecting missing g++
190
AC_PROG_AWK
191
1 by brian
clean slate
192
873.2.4 by Monty Taylor
Fixed some configure errors.
193
AC_PATH_PROG(GPERF, gperf)
194
AS_IF([test "x$GPERF" = "x"],
917.1.5 by Monty Taylor
Added more verbose failure messages.
195
      AC_MSG_ERROR("Drizzle requires gperf to build."))
779.4.5 by Monty Taylor
Replaced gen_lex_hash with gperf. Yay for no more building tools to build source!!!
196
840.1.3 by Monty Taylor
Fixed gperf checking to fail properly.
197
AC_PATH_PROG(LCOV, lcov)
198
AC_PATH_PROG(GENHTML, genhtml)
779.1.25 by Monty Taylor
Put in LCOV checks. Put output in subdir.
199
873.2.4 by Monty Taylor
Fixed some configure errors.
200
AM_CONDITIONAL(HAVE_LCOV,[test "x$LCOV" != "x"])
779.1.25 by Monty Taylor
Put in LCOV checks. Put output in subdir.
201
1 by brian
clean slate
202
AC_SUBST(NM)dnl
203
204
AC_PROG_INSTALL
205
590.2.2 by Monty Taylor
Configure cleanups. Added generic search_for_lib m4 macro.
206
dnl Not critical since the generated file is distributed
629.1.1 by Monty Taylor
More solaris fixes.
207
AC_CHECK_PROGS(YACC, ['bison -y'])
1008.2.1 by Robert Collins
Look for ''/.bzr in configure when checking for bison, not .bzr
208
if test -z "$YACC" && test -d "$srcdir/.bzr"
77.1.70 by Monty Taylor
Added a failure if you don't have bison and you're building from a .bzr branch.
209
then
210
  AC_MSG_ERROR(["bison is required for Drizzle to build from a bzr branch"])
211
fi
1 by brian
clean slate
212
997.2.18 by Monty Taylor
Fixed the isainfo check progs. To be clear, this was to prevent it being called on _NOT_ Solaris. I can't type, apparently.
213
AC_CHECK_PROGS(ISAINFO, [isainfo], [no])
997.2.17 by Monty Taylor
Added check for isainfo so that we don't try to run it on Solaris.
214
AS_IF([test "x$ISAINFO" != "xno"],
215
      [isainfo_b=`isainfo -b`],
216
      [isainfo_b="x"])
971.4.1 by Monty Taylor
GCC on Solaris build fixes.
217
919.2.21 by Monty Taylor
Fixes for c++0x and shared_ptr support for Solaris.
218
# Build optimized or debug version ?
219
# First check for gcc and g++
1 by brian
clean slate
220
if test "$GCC" = "yes"
221
then
971.4.1 by Monty Taylor
GCC on Solaris build fixes.
222
  if test "$isainfo_b" = "64"
223
  then
224
    IS_64="-m64"
225
  fi
226
  AC_DEFINE([_GNU_SOURCE],[1],[Fix problem with S_ISLNK() on Linux])
227
919.2.21 by Monty Taylor
Fixes for c++0x and shared_ptr support for Solaris.
228
  dnl The following is required for portable results of floating point 
229
  dnl calculations on PowerPC. The same must also be done for IA-64, but 
230
  dnl this options is missing in the IA-64 gcc backend.
1 by brian
clean slate
231
  case "$host_cpu" in
232
    *ppc* | *powerpc*)
919.2.18 by Monty Taylor
Restructured CFLAGS processing to always keep user-supplied options last on the command line, so they take precedence.
233
      CFLAGS="-mno-fused-madd ${CFLAGS}"
234
      CXXFLAGS="-mno-fused-madd ${CXXFLAGS}"
1 by brian
clean slate
235
    ;;
236
  esac
919.2.21 by Monty Taylor
Fixes for c++0x and shared_ptr support for Solaris.
237
971.4.1 by Monty Taylor
GCC on Solaris build fixes.
238
  CFLAGS="-ggdb3 ${IS_64} -std=gnu99 ${CFLAGS}"
239
  CXXFLAGS="-ggdb3  ${IS_64} ${CXXFLAGS}"
919.2.21 by Monty Taylor
Fixes for c++0x and shared_ptr support for Solaris.
240
  AC_CXX_CHECK_STANDARD
919.2.16 by Monty Taylor
Added check for setting -std=gnu++0x if available.
241
  
873.2.36 by Monty Taylor
Fix to clean up flags.
242
243
  DEBUG_CFLAGS="-O0"
244
  DEBUG_CXXFLAGS="-O0"
245
520.4.40 by mordred
Added an option to specify --with-probuf=<location>
246
  OPTIMIZE_CFLAGS="-O3"
247
  OPTIMIZE_CXXFLAGS="-O3"
248
fi
249
if test "$SUNCC" = "yes"
250
then
971.4.1 by Monty Taylor
GCC on Solaris build fixes.
251
  if test "$isainfo_b" = "64"
252
  then
253
    IS_64="-m64"
254
  fi
919.2.22 by Monty Taylor
Fixed the latest stuff on Solaris.
255
  dnl we put CPPFLAGS and LDFLAGS first here, because if the user has specified
256
  dnl command line CPPFLAGS or LDFLAGS, their -I or -L should come _first_
685.1.20 by Monty Taylor
Fixed memalign for only on sparc.
257
  if test "$target_cpu" = "sparc"
258
  then
259
    MEMALIGN_FLAGS="-xmemalign=8s"
942.1.9 by Monty Taylor
Cleaned up 64-bit detection on Solaris.
260
  fi
261
968.2.1 by Monty Taylor
Build fix making 64-bit atomic<> work on 32-bit systems.
262
  if test "x$use_additional" != "xyes"
263
  then
997.2.17 by Monty Taylor
Added check for isainfo so that we don't try to run it on Solaris.
264
    AS_IF([test "$isainfo_b" != "none"],[
265
      LDFLAGS="${LDFLAGS} -L/usr/local/lib/${isainfo_b} -L/usr/local/lib -L/opt/csw/lib/${isainfo_b} -L/opt/csw/lib"
266
      ],[
267
      LDFLAGS="${LDFLAGS} -L/usr/local/lib -L/opt/csw/lib"
268
      ])
269
      CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/opt/csw/include"
968.2.1 by Monty Taylor
Build fix making 64-bit atomic<> work on 32-bit systems.
270
  fi
997.2.17 by Monty Taylor
Added check for isainfo so that we don't try to run it on Solaris.
271
  AS_IF([test "$isainfo_b" != "none"],
272
        [LDFLAGS="${LDFLAGS} -L/usr/lib/${isainfo_b}"])
908.1.11 by Monty Taylor
Fixed 64-bit flags for Solaris.
273
919.2.18 by Monty Taylor
Restructured CFLAGS processing to always keep user-supplied options last on the command line, so they take precedence.
274
  CXXFLAGS="-xlang=c99 -g -mt -compat=5 -library=stlport4 -template=no%extdef ${IS_64} ${MEMALIGN_FLAGS} ${CXXFLAGS}"
275
  CFLAGS="-g -mt -xc99=all ${IS_64} ${MEMALIGN_FLAGS} ${CFLAGS}"
873.2.36 by Monty Taylor
Fix to clean up flags.
276
  DEBUG_CFLAGS="-xO0"
277
  DEBUG_CXXFLAGS="-xO0" 
278
907.3.3 by Monty Taylor
A whole crapload of build fixes. OpenSolaris AMD64 builds with -m64 now by default... still isn't warning clean yet though. Also cleaned up the AM_*FLAGS situation.
279
  dnl TODO: -xO4 causes a Sun Studio failure in innodb... let's check back
280
  dnl       in on this one.
281
  OPTIMIZE_FLAGS="-xO3 -xlibmil -xdepend"
873.2.41 by Monty Taylor
Fixed the ol build for ol Solaris.
282
  OPTIMIZE_CFLAGS="${OPTIMIZE_FLAGS} -Xa -xstrconst"
779.1.12 by Monty Taylor
Possible build fixes for Solaris.
283
  OPTIMIZE_CXXFLAGS="${OPTIMIZE_FLAGS}"
907.3.2 by Monty Taylor
Added tests for 64-bit solaris. Look in /usr/lib/amd64 and /usr/local/lib/amd64 if we are 64-bit.
284
520.4.40 by mordred
Added an option to specify --with-probuf=<location>
285
fi
286
919.2.22 by Monty Taylor
Fixed the latest stuff on Solaris.
287
m4_include(m4/gettext.m4)
288
AM_GNU_GETTEXT(external, need-formatstring-macros)
289
if test "x$MSGMERGE" = "x" -o "x$MSGMERGE" = "x:"
290
then
291
  AM_PATH_PROG_WITH_TEST(GMSGMERGE, gmsgmerge,
292
    [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :)
293
  MSGMERGE="${GMSGMERGE}"
294
fi
295
AM_CONDITIONAL([BUILD_GETTEXT],[test "x$MSGMERGE" != "x" -a "x$MSGMERGE" != "x:"])
296
297
779.3.18 by Monty Taylor
Cleaned up warnings up through innodb.
298
# We use libtool
299
AC_PROG_LIBTOOL
300
520.4.40 by mordred
Added an option to specify --with-probuf=<location>
301
dnl TODO: Remove this define once we are using 2.61 across the board.
302
# AX_HEADER_ASSERT
303
# ----------------
304
# Check whether to enable assertions.
305
AC_DEFUN([AX_HEADER_ASSERT],
306
[
307
  AC_MSG_CHECKING([whether to enable assertions])
308
  AC_ARG_ENABLE([assert],
309
    [AS_HELP_STRING([--disable-assert],
310
       [Turn off assertions])],
311
    [ac_cv_assert="no"],
312
    [ac_cv_assert="yes"])
313
  AC_MSG_RESULT([$ac_cv_assert])
314
])
315
316
AX_HEADER_ASSERT
317
318
AC_ARG_WITH([debug],
319
    [AS_HELP_STRING([--with-debug],
320
       [Add debug code/turns off optimizations (yes|no) @<:@default=no@:>@])],
321
    [with_debug=$withval],
322
    [with_debug=no])
323
if test "$with_debug" = "yes"
324
then
873.2.36 by Monty Taylor
Fix to clean up flags.
325
  # Debuging. No optimization.
917.1.3 by Monty Taylor
Removed -DDEBUG - we don't use it and it breaks on Solaris.
326
  CFLAGS="${DEBUG_CFLAGS} ${CFLAGS}"
327
  CXXFLAGS="${DEBUG_CXXFLAGS} ${CXXFLAGS}"
520.4.40 by mordred
Added an option to specify --with-probuf=<location>
328
else
329
  # Optimized version. No debug
907.3.3 by Monty Taylor
A whole crapload of build fixes. OpenSolaris AMD64 builds with -m64 now by default... still isn't warning clean yet though. Also cleaned up the AM_*FLAGS situation.
330
  CFLAGS="${OPTIMIZE_CFLAGS} ${CFLAGS}"
331
  CXXFLAGS="${OPTIMIZE_CXXFLAGS} ${CXXFLAGS}"
520.4.40 by mordred
Added an option to specify --with-probuf=<location>
332
fi
1 by brian
clean slate
333
334
520.4.44 by mordred
A whole bunch of solaris/sun studio compile fixes.
335
AC_CXX_STL_HASH
336
AC_CXX_CSTDINT
337
AC_CXX_CINTTYPES
919.2.19 by Monty Taylor
Added check for shared_ptr in advance of actually thinking about using it. I think this should cover all platforms we care about... but let's doublecheck.
338
AC_CXX_SHARED_PTR
1 by brian
clean slate
339
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
340
DRIZZLE_PROG_AR
1 by brian
clean slate
341
779.2.1 by Monty Taylor
Added new pthread m4 file. Changing lib checks to use AC_LIB_HAVE_LINKFLAGS
342
AC_LIB_PREFIX
343
287.3.30 by Monty Taylor
Added step one of finding libprotobuf.
344
#--------------------------------------------------------------------
345
# Check for Google Proto Buffers
346
#--------------------------------------------------------------------
347
629.2.4 by Monty Taylor
Cleaned up the lib searching - now base some searches off of the prefix.
348
AC_LANG_PUSH([C++])
1025.2.1 by Monty Taylor
Added support for protobuf v2.1.0
349
AC_LIB_HAVE_LINKFLAGS(protobuf,pthread,
779.2.1 by Monty Taylor
Added new pthread m4 file. Changing lib checks to use AC_LIB_HAVE_LINKFLAGS
350
[#include <google/protobuf/descriptor.h>
351
],
992.1.5 by Monty Taylor
Added ability to make a searched-for lib use -isystem so we can do that for protobuf.
352
[google::protobuf::FileDescriptor* file;],system)
779.2.1 by Monty Taylor
Added new pthread m4 file. Changing lib checks to use AC_LIB_HAVE_LINKFLAGS
353
AS_IF([test x$ac_cv_libprotobuf = xno],
917.1.5 by Monty Taylor
Added more verbose failure messages.
354
      AC_MSG_ERROR([protobuf is required for Drizzle. On Debian this can be found in libprotobuf-dev. On RedHat this can be found in protobuf-devel.]))
629.2.4 by Monty Taylor
Cleaned up the lib searching - now base some searches off of the prefix.
355
910.2.2 by Monty Taylor
Split out protobuf version check from the check for protobuf version so that we can give better error message.
356
AC_CACHE_CHECK([if protobuf is recent enough], [drizzle_cv_protobuf_recent],
357
  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
358
#include <google/protobuf/descriptor.h>
359
#if GOOGLE_PROTOBUF_VERSION < 2000002
360
# error Your version of Protobuf is too old
361
#endif
362
    ]])],
363
    [drizzle_cv_protobuf_recent=yes],
364
    [drizzle_cv_protobuf_recent=no])])
365
if test "$drizzle_cv_protobuf_recent" = "no"
366
then
367
  AC_MSG_ERROR([Your version of Google Protocol Buffers is too old. Drizzle requires at least version 2.0.2])
368
fi
369
779.2.1 by Monty Taylor
Added new pthread m4 file. Changing lib checks to use AC_LIB_HAVE_LINKFLAGS
370
AC_PATH_PROG([PROTOC],[protoc],[no],[$LIBPROTOBUF_PREFIX/bin:$PATH])
520.4.47 by Monty Taylor
Added check for protoc to protobuf checks.
371
if test "x$PROTOC" = "xno"
372
then
917.1.5 by Monty Taylor
Added more verbose failure messages.
373
  AC_MSG_ERROR([Couldn't find the protoc compiler. On Debian this can be found in protobuf-compiler. On RedHat this can be found in protobuf-compiler.])
520.4.47 by Monty Taylor
Added check for protoc to protobuf checks.
374
fi
375
287.3.30 by Monty Taylor
Added step one of finding libprotobuf.
376
AC_LANG_POP()
77.1.111 by Monty Taylor
Added --enable-tcmalloc which will enable searching for and linking with tcmalloc if you have it.
377
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
378
#--------------------------------------------------------------------
520.4.27 by Monty Taylor
Fail if we don't find uuid/uuid.h.
379
# Check for libuuid
380
#--------------------------------------------------------------------
381
779.2.1 by Monty Taylor
Added new pthread m4 file. Changing lib checks to use AC_LIB_HAVE_LINKFLAGS
382
dnl Do this by hand. Need to check for uuid/uuid.h, but uuid may or may
383
dnl not be a lib is weird.
384
590.2.13 by Monty Taylor
Reverted libuuid check code.
385
AC_CHECK_HEADERS(uuid/uuid.h)
386
if test "x$ac_cv_header_uuid_uuid_h" = "xno"
387
then
917.1.5 by Monty Taylor
Added more verbose failure messages.
388
  AC_MSG_ERROR([Couldn't find uuid/uuid.h. On Debian this can be found in uuid-dev. On Redhat this can be found in e2fsprogs-devel.])
590.2.13 by Monty Taylor
Reverted libuuid check code.
389
fi
779.2.3 by Monty Taylor
Added stdlib.h depend for readline.
390
AC_LIB_HAVE_LINKFLAGS(uuid,,
391
[
392
#include <uuid/uuid.h>
393
],
394
[
395
  uuid_t uout;
396
  uuid_generate(uout);
397
])
398
134.2.1 by Antony Curtis
Changes for proper detection of libraries
399
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
400
401
#--------------------------------------------------------------------
402
# Check for libpthread
403
#--------------------------------------------------------------------
404
779.2.1 by Monty Taylor
Added new pthread m4 file. Changing lib checks to use AC_LIB_HAVE_LINKFLAGS
405
ACX_PTHREAD(,AC_MSG_ERROR(could not find libpthread))
406
LIBS="$PTHREAD_LIBS $LIBS"
907.3.3 by Monty Taylor
A whole crapload of build fixes. OpenSolaris AMD64 builds with -m64 now by default... still isn't warning clean yet though. Also cleaned up the AM_*FLAGS situation.
407
CFLAGS="${CFLAGS} ${PTHREAD_CFLAGS}"
779.2.1 by Monty Taylor
Added new pthread m4 file. Changing lib checks to use AC_LIB_HAVE_LINKFLAGS
408
CC="$PTHREAD_CC"
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
409
410
#--------------------------------------------------------------------
612.2.5 by Monty Taylor
Added test for mtmalloc, if we haven't explicitly asked for tcmalloc.
411
# Check for tcmalloc/mtmalloc
77.1.111 by Monty Taylor
Added --enable-tcmalloc which will enable searching for and linking with tcmalloc if you have it.
412
#--------------------------------------------------------------------
413
1022.2.31 by Monty Taylor
Added support for checking for tcmalloc-minimal.
414
case "$target_os" in
415
  *linux*)
416
    AC_ARG_ENABLE([tcmalloc],
417
      [AS_HELP_STRING([--disable-tcmalloc],
418
         [Enable linking with tcmalloc @<:@default=on@:>@])],
419
      [ac_enable_tcmalloc="$enableval"],
420
      [ac_enable_tcmalloc="yes"])
421
422
    if test "x$ac_enable_tcmalloc" != "xno"
423
    then
424
      AC_CHECK_LIB(tcmalloc-minimal,malloc,[],[])
425
426
      if test "x$ac_cv_lib_tcmalloc_minimal_malloc" != "xyes"
427
      then
428
        AC_CHECK_LIB(tcmalloc,malloc,[],[])
429
      fi
430
    fi
431
432
    ;;
433
  *solaris*)
1022.2.32 by Monty Taylor
Finished splitting out per-platform logic for tcmalloc/mtmalloc.
434
    AC_ARG_ENABLE([mtmalloc],
435
      [AS_HELP_STRING([--disable-mtmalloc],
436
         [Enable linking with mtmalloc @<:@default=on@:>@])],
437
      [ac_enable_mtmalloc="$enableval"],
438
      [ac_enable_mtmalloc="yes"])
439
1022.2.33 by Monty Taylor
Except that I suck.
440
    if test "x$ac_enable_mtmalloc" != "xno"
1022.2.32 by Monty Taylor
Finished splitting out per-platform logic for tcmalloc/mtmalloc.
441
    then
442
      AC_CHECK_LIB(mtmalloc,malloc,[],[])
443
    fi
1022.2.31 by Monty Taylor
Added support for checking for tcmalloc-minimal.
444
    ;;
445
esac
612.2.5 by Monty Taylor
Added test for mtmalloc, if we haven't explicitly asked for tcmalloc.
446
779.2.1 by Monty Taylor
Added new pthread m4 file. Changing lib checks to use AC_LIB_HAVE_LINKFLAGS
447
77.1.111 by Monty Taylor
Added --enable-tcmalloc which will enable searching for and linking with tcmalloc if you have it.
448
#--------------------------------------------------------------------
779.1.15 by Monty Taylor
Added libdrizzle configure support.
449
# Check for libdrizzle
450
#--------------------------------------------------------------------
451
452
AC_LIB_HAVE_LINKFLAGS(drizzle,,
453
[#include <libdrizzle/drizzle.h>],
454
[
455
  const char *version= drizzle_version()
456
])
928.1.1 by Eric Day
Started client changes.
457
AS_IF([test x$ac_cv_libdrizzle = xno],
458
      AC_MSG_ERROR([libdrizzle is required for Drizzle]))
779.1.15 by Monty Taylor
Added libdrizzle configure support.
459
460
461
#--------------------------------------------------------------------
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
462
# Check for libz
463
#--------------------------------------------------------------------
464
779.2.1 by Monty Taylor
Added new pthread m4 file. Changing lib checks to use AC_LIB_HAVE_LINKFLAGS
465
AC_LIB_HAVE_LINKFLAGS(z,,
466
[#include <zlib.h>],
467
[
468
  crc32(0, Z_NULL, 0);
469
])
470
AS_IF([test x$ac_cv_libz = xno],
917.1.5 by Monty Taylor
Added more verbose failure messages.
471
      AC_MSG_ERROR([libz is required for Drizzle. On Debian this can be found in zlib1g-dev. On RedHat this can be found in zlib-devel.]))
201.2.3 by Monty Taylor
Cleaned up some LIBS bits in the build.
472
612.2.9 by Monty Taylor
Woot. No more extra CFLAGS on the command line!
473
#--------------------------------------------------------------------
910.5.2 by Monty Taylor
Applied atomic patch to current tree.
474
# Check for TBB
475
#--------------------------------------------------------------------
476
477
AC_LANG_PUSH(C++)
478
AC_LIB_HAVE_LINKFLAGS(tbb,,
479
[#include <tbb/atomic.h>
480
 #include <stdint.h>
481
],
482
[
483
  tbb::atomic<uint64_t> x;
484
  tbb::atomic<uint8_t> y;
485
  x=0;
486
  y=0;
487
  x++;
488
  y++;
489
])
490
AC_LANG_POP()
491
492
#--------------------------------------------------------------------
182.1.5 by Jim Winstead
Detect and make the Mac OS X libedit readline interface look like the
493
# Check for libreadline or compatible (libedit on Mac OS X)
494
#--------------------------------------------------------------------
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
495
779.2.5 by Monty Taylor
Split out readline.
496
save_LIBS="${LIBS}"
497
LIBS=""
779.2.4 by Monty Taylor
Updated some more build stuff.
498
VL_LIB_READLINE
873.2.4 by Monty Taylor
Fixed some configure errors.
499
AS_IF([test "x$vl_cv_lib_readline" = "xno"],
917.1.5 by Monty Taylor
Added more verbose failure messages.
500
      AC_MSG_ERROR([libreadline is required for Drizzle. On Debian this can be found in libreadline5-dev. On RedHat this can be found in readline-devel.]))
779.2.5 by Monty Taylor
Split out readline.
501
READLINE_LIBS="${LIBS}"
502
LIBS="${save_LIBS}"
503
AC_SUBST(READLINE_LIBS)
207.1.2 by Jim Winstead
Fix test for libreadline to test a function that exists in all usable
504
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
505
DRIZZLE_CHECK_NEW_RL_INTERFACE
287.3.30 by Monty Taylor
Added step one of finding libprotobuf.
506
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
507
#--------------------------------------------------------------------
508
# Check for libpcre
509
#--------------------------------------------------------------------
510
971.5.2 by Eric Day
Fixed more autoconf bugs.
511
AC_LIB_HAVE_LINKFLAGS(pcre,,
512
[#include <pcre.h>],
513
[
514
  pcre *re= NULL;
515
  pcre_version();
516
])
971.5.1 by Eric Day
Fix for bug #372367, pcre header detection.
517
AS_IF([test "x$ac_cv_libpcre" = "xno"],
518
[
914.1.1 by Monty Taylor
Quick OpenSolaris build fix.
519
  unset ac_cv_libpcre
971.5.2 by Eric Day
Fixed more autoconf bugs.
520
  unset HAVE_LIBPCRE
521
  unset LIBPCRE
522
  unset LIBPCRE_PREFIX
523
  unset LTLIBPCRE
524
  AC_LIB_HAVE_LINKFLAGS(pcre,,
525
  [#include <pcre/pcre.h>],
526
  [
527
    pcre *re= NULL;
528
    pcre_version();
529
  ])
914.1.1 by Monty Taylor
Quick OpenSolaris build fix.
530
  AS_IF([test "x$ac_cv_libpcre" = "xno"],
971.5.1 by Eric Day
Fix for bug #372367, pcre header detection.
531
  [
532
    AC_MSG_ERROR([libpcre is required for Drizzle. On Debian this can be found in libpcre3-dev. On RedHat this can be found in pcre-devel.])
533
  ],[
534
    AC_DEFINE(PCRE_HEADER,[<pcre/pcre.h>],[Location of pcre header])
535
  ])
914.1.1 by Monty Taylor
Quick OpenSolaris build fix.
536
],[
537
  AC_DEFINE(PCRE_HEADER,[<pcre.h>],[Location of pcre header])
538
])
779.2.9 by Monty Taylor
Put back in pkg-config check- pcre.h is in /usr/include for older versions and
539
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
540
1 by brian
clean slate
541
dnl Find paths to some shell programs
542
AC_PATH_PROG(LN, ln, ln)
543
# This must be able to take a -f flag like normal unix ln.
544
AC_PATH_PROG(LN_CP_F, ln, ln)
545
546
AC_PATH_PROG(MV, mv, mv)
547
AC_PATH_PROG(RM, rm, rm)
548
AC_PATH_PROG(CP, cp, cp)
549
AC_PATH_PROG(SED, sed, sed)
550
AC_PATH_PROG(CMP, cmp, cmp)
551
AC_PATH_PROG(CHMOD, chmod, chmod)
552
AC_PATH_PROG(HOSTNAME, hostname, hostname)
553
# Check for a GNU tar named 'gtar', or 'gnutar' (MacOS X) and
554
# fall back to 'tar' otherwise and hope that it's a GNU tar as well
555
AC_CHECK_PROGS(TAR, gnutar gtar tar)
556
557
dnl We use a path for perl so the script startup works
558
dnl We make sure to use perl, not perl5, in hopes that the RPMs will
559
dnl not depend on the perl5 binary being installed (probably a bug in RPM)
560
AC_PATH_PROG(PERL, perl, no)
561
if test "$PERL" != "no" && $PERL -e 'require 5' > /dev/null 2>&1
562
then
563
  PERL5=$PERL
564
else
565
  AC_PATH_PROG(PERL5, perl5, no)
566
  if test "$PERL5" != no
567
  then
568
    PERL=$PERL5
569
    ac_cv_path_PERL=$ac_cv_path_PERL5
570
  fi
571
fi
572
573
AC_SUBST(HOSTNAME)
574
AC_SUBST(PERL)
575
AC_SUBST(PERL5)
576
577
# icheck, used for ABI check
578
AC_PATH_PROG(ICHECK, icheck, no)
579
# "icheck" is also the name of a file system check program on Tru64.
580
# Verify the program found is really the interface checker.
581
if test "x$ICHECK" != "xno"
582
then
583
  AC_MSG_CHECKING(if $ICHECK works as expected)
584
  echo "int foo;" > conftest.h
585
  $ICHECK --canonify -o conftest.ic conftest.h 2>/dev/null
586
  if test -f "conftest.ic"
587
  then
588
    AC_MSG_RESULT(yes)
589
  else
590
    AC_MSG_RESULT(no)
591
    ICHECK=no
592
  fi
593
  rm -f conftest.ic conftest.h
594
fi
595
AC_SUBST(ICHECK)
596
597
# Lock for PS
598
AC_PATH_PROG(PS, ps, ps)
599
AC_MSG_CHECKING("how to check if pid exists")
600
PS=$ac_cv_path_PS
601
# Linux style
632.1.7 by Monty
Reworked grep change to work with old crappy autoconfs.
602
if $PS p $$ 2> /dev/null | grep `echo $0 | sed s/\-//` > /dev/null
1 by brian
clean slate
603
then
632.1.7 by Monty
Reworked grep change to work with old crappy autoconfs.
604
  FIND_PROC="$PS p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
1 by brian
clean slate
605
# Solaris
632.1.7 by Monty
Reworked grep change to work with old crappy autoconfs.
606
elif $PS -fp $$ 2> /dev/null | grep $0 > /dev/null
1 by brian
clean slate
607
then
632.1.7 by Monty
Reworked grep change to work with old crappy autoconfs.
608
  FIND_PROC="$PS -p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
1 by brian
clean slate
609
# BSD style
632.1.7 by Monty
Reworked grep change to work with old crappy autoconfs.
610
elif $PS -uaxww 2> /dev/null | grep $0 > /dev/null
1 by brian
clean slate
611
then
632.1.7 by Monty
Reworked grep change to work with old crappy autoconfs.
612
  FIND_PROC="$PS -uaxww | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
1 by brian
clean slate
613
# SysV style
632.1.7 by Monty
Reworked grep change to work with old crappy autoconfs.
614
elif $PS -ef 2> /dev/null | grep $0 > /dev/null
1 by brian
clean slate
615
then
632.1.7 by Monty
Reworked grep change to work with old crappy autoconfs.
616
  FIND_PROC="$PS -ef | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
1 by brian
clean slate
617
# Do anybody use this?
632.1.7 by Monty
Reworked grep change to work with old crappy autoconfs.
618
elif $PS $$ 2> /dev/null | grep $0 > /dev/null
1 by brian
clean slate
619
then
632.1.7 by Monty
Reworked grep change to work with old crappy autoconfs.
620
  FIND_PROC="$PS \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
1 by brian
clean slate
621
else
622
  case $SYSTEM_TYPE in
394 by Monty Taylor
Fix configure problem on cygwin. Thanks awfief.
623
    *freebsd*|*dragonfly*|*cygwin*)
632.1.7 by Monty
Reworked grep change to work with old crappy autoconfs.
624
      FIND_PROC="$PS p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
1 by brian
clean slate
625
      ;;
626
    *darwin*)
632.1.7 by Monty
Reworked grep change to work with old crappy autoconfs.
627
      FIND_PROC="$PS -uaxww | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
1 by brian
clean slate
628
      ;;
629
    *)
630
      AC_MSG_ERROR([Could not find the right ps switches. Which OS is this ?. See the Installation chapter in the Reference Manual.])
236.1.39 by Monty Taylor
autoconf warning cleanups.
631
      ;;
1 by brian
clean slate
632
  esac
633
fi
634
AC_SUBST(FIND_PROC)
635
AC_MSG_RESULT("$FIND_PROC")
636
637
# Check if a pid is valid
638
AC_PATH_PROG(KILL, kill, kill)
639
AC_MSG_CHECKING("for kill switches")
640
if $ac_cv_path_KILL -0 $$
641
then
642
  CHECK_PID="$ac_cv_path_KILL -0 \$\$PID > /dev/null 2> /dev/null"
643
elif kill -s 0 $$
644
then
645
  CHECK_PID="$ac_cv_path_KILL -s 0 \$\$PID > /dev/null 2> /dev/null"
646
else
647
  AC_MSG_WARN([kill -0 to check for pid seems to fail])
648
    CHECK_PID="$ac_cv_path_KILL -s SIGCONT \$\$PID > /dev/null 2> /dev/null"
649
fi
650
AC_SUBST(CHECK_PID)
651
AC_MSG_RESULT("$CHECK_PID")
652
653
654
# Check if we need noexec stack for assembler
655
AC_CHECK_NOEXECSTACK
656
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
657
AC_ARG_WITH([server-suffix],
658
    [AS_HELP_STRING([--with-server-suffix],
659
      [Append value to the version string.])],
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
660
    [ DRIZZLE_SERVER_SUFFIX=`echo "$withval" | sed -e  's/^\(...................................\)..*$/\1/'` ],
661
    [ DRIZZLE_SERVER_SUFFIX= ]
1 by brian
clean slate
662
    )
546 by Monty Taylor
Cleaned up version.h. (And by cleaned, I mean removed)
663
AC_DEFINE_UNQUOTED([DRIZZLE_SERVER_SUFFIX],[$DRIZZLE_SERVER_SUFFIX],
664
                   [Append value to the version string])
1 by brian
clean slate
665
666
# Force use of a curses libs
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
667
AC_ARG_WITH([named-curses-libs],
668
    [AS_HELP_STRING([--with-named-curses-libs=ARG],
669
            [Use specified curses libraries instead of those
670
		automatically found by configure.])],
1 by brian
clean slate
671
    [ with_named_curses=$withval ],
672
    [ with_named_curses=no ]
673
    )
674
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
675
AC_ARG_WITH([tcp-port],
676
    [AS_HELP_STRING([--with-tcp-port=port-number],
165.1.1 by Elliot Murphy
new port number from IANA
677
            [Which port to use for Drizzle services @<:@default=4427@:>@])],
301 by Brian Aker
Clean up port startup
678
    [ DRIZZLE_TCP_PORT=$withval ],
679
    [ DRIZZLE_TCP_PORT=$DRIZZLE_TCP_PORT_DEFAULT
1 by brian
clean slate
680
      # if we actually defaulted (as opposed to the pathological case of
301 by Brian Aker
Clean up port startup
681
      # --with-tcp-port=<DRIZZLE_TCP_PORT_DEFAULT> which might in theory
1 by brian
clean slate
682
      # happen if whole batch of servers was built from a script), set
683
      # the default to zero to indicate that; we don't lose information
684
      # that way, because 0 obviously indicates that we can get the
301 by Brian Aker
Clean up port startup
685
      # default value from DRIZZLE_TCP_PORT. this seems really evil, but
686
      # testing for DRIZZLE_TCP_PORT==DRIZZLE_TCP_PORT_DEFAULT would make a
687
      # a port of DRIZZLE_TCP_PORT_DEFAULT magic even if the builder did not
1 by brian
clean slate
688
      # intend it to mean "use the default, in fact, look up a good default
165.1.1 by Elliot Murphy
new port number from IANA
689
      # from /etc/services if you can", but really, really meant 4427 when
690
      # they passed in 4427. When they pass in a specific value, let them
1 by brian
clean slate
691
      # have it; don't second guess user and think we know better, this will
692
      # just make people cross.  this makes the the logic work like this
693
      # (which is complicated enough):
694
      #
695
      # - if a port was set during build, use that as a default.
696
      #
697
      # - otherwise, try to look up a port in /etc/services; if that fails,
301 by Brian Aker
Clean up port startup
698
      #   use DRIZZLE_TCP_PORT_DEFAULT (at the time of this writing 4427)
1 by brian
clean slate
699
      #
301 by Brian Aker
Clean up port startup
700
      # - allow the DRIZZLE_TCP_PORT environment variable to override that.
1 by brian
clean slate
701
      #
702
      # - allow command-line parameters to override all of the above.
703
      #
301 by Brian Aker
Clean up port startup
704
      # the top-most DRIZZLE_TCP_PORT_DEFAULT is read from win/configure.js,
1 by brian
clean slate
705
      # so don't mess with that.
301 by Brian Aker
Clean up port startup
706
      DRIZZLE_TCP_PORT_DEFAULT=0 ]
1 by brian
clean slate
707
    )
301 by Brian Aker
Clean up port startup
708
AC_SUBST(DRIZZLE_TCP_PORT)
1 by brian
clean slate
709
# We might want to document the assigned port in the manual.
301 by Brian Aker
Clean up port startup
710
AC_SUBST(DRIZZLE_TCP_PORT_DEFAULT)
546 by Monty Taylor
Cleaned up version.h. (And by cleaned, I mean removed)
711
AC_DEFINE_UNQUOTED([DRIZZLE_PORT],[$DRIZZLE_TCP_PORT],
712
                   [Drizzle port to use])
713
AC_DEFINE_UNQUOTED([DRIZZLE_PORT_DEFAULT],[$DRIZZLE_TCP_PORT_DEFAULT],
714
		   [If we defaulted to DRIZZLE_PORT, then this will be zero])
1 by brian
clean slate
715
716
# Use this to set the place used for unix socket used to local communication.
572.2.1 by ysano
Replace --with-mysqld-user configure option with --with-drizzled-user.
717
AC_ARG_WITH([drizzled-user],
718
    [AS_HELP_STRING([--with-drizzled-user=username],
719
            [What user the drizzled daemon shall be run as.
720
		@<:@default=drizzle@:>@])],
721
    [ DRIZZLED_USER=$withval ],
722
    [ DRIZZLED_USER=drizzle ]
1 by brian
clean slate
723
    )
572.2.1 by ysano
Replace --with-mysqld-user configure option with --with-drizzled-user.
724
AC_SUBST(DRIZZLED_USER)
1 by brian
clean slate
725
726
# If we should allow LOAD DATA LOCAL
727
AC_MSG_CHECKING(If we should should enable LOAD DATA LOCAL by default)
728
AC_ARG_ENABLE(local-infile,
729
    [  --enable-local-infile   Enable LOAD DATA LOCAL INFILE (default: disabled)],
730
    [ ENABLED_LOCAL_INFILE=$enableval ],
731
    [ ENABLED_LOCAL_INFILE=no ]
732
    )
733
if test "$ENABLED_LOCAL_INFILE" = "yes"
734
then
735
  AC_MSG_RESULT([yes])
736
  AC_DEFINE([ENABLED_LOCAL_INFILE], [1],
737
            [If LOAD DATA LOCAL INFILE should be enabled by default])
738
else
739
  AC_MSG_RESULT([no])
740
fi
741
742
# Types that must be checked AFTER large file support is checked
743
AC_TYPE_SIZE_T
744
745
#--------------------------------------------------------------------
746
# Check for system header files
747
#--------------------------------------------------------------------
748
749
AC_HEADER_DIRENT
750
AC_HEADER_STDC
751
AC_HEADER_SYS_WAIT
53.2.2 by Monty Taylor
Updated everything that needs updating to compile with -std=gnu99 -pedantic
752
AC_HEADER_STDBOOL
77.1.22 by Monty Taylor
Removed refs to floatingpoint.h (which we only used for fconvert) and fconvert
753
AC_CHECK_HEADERS(fcntl.h float.h fpu_control.h ieeefp.h)
53.2.29 by Monty Taylor
Cleaned up headers a little more.
754
AC_CHECK_HEADERS(limits.h pwd.h select.h linux/config.h)
755
AC_CHECK_HEADERS(sys/fpu.h utime.h sys/utime.h )
572.1.4 by Monty Taylor
Removed a bunch of unusued tests and defines from autoconf.
756
AC_CHECK_HEADERS(synch.h sys/mman.h sys/socket.h)
520.4.41 by mordred
Fixed configure.ac to work cleanly on Solaris - and define some good compile flags.
757
AC_CHECK_HEADERS([curses.h term.h],[],[],
758
[[#ifdef HAVE_CURSES_H
759
# include <curses.h>
760
#endif
761
]])
202.1.4 by Monty Taylor
Removed openssl refs.
762
AC_CHECK_HEADERS(termio.h termios.h sched.h alloca.h)
572.1.4 by Monty Taylor
Removed a bunch of unusued tests and defines from autoconf.
763
AC_CHECK_HEADERS(sys/prctl.h ieeefp.h)
53.2.29 by Monty Taylor
Cleaned up headers a little more.
764
AC_CHECK_HEADERS(execinfo.h)
1 by brian
clean slate
765
77.1.31 by Monty Taylor
Replaced regex lib with pcre. Reworked mysqltest to use it.
766
#--------------------------------------------------------------------
1 by brian
clean slate
767
# Check for system libraries. Adds the library to $LIBS
768
# and defines HAVE_LIBM etc
769
#--------------------------------------------------------------------
770
771
AC_CHECK_LIB(m, floor, [], AC_CHECK_LIB(m, __infinity))
772
236.1.39 by Monty Taylor
autoconf warning cleanups.
773
AC_CHECK_FUNC(setsockopt, [], [AC_CHECK_LIB(socket, setsockopt)])
774
AC_CHECK_FUNC(yp_get_default_domain, [],
775
  [AC_CHECK_LIB(nsl, yp_get_default_domain)])
776
AC_CHECK_FUNC(p2open, [], [AC_CHECK_LIB(gen, p2open)])
1 by brian
clean slate
777
# This may get things to compile even if bind-8 is installed
236.1.39 by Monty Taylor
autoconf warning cleanups.
778
AC_CHECK_FUNC(bind, [], [AC_CHECK_LIB(bind, bind)])
1 by brian
clean slate
779
# Check if crypt() exists in libc or libcrypt, sets LIBS if needed
780
AC_SEARCH_LIBS(crypt, crypt, AC_DEFINE(HAVE_CRYPT, 1, [crypt]))
781
782
# Check rt for aio_read
783
AC_CHECK_LIB(rt, aio_read)
784
785
# For the sched_yield() function on Solaris
236.1.39 by Monty Taylor
autoconf warning cleanups.
786
AC_CHECK_FUNC(sched_yield, [],
787
  [AC_CHECK_LIB(posix4, [sched_yield],
997.2.8 by Monty Taylor
Fixed a few loose ends.
788
    [AC_DEFINE(HAVE_SCHED_YIELD, 1, [Have sched_yield function]) LIBS="$LIBS -lposix4"])])
1 by brian
clean slate
789
790
if test "$ac_cv_header_termio_h" = "no" -a "$ac_cv_header_termios_h" = "no"
791
then
236.1.39 by Monty Taylor
autoconf warning cleanups.
792
  AC_CHECK_FUNC(gtty, [], [AC_CHECK_LIB(compat, gtty)])
1 by brian
clean slate
793
fi
794
795
AC_CHECK_TYPES([fp_except], [], [], [
796
#include <sys/types.h>
797
#include <ieeefp.h>
798
])
799
25 by Brian Aker
Clean up of configure.in
800
my_save_LIBS="$LIBS"
801
LIBS=""
802
AC_CHECK_LIB(dl,dlopen)
572.1.4 by Monty Taylor
Removed a bunch of unusued tests and defines from autoconf.
803
AC_CHECK_FUNCS(dlopen)
177.3.1 by mark
remove ifdef HAVE_DLOPEN, make configure require dlopen()
804
if test "$ac_cv_func_dlopen" != "yes"
805
then
806
  AC_MSG_ERROR([Drizzle requires dlopen])
807
fi
201.2.3 by Monty Taylor
Cleaned up some LIBS bits in the build.
808
LIBDL_LIBS="$LIBS"
25 by Brian Aker
Clean up of configure.in
809
LIBS="$my_save_LIBS"
201.2.3 by Monty Taylor
Cleaned up some LIBS bits in the build.
810
AC_SUBST(LIBDL_LIBS)
25 by Brian Aker
Clean up of configure.in
811
201.2.4 by Monty Taylor
Re-enabled optimizations for the normal build, and added back the --with-debug option to turn them off.
812
840.1.6 by Monty Taylor
Added back atomic builtins check.
813
AC_ARG_WITH([atomic-ops],
840.1.12 by Monty Taylor
Updated AC_HELP_STRING to AS_HELP_STRING
814
    [AS_HELP_STRING([--with-atomic-ops=rwlocks|smp|up],
815
       [Implement atomic operations using pthread rwlocks or atomic CPU
816
        instructions for multi-processor or uniprocessor
817
        configuration. By default gcc built-in sync functions are used,
818
        if available and 'smp' configuration otherwise.])],
819
    [with_atomic_ops="$withval"],
820
    [with_atomic_ops=smp])
840.1.6 by Monty Taylor
Added back atomic builtins check.
821
822
case "$with_atomic_ops" in
823
  "up") AC_DEFINE([MY_ATOMIC_MODE_DUMMY], [1],
824
                  [Assume single-CPU mode, no concurrency]) ;;
825
  "rwlocks") AC_DEFINE([MY_ATOMIC_MODE_RWLOCKS], [1],
826
                  [Use pthread rwlocks for atomic ops]) ;;
910.5.2 by Monty Taylor
Applied atomic patch to current tree.
827
  "smp") 
840.1.6 by Monty Taylor
Added back atomic builtins check.
828
    AC_CACHE_CHECK(
829
      [whether the compiler provides atomic builtins],
830
      [ac_cv_gcc_atomic_builtins],
942.1.5 by Monty Taylor
Replace AC_TRY_* with AC_*_IFELSE
831
      [AC_RUN_IFELSE(
832
        [AC_LANG_PROGRAM([],[[
840.1.6 by Monty Taylor
Added back atomic builtins check.
833
          int foo= -10; int bar= 10;
834
          if (!__sync_fetch_and_add(&foo, bar) || foo)
835
            return -1;
836
          bar= __sync_lock_test_and_set(&foo, bar);
837
          if (bar || foo != 10)
838
            return -1;
839
          bar= __sync_val_compare_and_swap(&bar, foo, 15);
840
          if (bar)
841
            return -1;
842
          return 0;
942.1.5 by Monty Taylor
Replace AC_TRY_* with AC_*_IFELSE
843
        ]])],
840.1.6 by Monty Taylor
Added back atomic builtins check.
844
       [ac_cv_gcc_atomic_builtins=yes],
845
       [ac_cv_gcc_atomic_builtins=no])])
846
847
    if test "x$ac_cv_gcc_atomic_builtins" = "xyes"; then
848
      AC_DEFINE(HAVE_GCC_ATOMIC_BUILTINS, 1,
849
                [Define to 1 if compiler provides atomic builtins.])
850
    fi
851
   ;;
852
   *) AC_MSG_ERROR(["$with_atomic_ops" is not a valid value for --with-atomic-ops]) ;;
853
esac
854
855
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
856
AC_ARG_WITH([comment],
857
    [AS_HELP_STRING([--with-comment],
858
            [Comment about compilation environment. @<:@default=off@:>@])],
1 by brian
clean slate
859
    [with_comment=$withval],
860
    [with_comment=no])
861
if test "$with_comment" != "no"
862
then
863
  COMPILATION_COMMENT=$with_comment
864
else
865
  COMPILATION_COMMENT="Source distribution"
866
fi
546 by Monty Taylor
Cleaned up version.h. (And by cleaned, I mean removed)
867
AC_DEFINE_UNQUOTED([COMPILATION_COMMENT],["$COMPILATION_COMMENT"],
868
                   [Comment about compilation environment])
1 by brian
clean slate
869
870
dnl Checks for typedefs, structures, and compiler characteristics.
871
AC_C_CONST
872
AC_C_INLINE
590.2.2 by Monty Taylor
Configure cleanups. Added generic search_for_lib m4 macro.
873
AC_C_VOLATILE
1 by brian
clean slate
874
AC_TYPE_OFF_T
875
AC_HEADER_TIME
876
AC_STRUCT_TM
877
# off_t is not a builtin type
878
AC_CHECK_SIZEOF(off_t, 4)
879
if test "$ac_cv_sizeof_off_t" -eq 0
880
then
91 by Brian Aker
Main binary now named drizzled
881
  AC_MSG_ERROR("Drizzle needs a off_t type.")
1 by brian
clean slate
882
fi
968.2.1 by Monty Taylor
Build fix making 64-bit atomic<> work on 32-bit systems.
883
AC_CHECK_SIZEOF(size_t)
884
AC_DEFINE_UNQUOTED([SIZEOF_SIZE_T],[$ac_cv_sizeof_size_t],[Size of size_t as computed by sizeof()])
885
AC_CHECK_SIZEOF(long long)
886
AC_DEFINE_UNQUOTED(SIZEOF_LONG_LONG,[$ac_cv_sizeof_long_long],[Size of long long as computed by sizeof()])
1 by brian
clean slate
887
888
dnl
889
dnl check if time_t is unsigned
890
dnl
891
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
892
DRIZZLE_CHECK_TIME_T
1 by brian
clean slate
893
894
895
# This always gives a warning. Ignore it unless you are cross compiling
896
AC_C_BIGENDIAN
942.1.7 by Monty Taylor
Removed check for rlimit64... we set FILE_OFFSET_BITS properly, so it's not necessary on modern unixes (post 1998-ish)
897
1 by brian
clean slate
898
# Find where the stack goes
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
899
DRIZZLE_STACK_DIRECTION
1 by brian
clean slate
900
# We want to skip alloca on irix unconditionally. It may work on some version..
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
901
DRIZZLE_FUNC_ALLOCA
942.1.8 by Monty Taylor
Removed more unused macros/things we don't need to check because they are posix.
902
1 by brian
clean slate
903
AC_CHECK_TYPES([sigset_t, off_t], [], [], [#include <sys/types.h>])
520.4.43 by mordred
A set of Solaris fixes.
904
AC_CHECK_TYPES([uint, ulong])
1 by brian
clean slate
905
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
906
DRIZZLE_PTHREAD_YIELD
1 by brian
clean slate
907
134.2.1 by Antony Curtis
Changes for proper detection of libraries
908
1 by brian
clean slate
909
dnl Checks for header files.
572.1.4 by Monty Taylor
Removed a bunch of unusued tests and defines from autoconf.
910
AC_CHECK_HEADERS(malloc.h)
1 by brian
clean slate
911
912
dnl Checks for library functions.
913
AC_FUNC_ALLOCA
914
AC_PROG_GCC_TRADITIONAL
915
AC_TYPE_SIGNAL
572.1.4 by Monty Taylor
Removed a bunch of unusued tests and defines from autoconf.
916
1 by brian
clean slate
917
AC_CHECK_FUNCS(issetugid)
918
919
# from old readline settting:
920
921
MAKE_SHELL=/bin/sh
922
AC_SUBST(MAKE_SHELL)
923
924
# Already-done: stdlib.h string.h unistd.h termios.h
398.1.9 by Monty Taylor
Cleaned up stuff out of global.h.
925
AC_CHECK_HEADERS(stdarg.h dirent.h locale.h ndir.h sys/dir.h \
572.1.4 by Monty Taylor
Removed a bunch of unusued tests and defines from autoconf.
926
 sys/ndir.h sys/select.h \
927
 sys/mman.h termcap.h termio.h asm/termbits.h grp.h \
928
 paths.h)
1 by brian
clean slate
929
930
# Already-done: strcasecmp
572.1.4 by Monty Taylor
Removed a bunch of unusued tests and defines from autoconf.
931
AC_CHECK_FUNCS(lstat select)
1 by brian
clean slate
932
28.1.33 by Monty Taylor
Added -Wall
933
AC_HEADER_STAT
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
934
DRIZZLE_SIGNAL_CHECK
935
DRIZZLE_CHECK_GETPW_FUNCS
936
DRIZZLE_HAVE_TIOCGWINSZ
937
DRIZZLE_HAVE_TIOCSTAT
1 by brian
clean slate
938
939
#########################################################################
940
941
dnl Checks for library functions.
942
943
AC_FUNC_UTIME_NULL
944
AC_FUNC_VPRINTF
945
77.1.24 by Monty Taylor
Removed non-fcntl code and made it a fatal configure error if it's not there.
946
AC_CHECK_FUNCS(fcntl)
947
if test "x$ac_cv_func_fcntl" != "xyes"
948
then
949
  AC_MSG_ERROR("Drizzle requires fcntl.")
950
fi
951
815.1.6 by Monty Taylor
Some tweaks to get timegm working on Solaris.
952
AC_CONFIG_LIBOBJ_DIR([gnulib])
236.1.50 by Monty Taylor
Added automake conditional compilation of distributed system replacement functions.
953
572.1.4 by Monty Taylor
Removed a bunch of unusued tests and defines from autoconf.
954
AC_CHECK_FUNCS( \
77.1.24 by Monty Taylor
Removed non-fcntl code and made it a fatal configure error if it's not there.
955
  cuserid fchmod \
572.1.4 by Monty Taylor
Removed a bunch of unusued tests and defines from autoconf.
956
  fdatasync fpresetsticky fpsetmask fsync \
575.4.6 by Monty Taylor
Removed my_getwd.
957
  getpassphrase getpwnam \
958
  getpwuid getrlimit getrusage index initgroups isnan \
1 by brian
clean slate
959
  localtime_r gethrtime gmtime_r \
572.1.4 by Monty Taylor
Removed a bunch of unusued tests and defines from autoconf.
960
  madvise \
961
  mkstemp mlockall poll pread pthread_attr_create mmap mmap64 \
1 by brian
clean slate
962
  pthread_attr_getstacksize pthread_attr_setprio pthread_attr_setschedparam \
963
  pthread_attr_setstacksize pthread_condattr_create pthread_getsequence_np \
964
  pthread_key_delete pthread_rwlock_rdlock pthread_setprio \
965
  pthread_setprio_np pthread_setschedparam pthread_sigmask readlink \
449 by Monty Taylor
Removed rint check - rint is part of C99.
966
  realpath rename rwlock_init setupterm \
572.1.4 by Monty Taylor
Removed a bunch of unusued tests and defines from autoconf.
967
  sigaction \
968
  sigthreadmask \
969
  snprintf strpbrk \
970
  tell tempnam \
971
  backtrace backtrace_symbols backtrace_symbols_fd)
1 by brian
clean slate
972
287.3.18 by Monty Taylor
Put -fno-exceptions flag in selectively. Add back HAVE_DECL_MADVISE check so
973
AC_LANG_PUSH(C++)
974
# Test whether madvise() is declared in C++ code -- it is not on some
975
# systems, such as Solaris
373.1.3 by Monty Taylor
Fixed test for HAVE_DECL_MADVISE to actually work.
976
AC_CHECK_DECLS([madvise], [], [], [AC_INCLUDES_DEFAULT[
977
#if HAVE_SYS_MMAN_H
287.3.18 by Monty Taylor
Put -fno-exceptions flag in selectively. Add back HAVE_DECL_MADVISE check so
978
#include <sys/types.h>
979
#include <sys/mman.h>
373.1.3 by Monty Taylor
Fixed test for HAVE_DECL_MADVISE to actually work.
980
#endif
981
]])
287.3.18 by Monty Taylor
Put -fno-exceptions flag in selectively. Add back HAVE_DECL_MADVISE check so
982
AC_LANG_POP()
983
984
236.1.59 by Monty Taylor
Turn thr_rwlock.c into a conditionally built source file.
985
AM_CONDITIONAL(BUILD_THR_RWLOCK,[test "$ac_cv_func_rwlock_init" -a "$ac_cv_funn_pthread_rwlock_rdlock"])
986
28.1.33 by Monty Taylor
Added -Wall
987
1 by brian
clean slate
988
# Sanity check: We chould not have any fseeko symbol unless
989
# large_file_support=yes
990
AC_CHECK_FUNC(fseeko,
520.4.41 by mordred
Fixed configure.ac to work cleanly on Solaris - and define some good compile flags.
991
[if test "$large_file_support" = no -a "x$TARGET_LINUX" = "xtrue";
1 by brian
clean slate
992
then
993
  AC_MSG_ERROR("Found fseeko symbol but large_file_support is not enabled!")
994
fi]
995
)
996
997
# Check definition of pthread_getspecific
236.1.39 by Monty Taylor
autoconf warning cleanups.
998
AC_CACHE_CHECK([args to pthread_getspecific], [mysql_cv_getspecific_args],
632.1.11 by Monty Taylor
Fixed Sun Studio warnings in mysys.
999
  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1000
#if !defined(_REENTRANT)
1 by brian
clean slate
1001
#define _REENTRANT
1002
#endif
632.1.11 by Monty Taylor
Fixed Sun Studio warnings in mysys.
1003
#ifndef _POSIX_PTHREAD_SEMANTICS 
1 by brian
clean slate
1004
#define _POSIX_PTHREAD_SEMANTICS 
632.1.11 by Monty Taylor
Fixed Sun Studio warnings in mysys.
1005
#endif
942.1.5 by Monty Taylor
Replace AC_TRY_* with AC_*_IFELSE
1006
#include <pthread.h>
1007
   ]], [[
1008
void *pthread_getspecific(pthread_key_t key);
1009
pthread_getspecific((pthread_key_t) NULL);
1010
   ]])],
236.1.39 by Monty Taylor
autoconf warning cleanups.
1011
    [mysql_cv_getspecific_args=POSIX],
1012
    [mysql_cv_getspecific_args=other])])
1 by brian
clean slate
1013
  if test "$mysql_cv_getspecific_args" = "other"
1014
  then
1015
    AC_DEFINE([HAVE_NONPOSIX_PTHREAD_GETSPECIFIC], [1],
1016
              [For some non posix threads])
1017
  fi
1018
1019
  # Check definition of pthread_mutex_init
236.1.39 by Monty Taylor
autoconf warning cleanups.
1020
  AC_CACHE_CHECK([args to pthread_mutex_init], [mysql_cv_mutex_init_args],
632.1.11 by Monty Taylor
Fixed Sun Studio warnings in mysys.
1021
    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1022
#ifndef _REENTRANT
1023
#define _REENTRANT
1024
#endif
1025
#ifndef _POSIX_PTHREAD_SEMANTICS
1 by brian
clean slate
1026
#define _POSIX_PTHREAD_SEMANTICS 
632.1.11 by Monty Taylor
Fixed Sun Studio warnings in mysys.
1027
#endif
28.1.33 by Monty Taylor
Added -Wall
1028
#include <pthread.h> ]], [[ 
1 by brian
clean slate
1029
  pthread_mutexattr_t attr;
1030
  pthread_mutex_t mp;
236.1.39 by Monty Taylor
autoconf warning cleanups.
1031
  pthread_mutex_init(&mp,&attr); ]])],
1032
      [mysql_cv_mutex_init_args=POSIX],
1033
      [mysql_cv_mutex_init_args=other])])
1 by brian
clean slate
1034
  if test "$mysql_cv_mutex_init_args" = "other"
1035
  then
1036
    AC_DEFINE([HAVE_NONPOSIX_PTHREAD_MUTEX_INIT], [1],
1037
              [For some non posix threads])
1038
  fi
1039
#---END:
1040
1041
#---START: Used in for client configure
1042
# Check definition of readdir_r
236.1.39 by Monty Taylor
autoconf warning cleanups.
1043
AC_CACHE_CHECK([args to readdir_r], [mysql_cv_readdir_r],
632.1.11 by Monty Taylor
Fixed Sun Studio warnings in mysys.
1044
  [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1045
#ifndef _REENTRANT
1046
#define _REENTRANT
1047
#endif
1048
#ifndef _POSIX_PTHREAD_SEMANTICS 
1 by brian
clean slate
1049
#define _POSIX_PTHREAD_SEMANTICS 
632.1.11 by Monty Taylor
Fixed Sun Studio warnings in mysys.
1050
#endif
1 by brian
clean slate
1051
#include <pthread.h>
28.1.33 by Monty Taylor
Added -Wall
1052
#include <dirent.h>]], [[ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
236.1.39 by Monty Taylor
autoconf warning cleanups.
1053
readdir_r((DIR *) NULL, (struct dirent *) NULL, (struct dirent **) NULL); ]])],
1054
    [mysql_cv_readdir_r=POSIX],
1055
    [mysql_cv_readdir_r=other])])
1 by brian
clean slate
1056
if test "$mysql_cv_readdir_r" = "POSIX"
1057
then
1058
  AC_DEFINE([HAVE_READDIR_R], [1], [POSIX readdir_r])
1059
fi
1060
1061
# Check definition of posix sigwait()
236.1.39 by Monty Taylor
autoconf warning cleanups.
1062
AC_CACHE_CHECK([style of sigwait], [mysql_cv_sigwait],
1063
  [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
632.1.11 by Monty Taylor
Fixed Sun Studio warnings in mysys.
1064
#ifndef _REENTRANT
236.1.39 by Monty Taylor
autoconf warning cleanups.
1065
#define _REENTRANT
632.1.11 by Monty Taylor
Fixed Sun Studio warnings in mysys.
1066
#endif
1067
#ifndef _POSIX_PTHREAD_SEMANTICS
1 by brian
clean slate
1068
#define _POSIX_PTHREAD_SEMANTICS 
632.1.11 by Monty Taylor
Fixed Sun Studio warnings in mysys.
1069
#endif
1 by brian
clean slate
1070
#include <pthread.h>
236.1.39 by Monty Taylor
autoconf warning cleanups.
1071
#include <signal.h>
1072
      ]], [[
1073
#ifndef _AIX
1 by brian
clean slate
1074
sigset_t set;
1075
int sig;
1076
sigwait(&set,&sig);
236.1.39 by Monty Taylor
autoconf warning cleanups.
1077
#endif
1078
      ]])],
1079
    [mysql_cv_sigwait=POSIX],
1080
    [mysql_cv_sigwait=other])])
1 by brian
clean slate
1081
if test "$mysql_cv_sigwait" = "POSIX"
1082
then
1083
  AC_DEFINE([HAVE_SIGWAIT], [1], [POSIX sigwait])
1084
fi
1085
1086
if test "$mysql_cv_sigwait" != "POSIX"
1087
then
1088
unset mysql_cv_sigwait
1089
# Check definition of posix sigwait()
236.1.39 by Monty Taylor
autoconf warning cleanups.
1090
AC_CACHE_CHECK([style of sigwait], [mysql_cv_sigwait],
1091
  [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
632.1.11 by Monty Taylor
Fixed Sun Studio warnings in mysys.
1092
#ifndef _REENTRANT
236.1.39 by Monty Taylor
autoconf warning cleanups.
1093
#define _REENTRANT
632.1.11 by Monty Taylor
Fixed Sun Studio warnings in mysys.
1094
#endif
1095
#ifndef _POSIX_PTHREAD_SEMANTICS
1 by brian
clean slate
1096
#define _POSIX_PTHREAD_SEMANTICS 
632.1.11 by Monty Taylor
Fixed Sun Studio warnings in mysys.
1097
#endif
1 by brian
clean slate
1098
#include <pthread.h>
236.1.39 by Monty Taylor
autoconf warning cleanups.
1099
#include <signal.h>
1100
      ]], [[
1101
sigset_t set;
1 by brian
clean slate
1102
int sig;
236.1.39 by Monty Taylor
autoconf warning cleanups.
1103
sigwait(&set);
1104
      ]])],
1105
    [mysql_cv_sigwait=NONPOSIX],
1106
    [mysql_cv_sigwait=other])])
1 by brian
clean slate
1107
if test "$mysql_cv_sigwait" = "NONPOSIX"
1108
then
1109
  AC_DEFINE([HAVE_NONPOSIX_SIGWAIT], [1], [sigwait with one argument])
1110
fi
1111
fi
1112
#---END:
1113
1114
# Check if pthread_attr_setscope() exists
236.1.39 by Monty Taylor
autoconf warning cleanups.
1115
AC_CACHE_CHECK([for pthread_attr_setscope], [mysql_cv_pthread_attr_setscope],
1116
  [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
632.1.11 by Monty Taylor
Fixed Sun Studio warnings in mysys.
1117
#ifndef _REENTRANT
236.1.39 by Monty Taylor
autoconf warning cleanups.
1118
#define _REENTRANT
632.1.11 by Monty Taylor
Fixed Sun Studio warnings in mysys.
1119
#endif
1120
#ifndef _POSIX_PTHREAD_SEMANTICS
1 by brian
clean slate
1121
#define _POSIX_PTHREAD_SEMANTICS 
632.1.11 by Monty Taylor
Fixed Sun Studio warnings in mysys.
1122
#endif
236.1.39 by Monty Taylor
autoconf warning cleanups.
1123
#include <pthread.h>
1124
      ]], [[
1125
pthread_attr_t thr_attr;
1126
pthread_attr_setscope(&thr_attr,0);
1127
      ]])],
1128
    [mysql_cv_pthread_attr_setscope=yes],
1129
    [mysql_cv_pthread_attr_setscope=no])])
1 by brian
clean slate
1130
if test "$mysql_cv_pthread_attr_setscope" = "yes"
1131
then
1132
  AC_DEFINE([HAVE_PTHREAD_ATTR_SETSCOPE], [1], [pthread_attr_setscope])
1133
fi
1134
28.1.33 by Monty Taylor
Added -Wall
1135
AC_LANG_PUSH([C++])
1 by brian
clean slate
1136
AC_CHECK_HEADERS(cxxabi.h)
1137
AC_CACHE_CHECK([checking for abi::__cxa_demangle], mysql_cv_cxa_demangle,
28.1.33 by Monty Taylor
Added -Wall
1138
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <cxxabi.h>]], [[
1 by brian
clean slate
1139
  char *foo= 0; int bar= 0;
1140
  foo= abi::__cxa_demangle(foo, foo, 0, &bar);
28.1.33 by Monty Taylor
Added -Wall
1141
]])],[mysql_cv_cxa_demangle=yes],[mysql_cv_cxa_demangle=no])])
1142
AC_LANG_POP([])
1 by brian
clean slate
1143
1144
if test "x$mysql_cv_cxa_demangle" = xyes; then
1145
  AC_DEFINE(HAVE_ABI_CXA_DEMANGLE, 1,
1146
            [Define to 1 if you have the `abi::__cxa_demangle' function.])
1147
fi
1148
1149
#--------------------------------------------------------------------
1150
# Check for requested features
1151
#--------------------------------------------------------------------
1152
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
1153
DRIZZLE_CHECK_MAX_INDEXES
1 by brian
clean slate
1154
1155
#--------------------------------------------------------------------
1156
# Declare our plugin modules
1157
# Has to be done late, as the plugin may need to check for existence of
1158
# functions tested above
1159
#--------------------------------------------------------------------
1160
992.1.21 by Monty Taylor
First pass at replacing plugin.m4.
1161
m4_include(config/plugin.ac)
1162
dnl Add code here to read set plugin lists and  set drizzled_default_plugin_list
1163
AC_DEFINE_UNQUOTED([DRIZZLED_PLUGIN_LIST],[$drizzled_default_plugin_list],
1164
                   [List of plugins that should be loaded on startup if no
1165
                    value is given for --plugin-load])
1 by brian
clean slate
1166
992.1.22 by Monty Taylor
Moved towards having register_plugins.py make builtin plugins, so we can have a first step.
1167
drizzled_builtin_list=`echo $drizzled_builtin_list | sed 's/, *$//'`
1168
AC_DEFINE_UNQUOTED([DRIZZLED_BUILTIN_LIST],[$drizzled_builtin_list],
1169
                   [List of plugins to be loaded in sql_builtin.cc])
997.2.19 by Monty Taylor
Reverted back to building drizzled in drizzled.
1170
AC_SUBST(drizzled_plugin_libs)
1171
1172
AC_SUBST(mysql_plugin_dirs)
1173
AC_SUBST(mysql_plugin_libs)
1174
drizzled_plugin_defs=`echo $drizzled_plugin_defs | sed 's/, *$//'`
1175
AC_SUBST(drizzled_plugin_defs)
1176
AC_SUBST(DRIZZLED_PLUGIN_DEP_LIBS)
992.1.22 by Monty Taylor
Moved towards having register_plugins.py make builtin plugins, so we can have a first step.
1177
435.1.1 by Monty Taylor
Fixed -O3 optimization for gcc.
1178
189 by Brian Aker
Refactor of configure.ac. Added profile. One note... I believe this should
1179
AC_ARG_ENABLE([profiling],
1180
    [AS_HELP_STRING([--enable-profiling],
1181
       [Toggle profiling @<:@default=off@:>@])],
1182
    [ac_profiling="$enableval"],
1183
    [ac_profiling="no"])
1184
1185
AC_ARG_ENABLE([coverage],
1186
    [AS_HELP_STRING([--enable-coverage],
1187
       [Toggle coverage @<:@default=off@:>@])],
1188
    [ac_coverage="$enableval"],
1189
    [ac_coverage="no"])
1190
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1191
AC_ARG_ENABLE([pedantic-warnings],
1192
    [AS_HELP_STRING([--disable-pedantic-warnings],
1193
       [Toggle pedanticness @<:@default=on@:>@])],
1194
    [ac_warn_pedantic="$enableval"],
1195
    [ac_warn_pedantic="yes"])
1196
1197
AC_ARG_ENABLE([fail],
77.1.112 by Monty Taylor
Fixed comment on --enable-fail -> --disable-fail.
1198
    [AS_HELP_STRING([--disable-fail],
1199
       [Turn warnings into failures @<:@default=on@:>@])],
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1200
    [ac_warn_fail="$enableval"],
77.1.108 by Monty Taylor
Turn on -Werror again by default.
1201
    [ac_warn_fail="yes"])
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1202
53.2.6 by Monty Taylor
Turned unreachable code warnings into a configure option.
1203
AC_ARG_ENABLE([unreachable],
1204
    [AS_HELP_STRING([--enable-unreachable],
1205
       [Enable warnings about unreachable code @<:@default=off@:>@])],
1206
    [ac_warn_unreachable="$enableval"],
1207
    [ac_warn_unreachable="no"])
1208
77.1.109 by Monty Taylor
Made --disable-pedantic-warnings only disable the pedantic warnings, rather than also removing the -std=gnu99 part.
1209
AC_ARG_ENABLE([longlong-warnings],
1210
    [AS_HELP_STRING([--enable-longlong-warnings],
1211
       [Enable warnings about longlong in C++ @<:@default=off@:>@])],
1212
    [ac_warn_longlong="$enableval"],
421 by Monty
Made including stdint.h work.
1213
    [ac_warn_longlong="no"])
77.1.109 by Monty Taylor
Made --disable-pedantic-warnings only disable the pedantic warnings, rather than also removing the -std=gnu99 part.
1214
1215
AC_ARG_ENABLE([strict-aliasing],
934.3.5 by Monty Taylor
Addd -Wshadow to PROTOSKIP warnings and turned -Wstrict-aliasing off. Jumped the gun...
1216
    [AS_HELP_STRING([--enable-strict-aliasing],
1217
       [Enable warnings about stict-aliasing @<:@default=off@:>@])],
77.1.109 by Monty Taylor
Made --disable-pedantic-warnings only disable the pedantic warnings, rather than also removing the -std=gnu99 part.
1218
    [ac_warn_strict_aliasing="$enableval"],
934.3.5 by Monty Taylor
Addd -Wshadow to PROTOSKIP warnings and turned -Wstrict-aliasing off. Jumped the gun...
1219
    [ac_warn_strict_aliasing="no"])
77.1.109 by Monty Taylor
Made --disable-pedantic-warnings only disable the pedantic warnings, rather than also removing the -std=gnu99 part.
1220
509.2.1 by Monty Taylor
Added some more warning options to configure.
1221
AC_ARG_ENABLE([cast-warnings],
1222
    [AS_HELP_STRING([--enable-cast-warnings],
1223
       [Enable warnings about use of old C-style casts @<:@default=off@:>@])],
1224
    [ac_warn_cast="$enableval"],
1225
    [ac_warn_cast="no"])
1226
1227
AC_ARG_ENABLE([effective-style],
1228
    [AS_HELP_STRING([--enable-effective-style],
1229
       [Enable warnings violating Effective C++ Style Guidelines @<:@default=off@:>@])],
1230
    [ac_warn_effc="$enableval"],
1231
    [ac_warn_effc="no"])
1232
779.3.10 by Monty Taylor
Turned on -Wshadow.
1233
AC_ARG_ENABLE([shadow],
1234
    [AS_HELP_STRING([--disable-shadow],
1235
       [Disables warnings about scope shadowing @<:@default=on@:>@])],
1236
    [ac_warn_shadow="$enableval"],
1237
    [ac_warn_shadow="yes"])
1238
892.1.7 by Monty Taylor
Added two more C++ warnings. We pass them now. Oh, look. We had an empty class.
1239
AC_ARG_ENABLE([conversion],
1240
    [AS_HELP_STRING([--enable-conversion],
1241
       [Enables conversion warnings @<:@default=off@:>@])],
1242
    [ac_warn_conversion="$enableval"],
1243
    [ac_warn_conversion="no"])
509.2.2 by Monty Taylor
Added one more set of possible warnings.
1244
713.1.8 by Monty Taylor
Moved a little code...
1245
AC_ARG_ENABLE([datarace],
1246
    [AS_HELP_STRING([--enable-datarace],
1247
       [Enables Sun Studio data race detection @<:@default=off@:>@])],
1248
    [ac_datarace="$enableval"],
1249
    [ac_datarace="no"])
53.2.2 by Monty Taylor
Updated everything that needs updating to compile with -std=gnu99 -pedantic
1250
779.1.16 by Monty Taylor
Turned on exceptions, but made it configurable.
1251
AC_ARG_ENABLE([exceptions],
1252
    [AS_HELP_STRING([--disable-exceptions],
1253
        [Disables use of Exceptions in the build @<:@default=on@:>@])],
1254
    [ac_exceptions="$enableval"],
873.2.42 by Monty Taylor
Ooops. This was a bad idea.
1255
    [ac_exceptions="yes"])
713.1.7 by Monty Taylor
Added support for thread data tracing to the build for Sun Studio.
1256
937.2.5 by Stewart Smith
add ./configure option to enable -Wcast-align (if specified) that may be useful in trapping potential alignment problems for SPARC.
1257
AC_ARG_ENABLE([cast-align-warnings],
1258
    [AS_HELP_STRING([--enable-cast-align-warnings],
1259
       [Toggle cast alignment warnings @<:@default=off@:>@])],
1260
    [ac_warn_cast_align="$enableval"],
1014.2.11 by Monty Taylor
Couple of quick configure fixes.
1261
    [ac_warn_cast_align="yes"])
937.2.5 by Stewart Smith
add ./configure option to enable -Wcast-align (if specified) that may be useful in trapping potential alignment problems for SPARC.
1262
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1263
if test "$GCC" = "yes"
1264
then
937.2.5 by Stewart Smith
add ./configure option to enable -Wcast-align (if specified) that may be useful in trapping potential alignment problems for SPARC.
1265
  if test "$ac_warn_cast_align" = "yes"
1266
  then
1267
    W_CAST_ALIGN="-Wcast-align"
1268
  else
1269
    W_CAST_ALIGN="-Wno-cast-align"
1270
  fi
53.2.2 by Monty Taylor
Updated everything that needs updating to compile with -std=gnu99 -pedantic
1271
558 by Monty Taylor
Added autoconf test to turn off -Wredundant-decls if it doesn't work right.
1272
  if test "$ac_warn_fail" = "yes"
1273
  then
1274
    W_FAIL="-Werror"
1275
  fi
1014.2.11 by Monty Taylor
Couple of quick configure fixes.
1276
  BASE_WARNINGS="-Wall -Wextra ${W_FAIL} ${W_CAST_ALIGN} -fdiagnostics-show-option"
558 by Monty Taylor
Added autoconf test to turn off -Wredundant-decls if it doesn't work right.
1277
77.1.109 by Monty Taylor
Made --disable-pedantic-warnings only disable the pedantic warnings, rather than also removing the -std=gnu99 part.
1278
  if test "$ac_warn_longlong" = "yes"
1279
  then
1280
    W_LONGLONG="-Wlong-long"
1281
  else
1282
    W_LONGLONG="-Wno-long-long"
1283
  fi
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1284
77.1.109 by Monty Taylor
Made --disable-pedantic-warnings only disable the pedantic warnings, rather than also removing the -std=gnu99 part.
1285
  if test "$ac_warn_strict_aliasing" = "yes"
1286
  then
1014.2.11 by Monty Taylor
Couple of quick configure fixes.
1287
    W_STRICT_ALIASING="-fstrict-aliasing -Wstrict-aliasing"
77.1.109 by Monty Taylor
Made --disable-pedantic-warnings only disable the pedantic warnings, rather than also removing the -std=gnu99 part.
1288
  else
509.2.3 by Monty Taylor
Re-worked strict-aliasing again.
1289
    W_STRICT_ALIASING="-Wno-strict-aliasing"
77.1.109 by Monty Taylor
Made --disable-pedantic-warnings only disable the pedantic warnings, rather than also removing the -std=gnu99 part.
1290
  fi
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1291
779.3.10 by Monty Taylor
Turned on -Wshadow.
1292
  if test "$ac_warn_shadow" = "yes"
1293
  then
1294
    W_SHADOW="-Wshadow"
1295
    NO_SHADOW="-Wno-shadow"
1296
  else
1297
    W_SHADOW="-Wno-shadow"
1298
    NO_SHADOW=""
1299
  fi
1300
189 by Brian Aker
Refactor of configure.ac. Added profile. One note... I believe this should
1301
  if test "$ac_profiling" = "yes"
1302
  then
1303
    GPROF_PROFILING="-pg"
873.2.37 by Monty Taylor
Added support for profiling version of libc.
1304
    save_LIBS="${LIBS}"
1305
    LIBS=""
1306
    AC_CHECK_LIB(c_p, read)
1307
    LIBC_P="${LIBS}"
1308
    LIBS="${save_LIBS}"
189 by Brian Aker
Refactor of configure.ac. Added profile. One note... I believe this should
1309
  else
1310
    GPROF_PROFILING=" "
1311
  fi
1312
1313
  if test "$ac_coverage" = "yes"
1314
  then
1315
    GPROF_COVERAGE="-fprofile-arcs -ftest-coverage"
1316
  else
1317
    GPROF_COVERAGE=" "
1318
  fi
1319
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1320
  if test "$ac_warn_pedantic" = "yes"
1321
  then
520.4.36 by Monty Taylor
Added autoconf check for usability of __attribute__((visibility("hidden"))).
1322
    AC_CACHE_CHECK([whether it is safe to use -Wredundant-decls],
1323
      [ac_cv_safe_to_use_Wredundant_decls_],
1324
      [AC_LANG_PUSH(C++)
919.2.18 by Monty Taylor
Restructured CFLAGS processing to always keep user-supplied options last on the command line, so they take precedence.
1325
       save_CXXFLAGS="${CXXFLAGS}"
1326
       CXXFLAGS="${CXXFLAGS} ${W_FAIL} -Wredundant-decls"
520.4.36 by Monty Taylor
Added autoconf check for usability of __attribute__((visibility("hidden"))).
1327
       AC_COMPILE_IFELSE(
1328
         [AC_LANG_PROGRAM([
558 by Monty Taylor
Added autoconf test to turn off -Wredundant-decls if it doesn't work right.
1329
template <typename E> struct C { void foo(); };
1330
template <typename E> void C<E>::foo() { }
1331
template <> void C<int>::foo();
520.4.36 by Monty Taylor
Added autoconf check for usability of __attribute__((visibility("hidden"))).
1332
            AC_INCLUDES_DEFAULT])],
1333
          [ac_cv_safe_to_use_Wredundant_decls_=yes],
1334
          [ac_cv_safe_to_use_Wredundant_decls_=no])
919.2.18 by Monty Taylor
Restructured CFLAGS processing to always keep user-supplied options last on the command line, so they take precedence.
1335
        CXXFLAGS="${save_CXXFLAGS}"
520.4.36 by Monty Taylor
Added autoconf check for usability of __attribute__((visibility("hidden"))).
1336
        AC_LANG_POP()])
559.1.1 by Kristian Nielsen
Fix a few problems with the -Wredundant-decls configure check.
1337
    if test $ac_cv_safe_to_use_Wredundant_decls_ = yes
558 by Monty Taylor
Added autoconf test to turn off -Wredundant-decls if it doesn't work right.
1338
    then
559.1.1 by Kristian Nielsen
Fix a few problems with the -Wredundant-decls configure check.
1339
      GXX_W_REDUNDANT_DECLS="-Wredundant-decls"
558 by Monty Taylor
Added autoconf test to turn off -Wredundant-decls if it doesn't work right.
1340
    else
559.1.1 by Kristian Nielsen
Fix a few problems with the -Wredundant-decls configure check.
1341
      GXX_W_REDUNDANT_DECLS="-Wno-redundant-decls"
558 by Monty Taylor
Added autoconf test to turn off -Wredundant-decls if it doesn't work right.
1342
    fi
520.4.36 by Monty Taylor
Added autoconf check for usability of __attribute__((visibility("hidden"))).
1343
    
559.1.1 by Kristian Nielsen
Fix a few problems with the -Wredundant-decls configure check.
1344
    GCC_PEDANTIC="-pedantic -Wundef -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls ${W_STRICT_ALIASING}"
892.1.7 by Monty Taylor
Added two more C++ warnings. We pass them now. Oh, look. We had an empty class.
1345
    GXX_PEDANTIC="-pedantic -Wundef -Woverloaded-virtual  -Wnon-virtual-dtor -Wctor-dtor-privacy ${GXX_W_REDUNDANT_DECLS} ${W_LONGLONG} ${W_STRICT_ALIASING}"
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1346
  fi
1347
53.2.6 by Monty Taylor
Turned unreachable code warnings into a configure option.
1348
  if test "$ac_warn_unreachable" = "yes"
1349
  then
77.1.109 by Monty Taylor
Made --disable-pedantic-warnings only disable the pedantic warnings, rather than also removing the -std=gnu99 part.
1350
    W_UNREACHABLE="-Wunreachable-code"
53.2.6 by Monty Taylor
Turned unreachable code warnings into a configure option.
1351
  fi
892.1.6 by Monty Taylor
Added overloaded-virtual to the list of standard warnings. We are now clean with
1352
509.2.1 by Monty Taylor
Added some more warning options to configure.
1353
  if test "$ac_warn_cast" = "yes"
1354
  then
1355
    W_CAST="-Wold-style-cast"
1356
  fi
1357
1358
  if test "$ac_warn_effc" = "yes"
1359
  then
1360
    W_EFFC="-Weffc++"
1361
  fi
1362
892.1.7 by Monty Taylor
Added two more C++ warnings. We pass them now. Oh, look. We had an empty class.
1363
  if test "$ac_warn_conversion" = "yes"
509.2.2 by Monty Taylor
Added one more set of possible warnings.
1364
  then
892.1.7 by Monty Taylor
Added two more C++ warnings. We pass them now. Oh, look. We had an empty class.
1365
    W_CONVERSION="-Wconversion"
509.2.2 by Monty Taylor
Added one more set of possible warnings.
1366
  fi
1367
919.2.18 by Monty Taylor
Restructured CFLAGS processing to always keep user-supplied options last on the command line, so they take precedence.
1368
  CC_WARNINGS="${BASE_WARNINGS} ${GCC_PEDANTIC} ${W_UNREACHABLE} ${GPROF_PROFILING} ${GPROF_COVERAGE} ${W_SHADOW} ${W_CONVERSION}"
892.1.7 by Monty Taylor
Added two more C++ warnings. We pass them now. Oh, look. We had an empty class.
1369
  CXX_WARNINGS="${BASE_WARNINGS} ${GXX_PEDANTIC} ${W_UNREACHABLE} ${GPROF_PROFILING} ${GPROF_COVERAGE} ${W_CAST} ${W_SHADOW} ${W_EFFC} ${W_CONVERSION}"
77.1.109 by Monty Taylor
Made --disable-pedantic-warnings only disable the pedantic warnings, rather than also removing the -std=gnu99 part.
1370
779.1.16 by Monty Taylor
Turned on exceptions, but made it configurable.
1371
  if test "$ac_exceptions" = "no"
1372
  then
1373
    NO_EXCEPTIONS="-fno-exceptions"
1374
    W_EXCEPTIONS="-fexceptions"
1375
  fi
520.4.44 by mordred
A whole bunch of solaris/sun studio compile fixes.
1376
  NO_REDUNDANT_DECLS="-Wno-redundant-decls"
960.2.19 by Monty Taylor
Fixed PROTOSKIP_WARNINGS. (thanks eday)
1377
  PROTOSKIP_WARNINGS="-Wno-effc++ -Wno-shadow"
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1378
fi
520.4.37 by Monty Taylor
Added some Sun compile flags.
1379
if test "$SUNCC" = "yes"
1380
then
713.1.7 by Monty Taylor
Added support for thread data tracing to the build for Sun Studio.
1381
  if test "$ac_datarace" = "yes"
1382
  then
919.2.18 by Monty Taylor
Restructured CFLAGS processing to always keep user-supplied options last on the command line, so they take precedence.
1383
    CFLAGS="-xinstrument=datarace ${CFLAGS}"
1384
    CXXFLAGS="-xinstrument=datarace ${CXXFLAGS}"
713.1.7 by Monty Taylor
Added support for thread data tracing to the build for Sun Studio.
1385
  fi
898.1.1 by Monty Taylor
Fix to make --disable-fail function on Solaris.
1386
1387
  if test "$ac_warn_fail" = "yes"
1388
  then
1389
    W_FAIL="-errwarn=%all"
1390
  fi
1391
907.3.2 by Monty Taylor
Added tests for 64-bit solaris. Look in /usr/lib/amd64 and /usr/local/lib/amd64 if we are 64-bit.
1392
  CC_WARNINGS="-v -errtags=yes -erroff=E_ATTRIBUTE_NOT_VAR ${W_FAIL}"
971.1.33 by Monty Taylor
Added a needed warning skip for Solaris.
1393
  CXX_WARNINGS="+w +w2 -xport64 -errtags=yes -erroff=attrskipunsup,doubunder,reftotemp,inllargeuse,truncwarn1,signextwarn,inllargeint ${W_FAIL}" 
919.2.7 by Monty Taylor
Added back PROTOSKIP_WARNINGS - we still need it on Solaris. But it's empty now for GCC.
1394
  PROTOSKIP_WARNINGS="-erroff=attrskipunsup,doubunder,reftotemp,wbadinitl,identexpected,inllargeuse,truncwarn1,signextwarn"
779.3.18 by Monty Taylor
Cleaned up warnings up through innodb.
1395
  NO_UNREACHED="-erroff=E_STATEMENT_NOT_REACHED"
779.1.16 by Monty Taylor
Turned on exceptions, but made it configurable.
1396
  if test "$ac_exceptions" = "no"
1397
  then
1398
    NO_EXCEPTIONS="-features=no%except"
1399
    W_EXCEPTIONS="-features=except"
1400
  fi
520.4.37 by Monty Taylor
Added some Sun compile flags.
1401
fi
520.4.44 by mordred
A whole bunch of solaris/sun studio compile fixes.
1402
AC_SUBST(NO_EXCEPTIONS)
1403
AC_SUBST(W_EXCEPTIONS)
779.3.10 by Monty Taylor
Turned on -Wshadow.
1404
AC_SUBST(NO_SHADOW)
1405
AC_SUBST(W_SHADOW)
520.4.44 by mordred
A whole bunch of solaris/sun studio compile fixes.
1406
AC_SUBST(NO_REDUNDANT_DECLS)
919.2.7 by Monty Taylor
Added back PROTOSKIP_WARNINGS - we still need it on Solaris. But it's empty now for GCC.
1407
AC_SUBST(PROTOSKIP_WARNINGS)
779.3.18 by Monty Taylor
Cleaned up warnings up through innodb.
1408
AC_SUBST(NO_UNREACHED)
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1409
994.2.7 by Monty Taylor
Fix for osx distcheck problem.
1410
if test "x${gl_LIBOBJS}" != "x"
815.1.2 by Monty Taylor
Added -Ignulib to the includes if it's needed.
1411
then
971.4.1 by Monty Taylor
GCC on Solaris build fixes.
1412
  if test "$GCC" = "yes"
1413
  then
1414
    CPPFLAGS="-isystem \$(top_srcdir)/gnulib -isystem \$(top_builddir)/gnulib ${CPPFLAGS}"
1415
  else
1416
    CPPFLAGS="-I\$(top_srcdir)/gnulib -I\$(top_builddir)/gnulib ${CPPFLAGS}"
1417
  fi
815.1.2 by Monty Taylor
Added -Ignulib to the includes if it's needed.
1418
fi
992.1.7 by Monty Taylor
Sometimes it helps to actually set -Werror before the check you've marked as needing to happen after -Werror.
1419
908.1.12 by Monty Taylor
mmm.
1420
CPPFLAGS="-I\$(top_srcdir) -I\$(top_builddir) ${CPPFLAGS}"
992.1.7 by Monty Taylor
Sometimes it helps to actually set -Werror before the check you've marked as needing to happen after -Werror.
1421
CFLAGS="${CC_WARNINGS} ${CFLAGS}"
1422
CXXFLAGS="${CXX_WARNINGS} ${W_EXCEPTIONS} ${CXXFLAGS}"
907.3.3 by Monty Taylor
A whole crapload of build fixes. OpenSolaris AMD64 builds with -m64 now by default... still isn't warning clean yet though. Also cleaned up the AM_*FLAGS situation.
1423
992.1.4 by Monty Taylor
Fixed quick configure bug. /* isn't a valid comment in shell script, thanks.
1424
dnl Must be done once we turn on warnings and such
971.4.1 by Monty Taylor
GCC on Solaris build fixes.
1425
AC_CACHE_CHECK(
1426
  [whether __attribute__ visibility "hidden" is supported],
992.1.4 by Monty Taylor
Fixed quick configure bug. /* isn't a valid comment in shell script, thanks.
1427
  [ac_cv_can_use_hidden_],[
1428
    AC_LANG_PUSH(C++)
992.1.7 by Monty Taylor
Sometimes it helps to actually set -Werror before the check you've marked as needing to happen after -Werror.
1429
    AC_LINK_IFELSE([
992.1.4 by Monty Taylor
Fixed quick configure bug. /* isn't a valid comment in shell script, thanks.
1430
      AC_LANG_PROGRAM(
1431
        [[
971.4.1 by Monty Taylor
GCC on Solaris build fixes.
1432
__attribute__((visibility ("hidden")))
992.1.21 by Monty Taylor
First pass at replacing plugin.m4.
1433
void testme() {  }
992.1.18 by Monty Taylor
Moved client build into root Makefile.
1434
        ]],[[testme()]]
992.1.4 by Monty Taylor
Fixed quick configure bug. /* isn't a valid comment in shell script, thanks.
1435
      )],  
1436
      [ac_cv_can_use_hidden_=yes],
1437
      [ac_cv_can_use_hidden_=no])
1438
    AC_LANG_POP()])
971.4.1 by Monty Taylor
GCC on Solaris build fixes.
1439
if test "$ac_cv_can_use_hidden_" = "yes"
1440
then
1441
  AC_DEFINE(HAVE_ATTR_HIDDEN, 1,
1442
  [Define to 1 if you have support for __attribute__((visibility("hidden")))])
1443
fi
1444
907.3.3 by Monty Taylor
A whole crapload of build fixes. OpenSolaris AMD64 builds with -m64 now by default... still isn't warning clean yet though. Also cleaned up the AM_*FLAGS situation.
1445
AM_CPPFLAGS="${CPPFLAGS}"
992.1.7 by Monty Taylor
Sometimes it helps to actually set -Werror before the check you've marked as needing to happen after -Werror.
1446
AM_CFLAGS="${CFLAGS}"
1447
AM_CXXFLAGS="${CXXFLAGS}"
907.3.3 by Monty Taylor
A whole crapload of build fixes. OpenSolaris AMD64 builds with -m64 now by default... still isn't warning clean yet though. Also cleaned up the AM_*FLAGS situation.
1448
1449
AC_SUBST([AM_CPPFLAGS])
287.3.26 by Monty Taylor
Put warnings into AM_C*FLAGS so they can be overridden per lib.
1450
AC_SUBST([AM_CFLAGS])
1451
AC_SUBST([AM_CXXFLAGS])
202.1.23 by Monty Taylor
Moved the includes we use everywhere to to GLOBAL_CPPFLAGS and added AM_CPPFLAGS to an AC_SUBST, so that we could take out the redundant declaration from most fof the Makefiles.
1452
907.3.3 by Monty Taylor
A whole crapload of build fixes. OpenSolaris AMD64 builds with -m64 now by default... still isn't warning clean yet though. Also cleaned up the AM_*FLAGS situation.
1453
dnl We've collected the flags in AM_*FLAGS now, so blank these.
1454
CFLAGS=""
1455
CXXFLAGS=""
1456
CPPFLAGS=""
1 by brian
clean slate
1457
722.1.4 by Monty Taylor
Removed all the setting of DEFS everywhere. Use configmake.h to get the values
1458
AC_SUBST(pkgplugindir,"\$(pkglibdir)/plugin")
1459
492.1.7 by Monty Taylor
Moved test() to its own file.
1460
dnl GCC Precompiled Header Support
584.4.3 by Monty Taylor
Disabled pre-compiled headers for now.
1461
dnl re-enable later
632.1.25 by Monty Taylor
Removed AM_CONDITIONAL from SEARCH_FOR_LIB. Aligned naming of AM_CONDITIONALS.
1462
dnl AM_CONDITIONAL([BUILD_GCC_PCH],[test "$GCC" = "yes"])
1463
AM_CONDITIONAL([BUILD_GCC_PCH],[test "no" = "yes"])
492.1.7 by Monty Taylor
Moved test() to its own file.
1464
992.1.17 by Monty Taylor
Moved extra/ into root Makefile.am
1465
AC_CONFIG_FILES(Makefile dnl
815.1.1 by Monty Taylor
Add timegm which is missing on Solaris.
1466
 gnulib/Makefile dnl
575.2.2 by Monty Taylor
Moved vio stuff into libdrizzle.
1467
 po/Makefile.in dnl
988.1.1 by Jay Pipes
Changes libserialize to libdrizzledmessage per ML discussion. All GPB messages are now in the drizzled::message namespace.
1468
 drizzled/message/Makefile dnl
997.2.19 by Monty Taylor
Reverted back to building drizzled in drizzled.
1469
 drizzled/Makefile dnl
28.1.31 by Monty Taylor
Deleted tons of pointless garbage from scripts.
1470
 support-files/Makefile dnl
77.1.47 by Monty Taylor
Moved test to tests...
1471
 tests/Makefile tests/install_test_db dnl
1025.1.1 by Trond Norbye
Add configuration files to integrate to Solaris SMF
1472
 support-files/drizzle.server support-files/drizzle-log-rotate
1473
 support-files/smf/Makefile dnl
1474
 support-files/smf/install.sh dnl
1475
 support-files/smf/drizzle.xml dnl
1476
 support-files/smf/drizzle)
1 by brian
clean slate
1477
512.2.2 by C.J. Adams-Collier
added checks to determine which threading plugins have been enabled on
1478
scheduling_plugins_available="
1479
  pool_of_threads 
1480
  single_thread
1481
"
1482
1483
for sched_plugin in $scheduling_plugins_available
1484
do
1485
  varname="\${with_plugin_${sched_plugin}}"
1486
  result=`eval "echo $varname"`
1487
  if test "x$result" = "xyes"
1488
  then
1489
    scheduling_plugins="$sched_plugin $scheduling_plugins"
1490
  fi
1491
done
1492
824.1.1 by Monty Taylor
Added code to automatically build a new list of POTFILES.in, then updated the translations.
1493
AC_CONFIG_COMMANDS([timestamp-h], , test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h)
1494
917.1.4 by Monty Taylor
Fixed POTFILES.in generation.
1495
AC_CONFIG_COMMANDS_PRE([
971.1.7 by Monty Taylor
Added test for the po dir before trying to update POTFILES.
1496
if test "x$EGREP" != "x" -a -d po
824.1.1 by Monty Taylor
Added code to automatically build a new list of POTFILES.in, then updated the translations.
1497
then
1498
  echo "# This file is auto-generated from configure. Do not edit directly" > po/POTFILES.in.in
779.3.51 by Monty Taylor
Some cleanup. Don't add things from distcheck leftovers to POTFILES
1499
  # The grep -v 'drizzle-' is to exclude any distcheck leftovers
1500
  for f in `find . | grep -v 'drizzle-' | ${EGREP} '\.(cc|c|h|yy)$' | cut -c3- | sort`
824.1.1 by Monty Taylor
Added code to automatically build a new list of POTFILES.in, then updated the translations.
1501
  do
1502
    if grep gettext.h "$f" | grep include >/dev/null 2>&1
1503
    then
1504
      echo "$f" >> po/POTFILES.in.in
1505
    fi
1506
  done
1507
  if ! diff po/POTFILES.in.in po/POTFILES.in >/dev/null 2>&1
1508
  then
1509
    mv po/POTFILES.in.in po/POTFILES.in
1510
  else
1511
    rm po/POTFILES.in.in
1512
  fi
917.1.4 by Monty Taylor
Fixed POTFILES.in generation.
1513
else
1514
  touch po/POTFILES.in
824.1.1 by Monty Taylor
Added code to automatically build a new list of POTFILES.in, then updated the translations.
1515
fi
1516
])
1 by brian
clean slate
1517
1518
# Ensure that table handlers gets all modifications to CFLAGS/CXXFLAGS
287.3.28 by Monty Taylor
Expanded the move to AM_CFLAGS and AM_CXXFLAGS. Now we should be more correct.
1519
AC_CONFIG_COMMANDS_POST(ac_configure_args="$ac_configure_args CFLAGS='$CFLAGS' CXXFLAGS='$CXXFLAGS' AM_CFLAGS='$AM_CFLAGS' AM_CXXFLAGS='$AM_CXXFLAGS'")
1 by brian
clean slate
1520
1521
AC_OUTPUT
489.2.1 by C.J. Adams-Collier
2008-10-07T1437 C.J. Adams-Collier <cjac@colliertech.org>
1522
1523
echo "---"
1524
echo "Configuration summary for $PACKAGE_NAME version $VERSION"
1525
echo ""
1526
echo "   * Installation prefix:       $prefix"
1527
echo "   * System type:               $SYSTEM_TYPE"
492.2.1 by C.J. Adams-Collier
* fixed --disable-assert code (thanks Monty)
1528
echo "   * Host CPU:                  $host_cpu"
489.2.1 by C.J. Adams-Collier
2008-10-07T1437 C.J. Adams-Collier <cjac@colliertech.org>
1529
echo "   * C Compiler:                $CC_VERSION"
632.1.21 by Monty Taylor
Cleaned up compiler version checking.
1530
echo "   * C++ Compiler:              $CXX_VERSION"
492.2.1 by C.J. Adams-Collier
* fixed --disable-assert code (thanks Monty)
1531
echo "   * Build auth_pam:            $ac_cv_header_security_pam_appl_h"
1532
echo "   * Assertions enabled:        $ac_cv_assert"
489.2.1 by C.J. Adams-Collier
2008-10-07T1437 C.J. Adams-Collier <cjac@colliertech.org>
1533
echo "   * Debug enabled:             $with_debug"
1534
echo "   * Profiling enabled:         $ac_profiling"
1535
echo "   * Coverage enabled:          $ac_coverage"
1536
echo "   * Warnings as failure:       $ac_warn_fail"
512.2.2 by C.J. Adams-Collier
added checks to determine which threading plugins have been enabled on
1537
echo "   * Scheduling Plugins:        $scheduling_plugins"
492.2.1 by C.J. Adams-Collier
* fixed --disable-assert code (thanks Monty)
1538
echo "   * C++ cstdint location:      $ac_cv_cxx_cstdint"
1539
echo "   * C++ hash_map location:     $ac_cv_cxx_hash_map"
1540
echo "   * C++ hash namespace:        $ac_cv_cxx_hash_namespace"
919.2.19 by Monty Taylor
Added check for shared_ptr in advance of actually thinking about using it. I think this should cover all platforms we care about... but let's doublecheck.
1541
echo "   * C++ shared_ptr namespace:  $ac_cv_shared_ptr_namespace"
489.2.1 by C.J. Adams-Collier
2008-10-07T1437 C.J. Adams-Collier <cjac@colliertech.org>
1542
echo ""
1543
echo "---"
908.1.4 by Monty Taylor
Fix to fake-out libtoolize, since AC_INIT is in bzr_version.m4 now.
1544
1545
dnl libtoolize scans configure.ac  and needs to see some text
1546
m4_define([LIBTOOLIZE_AC_INIT], [])