~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to configure.ac

Merged build changes from Antony.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
AC_PREREQ(2.59)dnl              Minimum Autoconf version required.
5
5
 
6
6
AC_INIT
7
 
AC_CONFIG_SRCDIR([server/drizzled.cc])
 
7
AC_CONFIG_SRCDIR([drizzled/drizzled.cc])
8
8
AC_CONFIG_AUX_DIR(config)
9
 
AC_CONFIG_HEADERS([include/config.h:config.h.in])
 
9
AC_CONFIG_HEADERS([config.h])
10
10
AC_CANONICAL_TARGET
11
11
AM_INIT_AUTOMAKE(drizzle, 7.0.0, no-define)
12
12
 
49
49
sinclude(config/ac-macros/readline.m4)
50
50
sinclude(config/ac-macros/ssl.m4)
51
51
sinclude(config/ac-macros/pkg.m4)
 
52
sinclude(config/ac-macros/ac_cxx_header_stdcxx_98.m4)
52
53
 
53
 
# Remember to add a directory server/share/LANGUAGE
 
54
# Remember to add a directory drizzled/share/LANGUAGE
54
55
AVAILABLE_LANGUAGES="\
55
56
czech danish dutch english estonian french german greek hungarian \
56
57
italian japanese korean norwegian norwegian-ny polish portuguese \
155
156
CXXFLAGS="$CXXFLAGS $C_EXTRA_FLAGS "
156
157
 
157
158
dnl Checks for programs.
158
 
AC_PROG_AWK
159
159
AC_PROG_CC
 
160
ifdef([AC_PROG_CC_C99],[
 
161
  AC_PROG_CC_C99([],[AC_MSG_ERROR([C99 support required for compiling Drizzle])])
 
162
  C99_SUPPORT_HACK=""
 
163
],[C99_SUPPORT_HACK="-std=gnu99"])
160
164
AC_PROG_CXX
 
165
AC_CXX_HEADER_STDCXX_98
 
166
if test "$ac_cv_cxx_stdcxx_98" = "no"
 
167
then
 
168
  AC_MSG_ERROR([C++ Compiler required to compile Drizzle])
 
169
fi
161
170
AC_PROG_CPP
162
171
AM_PROG_CC_C_O
163
172
 
180
189
AC_SUBST(CC_VERSION)
181
190
MYSQL_CHECK_CXX_VERSION
182
191
 
 
192
AC_PROG_AWK
 
193
 
183
194
if test "$ac_cv_c_compiler_gnu" = "yes"
184
195
then
185
196
  AS="$CC -c"
285
296
# Check for libevent
286
297
#--------------------------------------------------------------------
287
298
 
288
 
AC_CHECK_HEADERS(event.h)
289
 
if test "x$ac_cv_header_event_h" != "xyes"
 
299
AC_MSG_CHECKING(for libevent)
 
