summaryrefslogtreecommitdiffstats
path: root/configure.ac
blob: 5e655dccc7d8379f8f1880c708066ea9feb1df2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.59)
AC_INIT(mysql-table-sizes-plugin, [dev])
AC_CANONICAL_TARGET
AC_CONFIG_MACRO_DIR([m4])

AM_INIT_AUTOMAKE

AC_CONFIG_SRCDIR([src/table_sizes.cc])
AC_CONFIG_HEADER([src/config.h])

AC_DEFUN([CHECK_DEBUG], [
  AC_ARG_ENABLE([debug],
    AS_HELP_STRING([--enable-debug], [turn on debugging, default: no]))

  AC_MSG_CHECKING(whether to enable debugging)
  AS_IF([test "x$enable_debug" = "xyes"],
    [
      CPPFLAGS="$CPPFLAGS -g -D_DEBUG"
      AC_MSG_RESULT(yes)
    ],
    [
      CPPFLAGS="$CPPFLAGS -g -O2 -DDBUG_OFF"
      AC_MSG_RESULT(no)
    ]
  )
])

AC_DEFUN([CHECK_FAST_MUTEXES], [
  AC_ARG_ENABLE([fast-mutexes],
    AS_HELP_STRING([--enable-fast-mutexes], [compile with fast mutexes, default: no]))

  AC_MSG_CHECKING(whether to compile with fast mutexes)
  AS_IF([test "x$enable_fast_mutexes" = "xyes"],
    [
      CPPFLAGS="$CPPFLAGS -DMY_PTHREAD_FASTMUTEX=1"
      AC_MSG_RESULT(yes)
    ],
    [ AC_MSG_RESULT(no) ]
  )
])


dnl Run tests using C++ compiler
dnl AC_LANG(C++)

CHECK_DEBUG
CHECK_FAST_MUTEXES

#check for mysql src
MYSQL_SRC_TEST
MYSQL_PLUGIN_DIR_TEST
#MYSQL_LIB_SERVICES_TEST
AC_SUBST(MYSQL_INC)
AC_SUBST(MYSQL_PLUGIN_DIR)
#AC_SUBST(MYSQL_LIBSERVICES)

#check for programs
AC_PROG_CC
AC_PROG_LIBTOOL
AC_PROG_CXX
AC_PROG_CPP

#we can add the following flags for better error catching: -Werror
CPPFLAGS="$CPPFLAGS -Werror"
# From MySQL: Disable exceptions as they seams to create problems with gcc and threads.
CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-rtti"

#make sure we have const
AC_C_CONST
AC_TYPE_SIZE_T

#subst the relevant variables
AC_SUBST(CPPFLAGS)
AC_SUBST(CXXLAGS)
AC_SUBST(CFLAGS)

AC_CONFIG_FILES([
  Makefile
  src/Makefile
])
AC_OUTPUT