forked from HenryMiller1/icecream
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
324 lines (287 loc) · 9.92 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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# quite some macros are taken from distcc
AC_PREREQ([2.63])
# ====================
# Version informations
# ====================
m4_define([icecream_version_major],[1])
m4_define([icecream_version_minor],[1])
#m4_define([icecream_version_micro],[98])
m4_ifval([icecream_version_micro],
m4_define([icecream_version],[icecream_version_major.icecream_version_minor.icecream_version_micro]),
m4_define([icecream_version],[icecream_version_major.icecream_version_minor]))
# =============
# Automake init
# =============
AC_INIT([icecc], [icecream_version])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([1.11 foreign dist-bzip2])
AM_SILENT_RULES([yes])
AC_LANG([C++])
# ===========================
# Find required base packages
# ===========================
AC_PROG_CC
AC_PROG_CXX
if test "$GCC" = yes; then
cast_align=-Wcast-align
wshadow=
AC_MSG_CHECKING([if GCC is actually Clang])
AC_TRY_COMPILE(
[],
[
#ifdef __clang__
return 0;
#else
fail
#endif
],
[
AC_MSG_RESULT(yes)
# The code has numerous cast alignment warnings that only clang warns about,
# and it probably(?) doesn't matter in practice.
cast_align=
# Clang is not so overzealous like GCC and doesn't warn about cases which
# are very unlikely to be problems (e.g. function argument shadowing
# a function elsewhere), so it's not so annoying.
wshadow=-Wshadow
],
[ AC_MSG_RESULT(no) ])
CFLAGS="-g -W -Wall \
-Wshadow -Wpointer-arith $cast_align -Wwrite-strings \
-Waggregate-return -Wstrict-prototypes -Wmissing-prototypes \
-Wnested-externs $CFLAGS"
CXXFLAGS=" -g -W -Wall -Wpointer-arith $cast_align $wshadow -Wwrite-strings $CXXFLAGS"
AC_MSG_NOTICE([Adding gcc options: $CFLAGS])
fi
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_C_INLINE
AC_DISABLE_SHARED
AC_ENABLE_STATIC
AC_PROG_LIBTOOL
ICECC_LIBCAP_NG_PATH
# =============
# Documentation
# =============
AC_ARG_WITH(man,
[AS_HELP_STRING([--without-man], [Do not build manpage])],
[with_man="$withval"],
[with_man=yes]
)
AS_IF([test "x$with_man" != "xno"], [
build_man=yes
AC_PATH_PROGS(DOCBOOK2X,
[docbook2x-man db2x_docbook2man docbook-to-man docbook2man.pl docbook2man])
AS_IF([test -z "$DOCBOOK2X"], [
AC_MSG_WARN([docbook2x is missing. Install docbook2x package.])
DOCBOOK2X='echo docbook2x is missing. Install docbook2x package.'])
], [build_man=no])
AC_SUBST(DOCBOOK2X)
AM_CONDITIONAL([WITH_ICECREAM_MAN], [test "x$build_man" != "xno"])
########################################################################
### Checks for header files
# Some of these are needed by popt (or other libraries included in the future).
AC_CHECK_HEADERS([sys/signal.h ifaddrs.h kinfo.h sys/param.h devstat.h])
AC_CHECK_HEADERS([sys/socketvar.h sys/vfs.h])
AC_CHECK_HEADERS([mach/host_info.h])
AC_CHECK_HEADERS([arpa/nameser.h], [], [],
[#include <sys/types.h>
])
AC_CHECK_HEADERS([resolv.h], [], [],
[#include <sys/types.h>
#include <netinet/in.h>
#if HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h>
#endif
])
AC_ARG_VAR(TAR, [Specifies tar path])
AC_PATH_PROG(TAR, [tar])
AC_DEFINE_UNQUOTED([TAR], ["$TAR"], [Define path to tar])
AC_CHECK_HEADERS([netinet/tcp_var.h], [], [],
[#include <sys/types.h>
#if HAVE_SYS_SOCKETVAR_H
# include <sys/socketvar.h>
#endif
#include <netinet/in.h>
#include <netinet/tcp.h>
])
AC_CHECK_HEADERS([sys/user.h])
######################################################################
dnl Checks for types
AC_CHECK_TYPES([sa_family_t, socklen_t, in_port_t, in_addr_t], , ,
[
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#if HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h>
#endif
])
AC_CHECK_MEMBER([struct ifreq.ifr_dstaddr],
[AC_DEFINE(HAVE_IFR_DSTADDR, 1, [Set to 1 if struct ifr_ifru has member ifr_dstaddr] )],
[AC_DEFINE(HAVE_IFR_DSTADDR, 0, [Set to 0 if struct ifr_ifru has no ifr_dstaddr] )],
[
#include <net/if.h>
])
########################################################################
### Checks for libraries.
# The following test taken from the cvs sources via Samba:
# If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
# The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
# libsocket.so which has a bad implementation of gethostbyname (it
# only looks in /etc/hosts), so we only look for -lsocket if we need
# it.
AC_CHECK_FUNCS(connect)
if test x"$ac_cv_func_connect" = x"no"; then
case "$LIBS" in
*-lnsl*) ;;
*) AC_CHECK_LIB(nsl_s, printf) ;;
esac
case "$LIBS" in
*-lnsl*) ;;
*) AC_CHECK_LIB(nsl, printf) ;;
esac
case "$LIBS" in
*-lsocket*) ;;
*) AC_CHECK_LIB(socket, connect) ;;
esac
case "$LIBS" in
*-linet*) ;;
*) AC_CHECK_LIB(inet, connect) ;;
esac
dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
dnl has been cached.
if test x"$ac_cv_lib_socket_connect" = x"yes" ||
test x"$ac_cv_lib_inet_connect" = x"yes"; then
# ac_cv_func_connect=yes
# don't! it would cause AC_CHECK_FUNC to succeed next time configure is run
AC_DEFINE(HAVE_CONNECT,1,[Whether the system has connect()])
fi
fi
AC_CHECK_FUNCS([flock lockf])
AC_CHECK_FUNCS([strsignal])
AC_CHECK_FUNCS([getloadavg])
AC_CHECK_LIB(lzo2, lzo1x_1_compress, LZO_LDADD=-llzo2,
AC_MSG_ERROR([Could not find lzo2 library - please install lzo-devel]))
AC_SUBST(LZO_LDADD)
AC_CHECK_LIB([dl], [dlsym], [DL_LDADD=-ldl])
AC_SUBST([DL_LDADD])
# In DragonFlyBSD daemon needs to be linked against libkinfo.
case $host_os in
dragonfly*) LIB_KINFO="-lkinfo" ;;
*) LIB_KINFO="" ;;
esac
AC_SUBST(LIB_KINFO)
AC_ARG_ENABLE(clang-rewrite-includes,
AS_HELP_STRING([--enable-clang-rewrite-includes],
[Use by default Clang's -frewrite-includes option.]))
if test "$enable_clang_rewrite_includes" = "yes"; then
AC_DEFINE(HAVE_CLANG_REWRITE_INCLUDES, 1, [Define to 1 if clang supports -frewrite-includes])
elif test "$enable_clang_rewrite_includes" = "no"; then
true # do not enable
else
AC_CHECK_PROG(CLANG,clang,clang)
if test -n "$CLANG"; then
AC_MSG_CHECKING([whether clang -Werror works for unknown options])
$CLANG -Werror -totallybogusoption -E - >/dev/null 2>/dev/null
if test $? -eq 0; then
AC_MSG_RESULT(no)
# can't detect if the option is supported, but that's too old clang anyway
else
AC_MSG_RESULT(yes)
AC_MSG_CHECKING([for clang -E -frewrite-includes])
$CLANG -Werror -E -frewrite-includes - >/dev/null 2>/dev/null
if test $? -eq 0; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_CLANG_REWRITE_INCLUDES, 1, [Define to 1 if clang supports -frewrite-includes])
else
AC_MSG_RESULT(no)
fi
fi
fi
fi
HAVE_CLANG_DEVEL_DEP=
AC_CHECK_PROG(CLANG,clang,clang)
AC_LANG_PUSH([C++])
save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
[ HAVE_CLANG_DEVEL_DEP=clangplugin ] )
CPPFLAGS="$save_CPPFLAGS"
AC_LANG_POP([C++])
AC_SUBST(HAVE_CLANG_DEVEL_DEP)
AC_ARG_ENABLE(clang-wrappers,
AS_HELP_STRING([--enable-clang-wrappers],
[Use symlink wrappers for clang/clang++.]))
CLANG_SYMLINK_WRAPPERS=
if test "$enable_clang_wrappers" = "yes"; then
CLANG_SYMLINK_WRAPPERS='clang clang++'
elif test "$enable_clang_wrappers" = "no"; then
true # do not enable
else
AC_CHECK_PROG(CLANG,clang,clang)
if test -n "$CLANG"; then
CLANG_SYMLINK_WRAPPERS='clang clang++'
fi
fi
AC_SUBST(CLANG_SYMLINK_WRAPPERS)
AC_ARG_ENABLE(gcc-color-diagnostics,
AS_HELP_STRING([--enable-gcc-color-diagnostics],
[Assume by default GCC has -fdiagnostics-color=auto option.]))
if test "$enable_gcc_color_diagnostics" = "yes"; then
AC_DEFINE(HAVE_GCC_COLOR_DIAGNOSTICS, 1, [Define to 1 if gcc supports -fdiagnostics-color=auto])
else
true # do not enable
fi
AC_ARG_ENABLE(gcc-show-caret,
AS_HELP_STRING([--enable-gcc-show-caret],
[Assume by default GCC has -fdiagnostics-show-caret option.]))
if test "$enable_gcc_show_caret" = "yes"; then
AC_DEFINE(HAVE_GCC_SHOW_CARET, 1, [Define to 1 if gcc supports -fdiagnostics-show-caret])
elif test "$enable_gcc_show_caret" = "no"; then
true # do not enable
else
AC_CHECK_PROG(GCC_BIN,gcc,gcc)
if test -n "$GCC_BIN"; then
AC_MSG_CHECKING([for gcc -fdiagnostics-show-caret])
$GCC_BIN -Werror -E -fdiagnostics-show-caret - >/dev/null 2>/dev/null
if test $? -eq 0; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GCC_SHOW_CARET, 1, [Define to 1 if gcc supports -fdiagnostics-show-caret])
else
AC_MSG_RESULT(no)
fi
fi
fi
AC_CONFIG_FILES([ Makefile ])
AC_CONFIG_FILES([ client/Makefile ])
AC_CONFIG_FILES([ daemon/Makefile ])
AC_CONFIG_FILES([ doc/Makefile ])
AC_CONFIG_FILES([ services/Makefile ])
AC_CONFIG_FILES([ services/icecc.pc ])
AC_CONFIG_FILES([ suse/Makefile ])
AC_CONFIG_FILES([ compilerwrapper/Makefile ])
AC_CONFIG_FILES([ scheduler/Makefile ])
AC_CONFIG_FILES([ tests/Makefile ])
AC_CONFIG_FILES([ client/icecc-create-env ])
AC_OUTPUT([ suse/icecream.spec ])
if test "$prefix" = NONE; then
prefix=$ac_default_prefix
fi
AC_DEFUN([KDE_EXPAND_MAKEVAR], [
savex=$exec_prefix
test "x$exec_prefix" = xNONE && exec_prefix=$prefix
tmp=$$2
while $1=`eval echo "$tmp"`; test "x$$1" != "x$tmp"; do tmp=$$1; done
exec_prefix=$savex
])
KDE_EXPAND_MAKEVAR(mybindir, bindir)
AC_DEFINE_UNQUOTED(BINDIR, "$mybindir", [Where to look for icecc])
myorundir='${localstatedir}/run'
KDE_EXPAND_MAKEVAR(myrundir, myorundir)
AC_DEFINE_UNQUOTED(RUNDIR, "$myrundir", [Where to place pid files])
KDE_EXPAND_MAKEVAR(mylibexecdir, libexecdir)
PKGLIBEXECDIR="$mylibexecdir/$PACKAGE"
AC_SUBST(PKGLIBEXECDIR)
AC_OUTPUT