300
AC_ARG_WITH(libevent,
 
301
  [AS_HELP_STRING([--with-libevent],
 
302
       [Use libevent build directory]),
 
303
  [ with_libevent=$withval ],
 
304
  [ with_libevent=yes ])
 
305
 
 
306
if test "$withval" = "yes"
290
307
then
291
 
  AC_MSG_ERROR([Couldn't find event.h. Try installing libevent development packages])
 
308
    AC_CHECK_HEADERS(event.h)
 
309
    if test "x$ac_cv_header_event_h" != "xyes"
 
310
    then
 
311
      AC_MSG_ERROR([Couldn't find event.h. Try installing libevent development packages])
 
312
    fi
 
313
    my_save_LIBS="$LIBS"
 
314
    LIBS=""
 
315
    AC_CHECK_LIB(event, event_loop, [], [AC_MSG_ERROR(could not find libevent)])
 
316
    LIBEVENT_LIBS="${LIBS}"
 
317
    LIBS="${my_save_LIBS}"
 
318
    LIBEVENT_CFLAGS=""
 
319
else
 
320
    AC_MSG_RESULT($withval)
 
321
    if test -f $withval/event.h -a -f $withval/libevent.a; then
 
322
       owd=`pwd`
 
323
       if cd $withval; then withval=`pwd`; cd $owd; fi
 
324
       LIBEVENT_CFLAGS="-I$withval"
 
325
       LIBEVENT_LIBS="-L$withval -levent"
 
326
    elif test -f $withval/include/event.h -a -f $withval/lib/libevent.a; then
 
327
       owd=`pwd`
 
328
       if cd $withval; then withval=`pwd`; cd $owd; fi
 
329
       LIBEVENT_CFLAGS="-I$withval/include"
 
330
       LIBEVENT_LIBS="-L$withval/lib -levent"
 
331
    else
 
332
       AC_ERROR(event.h or libevent.a not found in $withval)
 
333
    fi
292
334
fi
293
 
AC_CHECK_LIB(event, event_loop, [], [AC_MSG_ERROR(could not find libevent)])
 
335
 
 
336
AC_SUBST(LIBEVENT_CFLAGS)
 
337
AC_SUBST(LIBEVENT_LIBS)
 
338
 
 
339
AC_CACHE_CHECK([for bufferevent in libevent], ac_libevent_works, [
 
340
  save_CFLAGS="$CFLAGS"
 
341
  save_LIBS="$LIBS"
 
342
  CFLAGS="$LIBEVENT_CFLAGS"
 
343
  LIBS="$LIBEVENT_LIBS"
 
344
  AC_TRY_LINK([
 
345
#include <sys/types.h>
 
346
#include <sys/time.h>
 
347
#include <stdlib.h>
 
348
#include <event.h>],[
 
349
        struct bufferevent bev;
 
350
        bufferevent_settimeout(&bev, 1, 1);
 
351
  ], ac_libevent_works=yes, [
 
352
        AC_ERROR([you need to install a more recent version of libevent,
 
353
        check http://www.monkey.org/~provos/libevent/])
 
354
  ])
 
355
 
 
356
  CFLAGS="$save_CFLAGS"
 
357
  LIBS="$save_LIBS"
 
358
])
 
359
 
294
360
 
295
361
#--------------------------------------------------------------------
296
362
# Check for libpthread
310
376
AC_ARG_ENABLE([tcmalloc],
311
377
    [AS_HELP_STRING([--enable-tcmalloc],
312
378
       [Enable linking with tcmalloc @<:@default=off@:>@])],
313
 
    [ac_warn_strict_aliasing="$enableval"],
314
 
    [ac_warn_strict_aliasing="no"])
 
379
    [ac_enable_tcmalloc="$enableval"],
 
380
    [ac_enable_tcmalloc="no"])
315
381
 
316
 
if test "x$ac_warn_strict_aliasing" = "xyes"
 
382
if test "x$ac_enable_tcmalloc" = "xyes"
317
383
then
318
384
  AC_CHECK_LIB(tcmalloc,malloc,[],[])
319
385
fi
322
388
# Check for libz
323
389
#--------------------------------------------------------------------
324
390
 
 
391
my_save_LIBS="$LIBS"
 
392
LIBS=""
325
393
AC_CHECK_HEADERS(zlib.h)
326
394
if test "x$ac_cv_header_zlib_h" != "xyes"
327
395
then
328
396
  AC_MSG_ERROR([Couldn't find zlib.h. Try installing zlib development packages])
329
397
fi
330
398
AC_CHECK_LIB(z, crc32, [], [AC_MSG_ERROR(could not find libz)])
331
 
 
332
 
 
333
 
AC_CHECK_HEADERS([readline/readline.h])
 
399
ZLIB_LIBS="$LIBS"
 
400
LIBS="$my_save_LIBS"
 
401
AC_SUBST(ZLIB_LIBS)
 
402
 
 
403
 
 
404
#--------------------------------------------------------------------
 
405
# Check for libreadline or compatible (libedit on Mac OS X)
 
406
#--------------------------------------------------------------------
 
407
 
 
408
AC_CHECK_HEADERS(readline/history.h readline/readline.h)
334
409
if test "x$ac_cv_header_readline_readline_h" != "xyes"
335
410
then
336
411
  AC_MSG_ERROR([Couldn't find readline/readline.h. Try installing readline development packages.])
337
412
fi
 
413
AC_CHECK_TYPES([HIST_ENTRY], [], [], [AC_INCLUDES_DEFAULT[
 
414
#ifdef HAVE_READLINE_HISTORY_H
 
415
#include <readline/history.h>
 
416
#endif
 
417
#include <readline/readline.h>
 
418
]])
 
419
AC_CHECK_DECLS([completion_matches], [], [], [AC_INCLUDES_DEFAULT[
 
420
#ifdef HAVE_READLINE_HISTORY_H
 
421
#include <readline/history.h>
 
422
#endif
 
423
#include <readline/readline.h>
 
424
]])
 
425
 
 
426
MYSQL_CHECK_NEW_RL_INTERFACE
 
427
 
 
428
my_save_LIBS="$LIBS"
 
429
LIBS=""
 
430
AC_CHECK_LIB(readline, rl_initialize, [],
 
431
  [AC_CHECK_LIB(ncurses, tgetent, [], [AC_MSG_ERROR(Couldn't find ncurses)]) 
 
432
   AC_SEARCH_LIBS(rl_initialize, readline, [],
 
433
    [AC_MSG_ERROR(Couldn't find libreadline.)])])
 
434
READLINE_LIBS="$LIBS"
 
435
LIBS="$my_save_LIBS"
 
436
AC_SUBST(READLINE_LIBS)
338
437
 
339
438
#--------------------------------------------------------------------
340
439
# Check for libpcre
352
451
  else
353
452
    found_pcre="yes"
354
453
    # We can't search for these well, but we sure do need them!
355
 
    PCRE_LIBS="-lpcrecpp -lpcre"
 
454
    PCRE_CFLAGS="`$PKG_CONFIG libpcrecpp --cflags`"
 
455
    PCRE_LIBS="`$PKG_CONFIG libpcrecpp --libs`"
356
456
  fi
357
457
  ])
358
458
if test "x$found_pcre" != "xyes"
363
463
AC_SUBST(PCRE_LIBS)
364
464
AC_SUBST(PCRE_CFLAGS)
365
465
 
366
 
AM_PATH_GLIB_2_0
367
 
if test "x$no_glib" != "x" ; then
368
 
    AC_MSG_ERROR([Couldn't find GLib2. Try installing libglib2.0-dev or glib2-devel])
369
 
fi
370
 
 
371
466
dnl Find paths to some shell programs
372
467
AC_PATH_PROG(LN, ln, ln)
373
468
# This must be able to take a -f flag like normal unix ln.
522
617
 
523
618
AC_MSG_CHECKING(if we should use assembler functions)
524
619
# For now we only support assembler on i386 and sparc systems
525
 
AM_CONDITIONAL(ASSEMBLER_x86, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "i386" && $AS strings/strings-x86.s -o checkassembler >/dev/null 2>&1 && test -f checkassembler && (rm -f checkassembler; exit 0;))
 
620
AM_CONDITIONAL(ASSEMBLER_x86, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "i386" && $AS mystrings/strings-x86.s -o checkassembler >/dev/null 2>&1 && test -f checkassembler && (rm -f checkassembler; exit 0;))
526
621
AM_CONDITIONAL(ASSEMBLER_sparc32, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "sparc")
527
622
AM_CONDITIONAL(ASSEMBLER_sparc64, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "sparcv9")
528
623
AM_CONDITIONAL(ASSEMBLER, test "$ASSEMBLER_x86_TRUE" = "" -o "$ASSEMBLER_sparc32_TRUE" = "")
615
710
AC_CHECK_HEADERS(sys/fpu.h utime.h sys/utime.h )
616
711
AC_CHECK_HEADERS(synch.h sys/mman.h sys/socket.h netinet/in.h arpa/inet.h)
617
712
AC_CHECK_HEADERS(sys/timeb.h sys/vadvise.h sys/wait.h term.h)
618
 
AC_CHECK_HEADERS(termio.h termios.h sched.h crypt.h alloca.h)
 
713
AC_CHECK_HEADERS(termio.h termios.h sched.h alloca.h)
619
714
AC_CHECK_HEADERS(sys/ioctl.h malloc.h sys/malloc.h sys/ipc.h sys/shm.h)
620
715
AC_CHECK_HEADERS(sys/prctl.h sys/resource.h sys/param.h port.h ieeefp.h)
621
716
AC_CHECK_HEADERS(execinfo.h)
668
763
then
669
764
  AC_MSG_ERROR([Drizzle requires dlopen])
670
765
fi
671
 
LIBDL=$LIBS
 
766
LIBDL_LIBS="$LIBS"
672
767
LIBS="$my_save_LIBS"
673
 
AC_SUBST(LIBDL)
 
768
AC_SUBST(LIBDL_LIBS)
674
769
 
675
770
AC_CHECK_FUNCS(strtok_r)
676
771
 
710
805
  DEBUG_OPTIMIZE_CXX=""
711
806
fi
712
807
 
 
808
dnl TODO: Remove this define once we are using 2.61 across the board.
 
809
# AC_HEADER_ASSERT
 
810
# ----------------
 
811
# Check whether to enable assertions.
 
812
ifdef([AC_HEADER_ASSERT],[],AC_DEFUN([AC_HEADER_ASSERT],
 
813
[
 
814
  AC_MSG_CHECKING([whether to enable assertions])
 
815
  AC_ARG_ENABLE([assert],
 
816
    [  --disable-assert        turn off assertions],
 
817
    [AC_MSG_RESULT([no])
 
818
     AC_DEFINE(NDEBUG, 1, [Define to 1 if assertions should be disabled.])],
 
819
    [AC_MSG_RESULT(yes)])
 
820
]))
 
821
 
 
822
AC_HEADER_ASSERT
 
823
 
713
824
CFLAGS="${SYMBOLS_CFLAGS} ${CFLAGS}"
714
825
CXXFLAGS="${SYMBOLS_CXXFLAGS} ${CXXFLAGS}"
715
826
 
 
827
AC_ARG_WITH([debug],
 
828
    [AS_HELP_STRING([--with-debug],
 
829
       [Add debug code/turns off optimizations (yes|no) @<:@default=no@:>@])],
 
830
    [with_debug=$withval],
 
831
    [with_debug=no])
 
832
if test "$with_debug" = "yes"
 
833
then
 
834
  # Medium debug.
 
835
  CFLAGS="$DEBUG_OPTIMIZE_CC $CFLAGS"
 
836
  CXXFLAGS="$DEBUG_OPTIMIZE_CXX $CXXFLAGS"
 
837
else
 
838
  # Optimized version. No debug
 
839
  CFLAGS="$OPTIMIZE_CFLAGS $CFLAGS"
 
840
  CXXFLAGS="$OPTIMIZE_CXXFLAGS $CXXFLAGS"
 
841
fi
 
842
 
 
843
 
716
844
AC_ARG_WITH([fast-mutexes],
717
845
    [AS_HELP_STRING([--with-fast-mutexes],
718
846
            [Compile with fast mutexes  @<:@default=off@:>@])],
826
954
 
827
955
MYSQL_PTHREAD_YIELD
828
956
 
829
 
######################################################################
830
 
# For readline/libedit (We simply move the mimimum amount of stuff from
831
 
# the readline/libedit configure.in here)
832
957
 
833
958
dnl Checks for header files.
834
959
AC_CHECK_HEADERS(malloc.h sys/cdefs.h)
878
1003
then
879
1004
  MYSQL_CHECK_LIB_TERMCAP
880
1005
else
881
 
  TERMCAP_LIB="$with_named_curses"
 
1006
  TERMCAP_LIBS="$with_named_curses"
882
1007
fi
883
 
AC_SUBST(TERMCAP_LIB)
 
1008
AC_SUBST(TERMCAP_LIBS)
884
1009
 
885
1010
# Check if the termcap function 'tgoto' is already declared in
886
1011
# system header files or if it need to be declared locally
922
1047
  AC_MSG_ERROR("Drizzle requires fcntl.")
923
1048
fi
924
1049
 
925
 
AC_CHECK_FUNCS(bcmp bfill bmove bsearch bzero \
 
1050
AC_CHECK_FUNCS(bsearch \
926
1051
  cuserid fchmod \
927
1052
  fdatasync finite fpresetsticky fpsetmask fsync ftruncate \
928
1053
  getcwd getpass getpassphrase getpwnam \
929
1054
  getpwuid getrlimit getrusage getwd index initgroups isnan \
930
1055
  localtime_r gethrtime gmtime_r \
931
 
  locking longjmp lrand48 madvise mallinfo memcpy memmove \
 
1056
  locking longjmp lrand48 madvise mallinfo \
 
1057
  memmove \
932
1058
  mkstemp mlockall perror poll pread pthread_attr_create mmap mmap64 getpagesize \
933
1059
  pthread_attr_getstacksize pthread_attr_setprio pthread_attr_setschedparam \
934
1060
  pthread_attr_setstacksize pthread_condattr_create pthread_getsequence_np \
1203
1329
  fi
1204
1330
 
1205
1331
  BASE_WARNINGS="-W -Wall -Wextra"
1206
 
  GCC_WARNINGS="${BASE_WARNINGS} -std=gnu99 ${GCC_PEDANTIC} ${W_UNREACHABLE} ${W_FAIL} ${GPROF_PROFILING} ${GPROF_COVERAGE}"
1207
 
  GXX_WARNINGS="${BASE_WARNINGS} -std=gnu++98 ${GXX_PEDANTIC} ${W_UNREACHABLE} ${W_FAIL} ${GPROF_PROFILING} ${GPROF_COVERAGE}"
 
1332
  GCC_WARNINGS="${C99_SUPPORT_HACK} ${BASE_WARNINGS} ${GCC_PEDANTIC} ${W_UNREACHABLE} ${W_FAIL} ${GPROF_PROFILING} ${GPROF_COVERAGE}"
 
1333
  GXX_WARNINGS="${BASE_WARNINGS} ${GXX_PEDANTIC} ${W_UNREACHABLE} ${W_FAIL} ${GPROF_PROFILING} ${GPROF_COVERAGE}"
1208
1334
 
1209
1335
  CXXFLAGS="$CXXFLAGS ${GXX_WARNINGS}"
1210
1336
  CFLAGS="$CFLAGS ${GCC_WARNINGS} "
1211
1337
fi
1212
1338
 
 
1339
AC_SUBST([GLOBAL_CPPFLAGS],['-I$(top_srcdir) -I$(top_builddir)'])
 
1340
AC_SUBST([AM_CPPFLAGS],['${GLOBAL_CPPFLAGS}'])
 
1341
 
1213
1342
# Some usefull subst
1214
1343
AC_SUBST(CC)
1215
1344
AC_SUBST(GXX)
1226
1355
AC_SUBST(MAKE_BINARY_DISTRIBUTION_OPTIONS)
1227
1356
 
1228
1357
AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile mysys/tests/Makefile dnl
1229
 
 strings/Makefile strings/tests/Makefile storage/Makefile dnl
 
1358
 mystrings/Makefile mystrings/tests/Makefile storage/Makefile dnl
1230
1359
 vio/Makefile dnl
1231
1360
 libdrizzle/Makefile client/Makefile dnl
1232
 
 server/Makefile server/share/Makefile dnl
1233
 
 server/sql_builtin.cc dnl
1234
 
 include/Makefile dnl
 
1361
 drizzled/Makefile dnl
 
1362
 drizzled/field/Makefile dnl
 
1363
 drizzled/share/Makefile dnl
 
1364
 drizzled/sql_builtin.cc dnl
1235
1365
 support-files/Makefile dnl
1236
1366
 tests/Makefile tests/install_test_db dnl
1237
 
 include/drizzle_version.h plugin/Makefile dnl
1238
 
 server/drizzled_safe support-files/libdrizzle.pc dnl
 
1367
 drizzled/version.h plugin/Makefile dnl
 
1368
 drizzled/drizzled_safe support-files/libdrizzle.pc dnl
1239
1369
 support-files/drizzle.server support-files/drizzle-log-rotate)
1240
1370
 
1241
1371
AC_CONFIG_COMMANDS([default], , test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h)