38
36
CXXFLAGS=${SAVE_CXXFLAGS}
40
38
AM_INIT_AUTOMAKE(nostdinc subdir-objects -Wall -Werror)
42
41
if test "x${enable_dependency_tracking}" = "x"
44
43
enable_dependency_tracking=yes
50
dnl Checks for programs.
46
if test -d "${srcdir}/.bzr"
53
55
gl_USE_SYSTEM_EXTENSIONS
54
if test "$GCC" = "yes"
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"
60
CPP="/usr/bin/gcc-4.2 -E"
64
AC_CACHE_CHECK([if GCC is recent enough], [drizzle_cv_gcc_recent],
65
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
66
#if !defined(__GNUC__) || (__GNUC__ < 4) || ((__GNUC__ >= 4) && (__GNUC_MINOR__ < 1))
67
# error GCC is Too Old!
70
[drizzle_cv_gcc_recent=yes],
71
[drizzle_cv_gcc_recent=no])])
72
if test "$drizzle_cv_gcc_recent" = "no" -a "$host_vendor" = "apple"
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])
76
if test "$drizzle_cv_gcc_recent" = "no"
78
AC_MSG_ERROR([Your version of GCC is too old. Drizzle requires at least version 4.1])
61
dnl Once we can use a modern autoconf, we can use this
81
64
AC_CXX_HEADER_STDCXX_98
82
65
if test "$ac_cv_cxx_stdcxx_98" = "no"
84
67
AC_MSG_ERROR([No working C++ Compiler has been found. Drizzle requires a C++ compiler that can handle C++98])
89
if test "$am_cv_prog_cc_stdc" = "no"
91
AC_MSG_ERROR([Drizzle requires an ANSI C compiler (and a C++ compiler). Try gcc. See the Installation chapter in the Reference Manual.])
98
81
AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
100
AC_PROG_GCC_TRADITIONAL
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
107
# VERSION 5.1.40sp1-alpha 5.0.34a
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
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 | \
117
awk -F. '{printf "%d%0.2d%0.2d", $1, $2, $3}'`
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])
83
# Version with no dots
84
AC_DEFINE([DRIZZLE_VERSION_ID],[RELEASE_ID],
85
[Version ID that can be easily used for numeric comparison])
123
87
AC_DEFINE([_BACKWARD_BACKWARD_WARNING_H],[1],[Hack to disable deprecation warning in gcc])
138
102
# Canonicalize the configuration name.
140
# Check whether --with-system-type or --without-system-type was given.
141
AC_ARG_WITH([system-type],
142
[AS_HELP_STRING([--with-system-type],
143
[Set the system type, like "sun-solaris10"])],
144
[SYSTEM_TYPE="$withval"],
145
[SYSTEM_TYPE="$host_vendor-$host_os"])
146
AC_ARG_WITH([machine-type],
147
[AS_HELP_STRING([--with-machine-type],
148
[Set the machine type, like "sparc"])],
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])
104
AC_DEFINE_UNQUOTED([HOST_VENDOR], ["$host_vendor"],[Vendor of Build System])
105
AC_DEFINE_UNQUOTED([HOST_OS], ["$host_os"], [OS of Build System])
106
AC_DEFINE_UNQUOTED([HOST_CPU], ["$host_cpu"], [CPU of Build System])
158
# Detect intel x86 like processor
159
BASE_MACHINE_TYPE=$MACHINE_TYPE
160
case $MACHINE_TYPE in
161
i?86) BASE_MACHINE_TYPE=i386 ;;
108
AC_DEFINE_UNQUOTED([TARGET_VENDOR], ["$target_vendor"],[Vendor of Target System])
109
AC_DEFINE_UNQUOTED([TARGET_OS], ["$target_os"], [OS of Target System])
110
AC_DEFINE_UNQUOTED([TARGET_CPU], ["$target_cpu"], [CPU of Target System])
165
113
case "$target_os" in
200
145
AM_CONDITIONAL(HAVE_LCOV,[test "x$LCOV" != "x"])
206
dnl Not critical since the generated file is distributed
207
147
AC_CHECK_PROGS(YACC, ['bison -y'])
208
if test -z "$YACC" && test -d "$srcdir/.bzr"
148
if test -z "$YACC" && test "$building_from_bzr" = "yes"
210
150
AC_MSG_ERROR(["bison is required for Drizzle to build from a bzr branch"])
213
AC_CHECK_PROGS(ISAINFO, [isainfo], [no])
214
AS_IF([test "x$ISAINFO" != "xno"],
215
[isainfo_b=`isainfo -b`],
218
154
# Build optimized or debug version ?
219
155
# First check for gcc and g++
220
156
if test "$GCC" = "yes"
222
if test "$isainfo_b" = "64"
226
159
AC_DEFINE([_GNU_SOURCE],[1],[Fix problem with S_ISLNK() on Linux])
228
161
dnl The following is required for portable results of floating point
229
162
dnl calculations on PowerPC. The same must also be done for IA-64, but
230
163
dnl this options is missing in the IA-64 gcc backend.
164
case "$target_cpu" in
232
165
*ppc* | *powerpc*)
233
CFLAGS="-mno-fused-madd ${CFLAGS}"
234
CXXFLAGS="-mno-fused-madd ${CXXFLAGS}"
166
AM_CFLAGS="-mno-fused-madd ${AM_CFLAGS}"
167
AM_CXXFLAGS="-mno-fused-madd ${AM_CXXFLAGS}"
238
CFLAGS="-ggdb3 ${IS_64} -std=gnu99 ${CFLAGS}"
239
CXXFLAGS="-ggdb3 ${IS_64} ${CXXFLAGS}"
240
AC_CXX_CHECK_STANDARD
171
dnl Once we can use a modern autoconf, we can replace the std=gnu99 here
172
dnl with using AC_CC_STD_C99 above
173
CC="${CC} -std=gnu99"
175
AM_CFLAGS="-ggdb3 ${AM_CFLAGS}"
176
AM_CXXFLAGS="-ggdb3 ${AM_CXXFLAGS}"
243
178
DEBUG_CFLAGS="-O0"
244
179
DEBUG_CXXFLAGS="-O0"
249
184
if test "$SUNCC" = "yes"
251
if test "$isainfo_b" = "64"
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_
257
if test "$target_cpu" = "sparc"
259
MEMALIGN_FLAGS="-xmemalign=8s"
262
if test "x$use_additional" != "xyes"
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"
267
LDFLAGS="${LDFLAGS} -L/usr/local/lib -L/opt/csw/lib"
269
CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/opt/csw/include"
271
AS_IF([test "$isainfo_b" != "none"],
272
[LDFLAGS="${LDFLAGS} -L/usr/lib/${isainfo_b}"])
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}"
277
DEBUG_CXXFLAGS="-xO0"
279
dnl TODO: -xO4 causes a Sun Studio failure in innodb... let's check back
281
OPTIMIZE_FLAGS="-xO3 -xlibmil -xdepend"
186
dnl Once we can use a modern autoconf, we can replace the -xc99=all here
187
dnl with using AC_CC_STD_C99 above
190
AM_CFLAGS="-g -mt ${AM_CFLAGS}"
191
AM_CXXFLAGS="-xlang=c99 -g -mt -compat=5 -library=stlport4 -template=no%extdef ${AM_CXXFLAGS}"
193
OPTIMIZE_FLAGS="-xO3 -xlibmil -xdepend -xbuiltin -lmopt"
282
194
OPTIMIZE_CFLAGS="${OPTIMIZE_FLAGS} -Xa -xstrconst"
283
195
OPTIMIZE_CXXFLAGS="${OPTIMIZE_FLAGS}"
287
m4_include(m4/gettext.m4)
288
200
AM_GNU_GETTEXT(external, need-formatstring-macros)
289
201
if test "x$MSGMERGE" = "x" -o "x$MSGMERGE" = "x:"
323
235
if test "$with_debug" = "yes"
325
237
# Debuging. No optimization.
326
CFLAGS="${DEBUG_CFLAGS} ${CFLAGS}"
327
CXXFLAGS="${DEBUG_CXXFLAGS} ${CXXFLAGS}"
238
AM_CFLAGS="${DEBUG_CFLAGS} ${AM_CFLAGS}"
239
AM_CXXFLAGS="${DEBUG_CXXFLAGS} ${AM_CXXFLAGS}"
329
241
# Optimized version. No debug
330
CFLAGS="${OPTIMIZE_CFLAGS} ${CFLAGS}"
331
CXXFLAGS="${OPTIMIZE_CXXFLAGS} ${CXXFLAGS}"
242
AM_CFLAGS="${OPTIMIZE_CFLAGS} ${AM_CFLAGS}"
243
AM_CXXFLAGS="${OPTIMIZE_CXXFLAGS} ${AM_CXXFLAGS}"
542
dnl Find paths to some shell programs
543
AC_PATH_PROG(LN, ln, ln)
544
# This must be able to take a -f flag like normal unix ln.
545
AC_PATH_PROG(LN_CP_F, ln, ln)
547
AC_PATH_PROG(MV, mv, mv)
548
AC_PATH_PROG(RM, rm, rm)
549
AC_PATH_PROG(CP, cp, cp)
550
AC_PATH_PROG(SED, sed, sed)
551
AC_PATH_PROG(CMP, cmp, cmp)
552
AC_PATH_PROG(CHMOD, chmod, chmod)
553
AC_PATH_PROG(HOSTNAME, hostname, hostname)
554
# Check for a GNU tar named 'gtar', or 'gnutar' (MacOS X) and
555
# fall back to 'tar' otherwise and hope that it's a GNU tar as well
556
AC_CHECK_PROGS(TAR, gnutar gtar tar)
558
dnl We use a path for perl so the script startup works
559
dnl We make sure to use perl, not perl5, in hopes that the RPMs will
560
dnl not depend on the perl5 binary being installed (probably a bug in RPM)
561
454
AC_PATH_PROG(PERL, perl, no)
562
if test "$PERL" != "no" && $PERL -e 'require 5' > /dev/null 2>&1
566
AC_PATH_PROG(PERL5, perl5, no)
567
if test "$PERL5" != no
570
ac_cv_path_PERL=$ac_cv_path_PERL5
578
# icheck, used for ABI check
579
AC_PATH_PROG(ICHECK, icheck, no)
580
# "icheck" is also the name of a file system check program on Tru64.
581
# Verify the program found is really the interface checker.
582
if test "x$ICHECK" != "xno"
584
AC_MSG_CHECKING(if $ICHECK works as expected)
585
echo "int foo;" > conftest.h
586
$ICHECK --canonify -o conftest.ic conftest.h 2>/dev/null
587
if test -f "conftest.ic"
594
rm -f conftest.ic conftest.h
599
AC_PATH_PROG(PS, ps, ps)
600
AC_MSG_CHECKING("how to check if pid exists")
603
if $PS p $$ 2> /dev/null | grep `echo $0 | sed s/\-//` > /dev/null
605
FIND_PROC="$PS p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
607
elif $PS -fp $$ 2> /dev/null | grep $0 > /dev/null
609
FIND_PROC="$PS -p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
611
elif $PS -uaxww 2> /dev/null | grep $0 > /dev/null
613
FIND_PROC="$PS -uaxww | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
615
elif $PS -ef 2> /dev/null | grep $0 > /dev/null
617
FIND_PROC="$PS -ef | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
618
# Do anybody use this?
619
elif $PS $$ 2> /dev/null | grep $0 > /dev/null
621
FIND_PROC="$PS \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
624
*freebsd*|*dragonfly*|*cygwin*)
625
FIND_PROC="$PS p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
628
FIND_PROC="$PS -uaxww | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
631
AC_MSG_ERROR([Could not find the right ps switches. Which OS is this ?. See the Installation chapter in the Reference Manual.])
636
AC_MSG_RESULT("$FIND_PROC")
638
# Check if a pid is valid
639
AC_PATH_PROG(KILL, kill, kill)
640
AC_MSG_CHECKING("for kill switches")
641
if $ac_cv_path_KILL -0 $$
643
CHECK_PID="$ac_cv_path_KILL -0 \$\$PID > /dev/null 2> /dev/null"
646
CHECK_PID="$ac_cv_path_KILL -s 0 \$\$PID > /dev/null 2> /dev/null"
648
AC_MSG_WARN([kill -0 to check for pid seems to fail])
649
CHECK_PID="$ac_cv_path_KILL -s SIGCONT \$\$PID > /dev/null 2> /dev/null"
652
AC_MSG_RESULT("$CHECK_PID")
655
# Check if we need noexec stack for assembler
658
457
AC_ARG_WITH([server-suffix],
659
458
[AS_HELP_STRING([--with-server-suffix],
865
661
COMPILATION_COMMENT=$with_comment
867
COMPILATION_COMMENT="Source distribution"
663
COMPILATION_COMMENT="Source distribution (RELEASE_COMMENT)"
869
665
AC_DEFINE_UNQUOTED([COMPILATION_COMMENT],["$COMPILATION_COMMENT"],
870
666
[Comment about compilation environment])
872
668
dnl Checks for typedefs, structures, and compiler characteristics.
879
671
# off_t is not a builtin type
880
672
AC_CHECK_SIZEOF(off_t, 4)
1414
1195
if test "$GCC" = "yes"
1416
CPPFLAGS="-isystem \$(top_srcdir)/gnulib -isystem \$(top_builddir)/gnulib ${CPPFLAGS}"
1197
AM_CPPFLAGS="-isystem \$(top_srcdir)/gnulib -isystem \$(top_builddir)/gnulib ${AM_CPPFLAGS}"
1418
CPPFLAGS="-I\$(top_srcdir)/gnulib -I\$(top_builddir)/gnulib ${CPPFLAGS}"
1199
AM_CPPFLAGS="-I\$(top_srcdir)/gnulib -I\$(top_builddir)/gnulib ${AM_CPPFLAGS}"
1422
CPPFLAGS="-I\$(top_srcdir) -I\$(top_builddir) ${CPPFLAGS}"
1423
CFLAGS="${CC_WARNINGS} ${CFLAGS}"
1424
CXXFLAGS="${CXX_WARNINGS} ${W_EXCEPTIONS} ${CXXFLAGS}"
1203
AM_CPPFLAGS="-I\$(top_srcdir) -I\$(top_builddir) ${AM_CPPFLAGS}"
1204
AM_CFLAGS="${CC_WARNINGS} ${AM_CFLAGS}"
1205
AM_CXXFLAGS="${CXX_WARNINGS} ${W_EXCEPTIONS} ${AM_CXXFLAGS}"
1426
1207
dnl Must be done once we turn on warnings and such
1427
1208
AC_CACHE_CHECK(
1495
AC_CONFIG_COMMANDS([timestamp-h], , test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h)
1497
AC_CONFIG_COMMANDS_PRE([
1498
if test "x$EGREP" != "x" -a -d po
1500
echo "# This file is auto-generated from configure. Do not edit directly" > po/POTFILES.in.in
1501
# The grep -v 'drizzle-' is to exclude any distcheck leftovers
1502
for f in `find . | grep -v 'drizzle-' | ${EGREP} '\.(cc|c|h|yy)$' | cut -c3- | sort`
1504
if grep gettext.h "$f" | grep include >/dev/null 2>&1
1506
echo "$f" >> po/POTFILES.in.in
1509
if ! diff po/POTFILES.in.in po/POTFILES.in >/dev/null 2>&1
1511
mv po/POTFILES.in.in po/POTFILES.in
1513
rm po/POTFILES.in.in
1516
touch po/POTFILES.in
1520
# Ensure that table handlers gets all modifications to CFLAGS/CXXFLAGS
1521
AC_CONFIG_COMMANDS_POST(ac_configure_args="$ac_configure_args CFLAGS='$CFLAGS' CXXFLAGS='$CXXFLAGS' AM_CFLAGS='$AM_CFLAGS' AM_CXXFLAGS='$AM_CXXFLAGS'")
1526
echo "Configuration summary for $PACKAGE_NAME version $VERSION"
1271
echo "Configuration summary for $PACKAGE_NAME version $VERSION RELEASE_COMMENT"
1528
1273
echo " * Installation prefix: $prefix"
1529
echo " * System type: $SYSTEM_TYPE"
1274
echo " * System type: $host_vendor-$host_os"
1530
1275
echo " * Host CPU: $host_cpu"
1531
1276
echo " * C Compiler: $CC_VERSION"
1532
1277
echo " * C++ Compiler: $CXX_VERSION"