-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathconfigure.ac
195 lines (157 loc) · 5.31 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
AC_INIT(task, 1.9.4, [email protected])
# Source type.
AC_PROG_CXX
AC_PROG_CC
AC_LANG(C++)
# Local copies for modification and later AC_SUBST.
CFLAGS="${CFLAGS=}"
CXXFLAGS="${CXXFLAGS=}"
# this macro is used to get the arguments supplied
# to the configure script (./configure --enable-debug)
# Check if we have enable debug support.
AC_MSG_CHECKING(whether to enable debugging)
debug_default="no"
AC_ARG_ENABLE(debug, [ --enable-debug=[no/yes] turn on debugging
[default=$debug_default]],, enable_debug=$debug_default)
if test "x$enable_debug" = "xyes"; then
CFLAGS="$CFLAGS -Wall -pedantic -ggdb3 -DDEBUG"
CXXFLAGS="$CXXFLAGS -Wall -pedantic -ggdb3 -DDEBUG"
AC_MSG_RESULT(yes)
else
CFLAGS="$CFLAGS -Wall -pedantic -O3"
CXXFLAGS="$CXXFLAGS -Wall -pedantic -O3"
AC_MSG_RESULT(no)
fi
# Check for OS.
OS=`uname|sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'|cut -c 1-5`
if test "$OS" = "sunos"; then
AC_MSG_NOTICE([OS Solaris detected])
AC_DEFINE([SOLARIS], [], [Compiling on Solaris])
elif test "$OS" = "darwi"; then
AC_MSG_NOTICE([OS Darwin detected])
AC_DEFINE([DARWIN], [], [Compiling on Darwin])
elif test "$OS" = "cygwi"; then
AC_MSG_NOTICE([OS Cygwin detected])
AC_DEFINE([CYGWIN], [], [Compiling on Cygwin])
elif test "$OS" = "openb"; then
AC_MSG_NOTICE([OS OpenBSD detected])
AC_DEFINE([OPENBSD], [], [Compiling on OpenBSD])
elif test "$OS" = "haiku"; then
AC_MSG_NOTICE([OS Haiku detected])
AC_DEFINE([HAIKU], [], [Compiling on Haiku])
elif test "$OS" = "freeb"; then
AC_MSG_NOTICE([OS FreeBSD detected])
AC_DEFINE([FREEBSD], [], [Compiling on FreeBSD])
elif test "$OS" = "linux"; then
AC_MSG_NOTICE([OS Linux detected])
AC_DEFINE([LINUX], [], [Compiling on Linux])
else
AC_MSG_NOTICE([OS not detected])
AC_DEFINE([UNKNOWN], [], [Compiling on Unknown])
fi
# Readline enabled by default.
#AC_ARG_WITH([readline],
# [AS_HELP_STRING([--without-readline], [disable support for readline])],
# [with_readline=no],
# [with_readline=yes])
#
#AC_ARG_WITH([readline-inc],
# [AS_HELP_STRING ([--with-readline-inc=DIR], [readline include files are in DIR])],
# [readline_inc=$withval],
# [readline_inc=''])
#
#AC_ARG_WITH([readline-lib],
# [AS_HELP_STRING ([--with-readline-lib=DIR], [readline lib files are in DIR])],
# [readline_lib=$withval],
# [readline_lib=''])
#
#if test "x$with_readline" = "xyes" ; then
# AC_DEFINE([HAVE_LIBREADLINE], [1], [Defined if you have libreadline])
# if test -n "$readline_inc"; then
# CFLAGS="$CFLAGS -I$readline_inc"
# CXXFLAGS="$CXXFLAGS -I$readline_inc"
# fi
#
# if test -n "$readline_lib"; then
# LDFLAGS="$LDFLAGS -L$readline_lib"
# fi
#
# AC_CHECK_LIB([readline],[main])
#fi
# Lua disabled by default.
AC_ARG_WITH([lua],
[AS_HELP_STRING([--with-lua], [enable support for lua])],
[with_lua=yes],
[with_lua=no])
AC_ARG_WITH([lua-inc],
[AS_HELP_STRING ([--with-lua-inc=DIR], [lua include files are in DIR])],
[lua_inc=$withval],
[lua_inc=''])
AC_ARG_WITH([lua-lib],
[AS_HELP_STRING ([--with-lua-lib=DIR], [lua lib files are in DIR])],
[lua_lib=$withval],
[lua_lib=''])
if test "x$with_lua" = "xyes" ; then
AC_DEFINE([HAVE_LIBLUA], [1], [Defined if you have liblua])
if test -n "$lua_inc"; then
CFLAGS="$CFLAGS -I$lua_inc"
CXXFLAGS="$CXXFLAGS -I$lua_inc"
fi
if test -n "$lua_lib"; then
LDFLAGS="$LDFLAGS -L$lua_lib"
fi
AC_CHECK_LIB([lua],[main])
# The following code should replace the one line above, but is not working.
# Anyone know why?
# # check for lua. this is separate from the above libraries because it's
# # liblua50 on debian and liblua everywhere else.
# AC_CHECK_LIB(lua, lua_open, LIB_LUA="-llua")
# AC_CHECK_LIB(lualib, luaopen_base, LIB_LUA_LIB=-llualib, , [$LIB_LUA -ldl -lm])
#
# if test "x${LIB_LUA}" = "x"; then
# echo "Could not find liblua. Please install liblua 5.1+"
# exit 1
# fi
#
# if test "x${LIB_LUA_LIB}" = "x"; then
# echo "Could not find liblualib. Please install liblualib 5.1+"
# exit 1
# fi
#
# LDFLAGS="$LDFLAGS $LIB_LUA $LIB_LUA_LIB"
fi
# Allow the changes above to take effect.
AC_SUBST(CFLAGS)
AC_SUBST(CXXFLAGS)
AC_SUBST(LDFLAGS)
# Now the smaller details.
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([src/main.cpp])
AC_CONFIG_HEADER([auto.h])
# Checks for libraries.
AC_CHECK_LIB(pthread,pthread_create)
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([stdlib.h sys/file.h sys/stat.h sys/time.h unistd.h])
AC_CHECK_HEADERS([sstream string vector map])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
# Checks for library functions.
AC_FUNC_MKTIME
AC_FUNC_SELECT_ARGTYPES
AC_CHECK_FUNCS([select])
AC_CHECK_FUNC(uuid_unparse_lower, [AC_DEFINE([HAVE_UUID], [1], [Found uuid_unparse_lower])])
AC_CHECK_FUNC(random, [AC_DEFINE([HAVE_RANDOM], [1], [Found random])])
AC_CHECK_FUNC(srandom, [AC_DEFINE([HAVE_SRANDOM], [1], [Found srandom])])
# Generate the Makefiles.
AC_CONFIG_FILES([Makefile src/Makefile])
AC_OUTPUT
# End.