-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
acinclude.m4
91 lines (85 loc) · 2.4 KB
/
acinclude.m4
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
AC_DEFUN([AC_PROG_CC_PIE], [
AC_CACHE_CHECK([whether ${CC-cc} accepts -fPIE], ac_cv_prog_cc_pie, [
echo 'void f(){}' > conftest.c
if test -z "`${CC-cc} -fPIE -pie -c conftest.c 2>&1`"; then
ac_cv_prog_cc_pie=yes
else
ac_cv_prog_cc_pie=no
fi
rm -rf conftest*
])
])
AC_DEFUN([AC_PROG_CC_ASAN], [
AC_CACHE_CHECK([whether ${CC-cc} accepts -fsanitize=address], ac_cv_prog_cc_asan, [
echo 'void f(){}' > conftest.c
if test -z "`${CC-cc} -fsanitize=address -c conftest.c 2>&1`"; then
ac_cv_prog_cc_asan=yes
else
ac_cv_prog_cc_asan=no
fi
rm -rf conftest*
])
])
AC_DEFUN([AC_PROG_CC_LSAN], [
AC_CACHE_CHECK([whether ${CC-cc} accepts -fsanitize=leak], ac_cv_prog_cc_lsan, [
echo 'void f(){}' > conftest.c
if test -z "`${CC-cc} -fsanitize=leak -c conftest.c 2>&1`"; then
ac_cv_prog_cc_lsan=yes
else
ac_cv_prog_cc_lsan=no
fi
rm -rf conftest*
])
])
AC_DEFUN([AC_PROG_CC_UBSAN], [
AC_CACHE_CHECK([whether ${CC-cc} accepts -fsanitize=undefined], ac_cv_prog_cc_ubsan, [
echo 'void f(){}' > conftest.c
if test -z "`${CC-cc} -fsanitize=undefined -c conftest.c 2>&1`"; then
ac_cv_prog_cc_ubsan=yes
else
ac_cv_prog_cc_ubsan=no
fi
rm -rf conftest*
])
])
AC_DEFUN([AC_PROG_CC_GCOV], [
AC_CACHE_CHECK([whether ${CC-cc} accepts -fprofile-arcs], ac_cv_prog_cc_profile_arcs, [
echo 'void f(){}' > conftest.c
if test -z "`${CC-cc} -fprofile-arcs -c conftest.c 2>&1`"; then
ac_cv_prog_cc_profile_arcs=yes
else
ac_cv_prog_cc_profile_arcs=no
fi
rm -rf conftest*
])
AC_CACHE_CHECK([whether ${CC-cc} accepts -ftest_coverage], ac_cv_prog_cc_test_coverage, [
echo 'void f(){}' > conftest.c
if test -z "`${CC-cc} -ftest-coverage -c conftest.c 2>&1`"; then
ac_cv_prog_cc_test_coverage=yes
else
ac_cv_prog_cc_test_coverage=no
fi
rm -rf conftest*
])
])
AC_DEFUN([COMPILER_FLAGS], [
if (test "${CFLAGS}" = ""); then
CFLAGS="-Wall -fsigned-char -fno-exceptions"
fi
if (test "$USE_MAINTAINER_MODE" = "yes"); then
CFLAGS+=" -Werror -Wextra"
CFLAGS+=" -Wno-unused-parameter"
CFLAGS+=" -Wno-missing-field-initializers"
CFLAGS+=" -Wdeclaration-after-statement"
CFLAGS+=" -Wmissing-declarations"
CFLAGS+=" -Wredundant-decls"
CFLAGS+=" -Wformat -Wformat-security"
if ( $CC -v 2>/dev/null | grep "gcc version" ); then
CFLAGS+=" -Wcast-align"
fi
fi
if (test "$CC" = "clang"); then
CFLAGS+=" -Wno-unknown-warning-option"
CFLAGS+=" -Wno-unknown-pragmas"
fi
])