-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
128 lines (110 loc) · 3.79 KB
/
configure.ac
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
dnl -*- Autoconf -*-
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ([2.68])
AC_INIT(foxbot, 0.0.1, [email protected])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_FILES([Makefile bot/Makefile src/Makefile plugins/Makefile tests/Makefile])
AC_CONFIG_SRCDIR([src/foxbot.c])
AC_CONFIG_HEADERS([include/config.h])
AM_INIT_AUTOMAKE([-Wall -Werror foreign nostdinc subdir-objects])
dnl Define directories
AC_DEFINE_DIR([PREFIX],[prefix],[Set to prefix.])
AC_DEFINE_DIR([SYSCONFDIR],[sysconfdir],[Set to sysconfdir.])
AC_DEFINE_DIR([LIBDIR],[libdir],[Set to libdir.])
AC_DEFINE_DIR([LIBEXECDIR],[libexecdir],[Set to libexecdir.])
AC_DEFINE_DIR([DATADIR],[datadir],[Set to datadir.])
AC_DEFINE_DIR([LOCALSTATEDIR],[localstatedir],[Set to localstatedir.])
dnl Checks for programs.
AC_PROG_AWK
AC_PROG_CC_C99
AC_PROG_YACC
AM_PROG_AR
AM_PROG_LEX
dnl initialize libtool
LT_CONFIG_LTDL_DIR([libltdl])
LT_INIT([dlopen disable-static])
LTDL_INIT([recursive convenience])
LIBTOOL="$LIBTOOL --silent"
dnl m4 directory
AC_CONFIG_MACRO_DIR([m4])
AC_SUBST([AM_CPPFLAGS], ['-I$(top_srcdir)/include'])
AC_SUBST([AM_CFLAGS])
dnl Enable warnings.
AX_CHECK_COMPILE_FLAG([-Werror], [WERROR=-Werror], [WERROR=])
AX_CHECK_COMPILE_FLAG([$WERROR -std=c99],
[AX_APPEND_FLAG([-std=c99], [AM_CFLAGS])])
AX_CHECK_COMPILE_FLAG([$WERROR -Wall],
[AX_APPEND_FLAG([-Wall], [AM_CFLAGS])])
AX_CHECK_COMPILE_FLAG([$WERROR -Wextra],
[AX_APPEND_FLAG([-Wextra], [AM_CFLAGS])])
AX_CHECK_COMPILE_FLAG([$WERROR -pedantic],
[AX_APPEND_FLAG([-pedantic], [AM_CFLAGS])])
dnl Checks for header files.
AC_CHECK_HEADERS([malloc.h netdb.h stdlib.h string.h sys/socket.h unistd.h limits.h])
AC_CHECK_HEADERS([fcntl.h], [], [AC_MSG_ERROR([cannot find fcntl.h.])])
dnl Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UINT8_T
AC_C_INLINE
dnl Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([malloc_usable_size memchr memmove memset socket strchr strcspn])
AC_CHECK_FUNCS([strtol strtoul strstr])
AC_FUNC_STRERROR_R
dnl debugging information
AC_MSG_CHECKING(whether to enable debugging symbols)
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug], [Turn on debugging])],
[
AX_APPEND_FLAG([-O0])
AC_MSG_RESULT(yes)
],
[
AC_MSG_RESULT(no)
])
dnl memory debug spam
AC_MSG_CHECKING(whether to enable memory debugging spam)
AC_ARG_ENABLE([memdebug],
[AS_HELP_STRING([--enable-memdebug], [Print memory debugging information])],
[
AC_DEFINE([WANT_MEMDEBUG], [1], [Print out memory debugging information])
AC_MSG_RESULT(yes)
],
[
AC_MSG_RESULT(no)
])
dnl check for pkg-config
if test m4_ifdef([PKG_CHECK_MODULES], [yes], [no]) == no; then
AC_MSG_ERROR([pkg-config is required.
Please install it via your system's package manager or visit pkg-config.freedesktop.org])
fi
dnl Check for libcheck and netinet/in.h
PKG_CHECK_MODULES([CHECK], [check],
[
HAVE_CHECK=1
AC_CHECK_HEADERS([netinet/in.h], [], [AC_MSG_ERROR([cannot find netinet/in.h.])])
],
[
HAVE_CHECK=0
])
AX_CHECK_COMPILE_FLAG([$WERROR -Wno-gnu-zero-variadic-macro-arguments],
[AX_APPEND_FLAG([-Wno-gnu-zero-variadic-macro-arguments], [CHECK_CFLAGS])])
AC_REQUIRE_AUX_FILE([tap-driver.sh])
dnl Check for plugin directory
AC_MSG_CHECKING([whether to modify plugin path])
AC_ARG_WITH(plugindir,
[AC_HELP_STRING([--with-plugindir=DIR], [Directory to install plugins.])],
[plugindir=`echo $withval | sed 's/\/$//'`
AC_MSG_RESULT(yes)],
[
plugindir=${libdir}/${PACKAGE}/plugins
AC_MSG_RESULT(no)
])
AC_DEFINE_DIR(PLUGIN_DIR, plugindir, [Prefix where plugins are installed.])
AC_CONFIG_COMMANDS([plugins/third_party/libdir.mk],
[echo LIBDIR = ${prefix}${plugindir} > plugins/third_party/libdir.mk],
[plugindir=$plugindir;prefix=$prefix])
AC_OUTPUT