Source
30
30
31
31
dnl *****************************************************************
32
32
dnl * *
33
33
dnl * Checks for programs *
34
34
dnl * *
35
35
dnl *****************************************************************
36
36
37
37
AC_PROG_CC([cc c99 gcc clang])
38
38
AM_PROG_CC_C_O
39
39
40
+
dnl A C99 compliant compiler must support this.
41
+
dnl
42
+
dnl The implementations differ across compilers and platforms.
43
+
dnl GCC allocates the storage blocks in bss during compilation,
44
+
dnl while others elect for the runtime loader to handle the allocation.
45
+
dnl
46
+
dnl This means the proper test would be to run the executable,
47
+
dnl but that would make no sense when cross-compiling,
48
+
dnl so the best we can do is just reject compilers that don't even
49
+
dnl recognize the keyword.
50
+
AC_MSG_CHECKING(whether compiler supports thread-local storage)
51
+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
52
+
#include <stdio.h>
53
+
]], [[
54
+
static __thread int a = 0;
55
+
(void)a;
56
+
]])],
57
+
[
58
+
AC_MSG_RESULT(yes)
59
+
], [
60
+
AC_MSG_RESULT(no)
61
+
AC_MSG_ERROR([compiler does not recognize the __thread keyword])
62
+
]
63
+
)
64
+
40
65
dnl *****************************************************************
41
66
dnl * *
42
67
dnl * Checks for header files *
43
68
dnl * *
44
69
dnl *****************************************************************
45
70
46
71
AC_PROG_EGREP
47
72
48
73
AC_CHECK_HEADERS(stdio.h stdlib.h string.h unistd.h netdb.h signal.h malloc.h \
49
74
syslog.h time.h errno.h sys/types.h sys/stat.h netinet/in.h \
621
646
AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
622
647
623
648
AC_MSG_CHECKING(for linker options --start-group/--end-group)
624
649
saved_LDFLAGS="$LDFLAGS"
625
650
LDFLAGS="-Wl,--start-group -Wl,--end-group"
626
651
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[HAVE_START_GROUP="yes"
627
652
AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)
628
653
])
629
654
LDFLAGS="$saved_LDFLAGS"
630
655
631
-
AC_MSG_CHECKING(for '__thread' compiler support)
632
-
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[static __thread int a = 0;]])],[AC_DEFINE(HAVE_THREAD_LOCAL,1,Define to 1 if compiler keyword '__thread' supported.)
633
-
AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)
634
-
HAVE_THREAD_LOCAL="no"])
635
-
636
656
AC_MSG_CHECKING(for field updates in struct vminfo_t)
637
657
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
638
658
#include <sys/sysinfo.h>
639
659
]], [[
640
660
vminfo_t vminfo;
641
661
vminfo.updates;
642
662
]])],[AC_DEFINE(HAVE_VMINFO_T_UPDATES,1,Define to 1 if 'vminfo.updates' exists.)
643
663
AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
644
664
645
665
dnl *****************************************************************
1207
1227
esac],
1208
1228
[agent=no])
1209
1229
AM_CONDITIONAL(AGENT, test "x$agent" = "xyes")
1210
1230
1211
1231
AC_ARG_ENABLE(agent2,[ --enable-agent2 Turn on build of Zabbix agent 2],
1212
1232
[case "${enableval}" in
1213
1233
yes) agent2=yes ;;
1214
1234
no) agent2=no ;;
1215
1235
*) AC_MSG_ERROR([bad value ${enableval} for --enable-agent2]) ;;
1216
1236
esac
1217
-
test "x$agent2" = "xyes" -a "x$HAVE_THREAD_LOCAL" = "xno" && AC_MSG_ERROR([C compiler is not compatible with agent2 assembly])
1218
1237
],
1219
1238
[agent2=no])
1220
1239
AM_CONDITIONAL(AGENT2, test "x$agent2" = "xyes")
1221
1240
1222
1241
AC_ARG_ENABLE(webservice,[ --enable-webservice Turn on build of Zabbix web service],
1223
1242
[case "${enableval}" in
1224
1243
yes) webservice=yes ;;
1225
1244
no) webservice=no ;;
1226
1245
*) AC_MSG_ERROR([bad value ${enableval} for --enable-webservice]) ;;
1227
1246
esac
1228
-
test "x$webservice" = "xyes" -a "x$HAVE_THREAD_LOCAL" = "xno" && AC_MSG_ERROR([C compiler is not compatible with webservice assembly])
1229
1247
],
1230
1248
[webservice=no])
1231
1249
AM_CONDITIONAL(WEBSERVICE, test "x$webservice" = "xyes")
1232
1250
1233
1251
AC_ARG_ENABLE(java,[ --enable-java Turn on build of Zabbix Java gateway],
1234
1252
[case "${enableval}" in
1235
1253
yes) java=yes ;;
1236
1254
no) java=no ;;
1237
1255
*) AC_MSG_ERROR([bad value ${enableval} for --enable-java]) ;;
1238
1256
esac],