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
|
AC_DEFUN([GCC_STACK_PROTECT_LIB],[
AC_CACHE_CHECK([whether libssp exists], ssp_cv_lib,
[ssp_old_libs="$LIBS"
LIBS="$LIBS -lssp"
AC_TRY_LINK(,, ssp_cv_lib=yes, ssp_cv_lib=no)
LIBS="$ssp_old_libs"
])
if test $ssp_cv_lib = yes; then
LIBS="$LIBS -lssp"
fi
])
AC_DEFUN([GCC_STACK_PROTECT_CC],[
AC_LANG_ASSERT(C)
if test "X$CC" != "X"; then
AC_CACHE_CHECK([whether ${CC} accepts -fstack-protector-all],
ssp_cv_cc,
[ssp_old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -fstack-protector-all"
AC_TRY_COMPILE(,, ssp_cv_cc=yes, ssp_cv_cc=no)
CFLAGS="$ssp_old_cflags"
])
if test $ssp_cv_cc = yes; then
CFLAGS="$CFLAGS -fstack-protector-all"
AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.])
fi
fi
])
AC_DEFUN([GCC_FORTIFY_SOURCE_CC],[
AC_LANG_ASSERT(C)
if test "X$CC" != "X"; then
AC_MSG_CHECKING(for FORTIFY_SOURCE support)
fs_old_cppflags="$CPPFLAGS"
fs_old_cflags="$CFLAGS"
CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2"
CFLAGS="$CFLAGS -Werror"
AC_TRY_COMPILE([
int main() {
return 0;
}
], [
AC_MSG_RESULT(yes)
CFLAGS="$fs_old_cflags"
], [
AC_MSG_RESULT(no)
CPPFLAGS="$fs_old_cppflags"
CFLAGS="$fs_old_cflags"
])
fi
])
AC_DEFUN([GCC_VISIBILITY_CC],[
AC_LANG_ASSERT(C)
if test "X$CC" != "X"; then
AC_CACHE_CHECK([whether ${CC} accepts -fvisibility=internal],
visibility_cv_cc,
[visibility_old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -fvisibility=internal"
AC_TRY_COMPILE(,, visibility_cv_cc=yes, visibility_cv_cc=no)
CFLAGS="$visibility_old_cflags"
])
if test $visibility_cv_cc = yes; then
AC_DEFINE([ENABLE_VISIBILITY_CC], 1, [Define if symbol visibility C support is enabled.])
fi
AM_CONDITIONAL([ENABLE_VISIBILITY_CC], test "x$visibility_cv_cc" = "xyes")
fi
])
AC_DEFUN([GCC_GNU89_INLINE_CC],[
AC_LANG_ASSERT(C)
if test "X$CC" != "X"; then
AC_CACHE_CHECK([for -fgnu89-inline],
gnu89_inline_cv_cc,
[ gnu89_inline_old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -fgnu89-inline"
AC_TRY_COMPILE(,, gnu89_inline_cv_cc=yes, gnu89_inline_cv_cc=no)
CFLAGS="$gnu89_inline_old_cflags"
])
if test $gnu89_inline_cv_cc = yes; then
AC_DEFINE([ENABLE_GNU89_INLINE_CC], 1, [Define if gnu89 inlining semantics should be used.])
fi
AM_CONDITIONAL([ENABLE_GNU89_INLINE_CC], test "x$gnu89_inline_cv_cc" = "xyes")
fi
])
AC_DEFUN([CFLAGS_ADD],
[AS_VAR_PUSHDEF([my_cflags], [cflags_cv_warn_$1])
AC_CACHE_CHECK([whether compiler handles $1], [my_cflags], [
save_CFLAGS="$CFLAGS"
CFLAGS="${CFLAGS} -Werror=unknown-warning-option"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[],
[CFLAGS="$save_CFLAGS"])
CFLAGS="${CFLAGS} $1"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[AS_VAR_SET([my_cflags], [yes])],
[AS_VAR_SET([my_cflags], [no])])
CFLAGS="$save_CFLAGS"
])
AS_VAR_PUSHDEF([new_cflags], [[$2]])
AS_VAR_IF([my_cflags], [yes], [AS_VAR_APPEND([new_cflags], [" $1"])])
AS_VAR_POPDEF([new_cflags])
AS_VAR_POPDEF([my_cflags])
m4_ifval([$2], [AS_LITERAL_IF([$2], [AC_SUBST([$2])], [])])
])
AC_DEFUN([FS_STATS_TYPE],
[AC_CACHE_CHECK([filesystem statistics type], fs_stats_cv_type,
[AC_CHECK_FUNC(getmntinfo,
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
extern int getmntinfo (struct statfs **, int);
]],
[])],
[fs_stats_cv_type="struct statfs"],
[fs_stats_cv_type="struct statvfs"])],
[AC_CHECK_FUNC(getmntent,
[fs_stats_cv_type="struct statvfs"])]
)]
)
AC_DEFINE_UNQUOTED(FSSTATSTYPE, [$fs_stats_cv_type],
[Defined as the filesystem stats type ('statvfs' or 'statfs')])
if test $ac_cv_func_getmntinfo = yes; then
if test "$fs_stats_cv_type" = "struct statvfs"; then
AC_DEFINE([HAVE_GETMNTINFO_STATVFS], 1, [Define if getmntinfo() uses statvfs.])
else
AC_DEFINE([HAVE_GETMNTINFO_STATFS], 1, [Define if getmntinfo() uses statfs.])
fi
fi
])
AC_DEFUN([PATH_MAX_DEFINED],
[AC_CACHE_CHECK([PATH_MAX defined], path_max_cv_defined,
[AC_EGREP_CPP(yes, [[
yes
]],
[path_max_cv_defined=yes],
[path_max_cv_defined=no])]
)
if test $path_max_cv_defined = no; then
AC_DEFINE([PATH_MAX], 4096, [Define if PATH_MAX is undefined by limits.h.])
fi
])
|