-
Notifications
You must be signed in to change notification settings - Fork 12
/
configure.in
executable file
·171 lines (150 loc) · 4.92 KB
/
configure.in
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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
#
# Change the version number below after doing a public release.
# The version in git should reflect the *next* version planned.
# Version must be MAJOR.MINOR.PATCH otherwise things will break.
#
AC_INIT([satan],[0.2.0],[[email protected]])
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_MACRO_DIR(config)
AM_CONFIG_HEADER(src/platform.h)
AM_INIT_AUTOMAKE(tar-ustar)
# Checks for programs.
AC_PROG_CC
AC_PROG_CC_C99
AM_PROG_CC_C_O
AC_PROG_LIBTOOL
CFLAGS="${CFLAGS}"
# debug
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug], [enables debug output [default=yes]])],
[],
[enable_debug=yes])
AM_CONDITIONAL(DEBUG_ENABLED, test "x$enable_debug" = "xyes")
# libuci
AC_ARG_ENABLE([uci],
[AS_HELP_STRING([--enable-uci], [enables UCI configuration [default=no]])],
[],
[enable_uci=no])
AM_CONDITIONAL(UCI_ENABLED, test "x$enable_uci" = "xyes")
if test "x$enable_uci" = "xyes"; then
AC_DEFINE(SATAN_HAVE_UCI, 1, [Have UCI configuration support])
fi
# libczmq
AC_ARG_WITH([libczmq],
[AS_HELP_STRING([--with-libczmq],
[Specify libczmq prefix])],
[lsd_search_libczmq="yes"],
[])
if test "x$lsd_search_libczmq" = "xyes"; then
if test -r "${with_libczmq}/include/czmq.h"; then
CFLAGS="-I${with_libczmq}/include ${CFLAGS}"
LDFLAGS="-L${with_libczmq}/lib ${LDFLAGS}"
else
AC_MSG_ERROR([${with_libczmq}/include/czmq.h not found. Please check libczmq prefix])
fi
fi
# Host speciffic checks
AC_CANONICAL_HOST
# Determine whether or not documentation should be built and installed.
# Set some default features required by libzre code.
CFLAGS="-D_REENTRANT -D_THREAD_SAFE $CFLAGS"
# OS-specific tests
case "${host_os}" in
*linux*)
# Define on Linux to enable all library features
CFLAGS="-D_GNU_SOURCE -DLINUX $CFLAGS"
AC_DEFINE(SATAN_HAVE_LINUX, 1, [Have Linux OS])
;;
*solaris*)
# Define on Solaris to enable all library features
CFLAGS="-D_PTHREADS $CFLAGS"
AC_DEFINE(SATAN_HAVE_SOLARIS, 1, [Have Solaris OS])
;;
*freebsd*)
# Define on FreeBSD to enable all library features
CFLAGS="-D__BSD_VISIBLE $CFLAGS"
AC_DEFINE(SATAN_HAVE_FREEBSD, 1, [Have FreeBSD OS])
;;
*darwin*)
# Define on Darwin to enable all library features
CFLAGS="-D_DARWIN_C_SOURCE $CFLAGS"
AC_DEFINE(SATAN_HAVE_OSX, 1, [Have DarwinOSX OS])
;;
*netbsd*)
# Define on NetBSD to enable all library features
CFLAGS="-D_NETBSD_SOURCE $CFLAGS"
AC_DEFINE(SATAN_HAVE_NETBSD, 1, [Have NetBSD OS])
;;
*openbsd*)
# Define on OpenBSD to enable all library features
CFLAGS="-D_BSD_SOURCE $CFLAGS"
AC_DEFINE(SATAN_HAVE_OPENBSD, 1, [Have OpenBSD OS])
;;
*nto-qnx*)
AC_DEFINE(SATAN_HAVE_QNXNTO, 1, [Have QNX Neutrino OS])
;;
*aix*)
AC_DEFINE(SATAN_HAVE_AIX, 1, [Have AIX OS])
;;
*hpux*)
# Define on HP-UX to enable all library features
CFLAGS="-D_POSIX_C_SOURCE=200112L"
AC_DEFINE(SATAN_HAVE_HPUX, 1, [Have HPUX OS])
;;
*mingw32*)
AC_DEFINE(SATAN_HAVE_WINDOWS, 1, [Have Windows OS])
AC_DEFINE(SATAN_HAVE_MINGW32, 1, [Have MinGW32])
AC_CHECK_HEADERS(windows.h)
lsd_on_mingw32="yes"
lsd_install_man="no"
;;
*cygwin*)
# Define on Cygwin to enable all library features
CFLAGS="-D_GNU_SOURCE $CFLAGS"
AC_DEFINE(SATAN_HAVE_CYGWIN, 1, [Have Cygwin])
;;
*)
AC_MSG_ERROR([unsupported system: ${host_os}.])
;;
esac
AM_CONDITIONAL(HOST_ANDROID, test "x$liblsd_host_android" = "xyes")
AM_CONDITIONAL(ENABLE_PYTHON, test "x$enable_python" = "xyes")
if test "x$enable_python" = "xyes"; then
SWIG_PYTHON
AM_PATH_PYTHON
CPPFLAGS="-I../include -I/usr/include/python$PYTHON_VERSION $CPPFLAGS"
fi
# Other libraries
if test "x$enable_uci" = "xyes"; then
AC_CHECK_LIB(uci,uci_alloc_context, [
LIBS="-luci $LIBS"
],
[AC_MSG_ERROR([cannot link with -luci, install libuci.])]
)
fi
AC_CHECK_LIB(czmq, zctx_new, [LIBS="-lczmq $LIBS"],
[AC_MSG_ERROR([cannot link with -lczmq, install libcczmq.])]
)
# Checks for header files.
AC_HEADER_STDC
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_HEADER_TIME
AC_TYPE_UINT32_T
AC_C_VOLATILE
# These options are GNU compiler specific.
if test "x$GCC" = "xyes"; then
CFLAGS="-fPIC ${CFLAGS}"
LDFLAGS="-fPIC ${LDFLAGS}"
fi
AC_SUBST(CFLAGS)
AC_SUBST(LDFLAGS)
# Checks for library functions.
AC_TYPE_SIGNAL
AC_OUTPUT(Makefile src/Makefile)