57
62
AC_CHECK_FUNCS([setresuid])
58
63
AC_CHECK_FUNCS([gettimeofday])
61
AC_CHECK_LIB([rt], [clock_gettime], [
64
AC_DEFINE([HAVE_LIBRT], [1], [Have clock_gettime])
66
AC_MSG_ERROR([Your system lacks clock_gettime])
69
# Debug and hardening flags all in one shot
70
# Alwas do this at the end, otherwise you end up filtering system/other libraries
65
AC_MSG_CHECKING([user/group to drop privs to])
67
AC_ARG_WITH([unpriv-user],
68
[AS_HELP_STRING([--with-unpriv-user=<user>],
69
[User to drop privs to @<:@default: nobody@:>@])])
70
AS_CASE([$with_unpriv_user],
71
[""|yes|no], [UNPRIV_USER="nobody"],
72
[*], [UNPRIV_USER=$with_unpriv_user])
73
AC_DEFINE_UNQUOTED([UNPRIV_USER], ["${UNPRIV_USER}"], [Unprivileged user])
75
AC_ARG_WITH([unpriv-group],
76
[AS_HELP_STRING([--with-unpriv-group=<group>],
77
[Group to drop privs to @<:@default: nogroup@:>@])])
78
AS_CASE([$with_unpriv_group],
79
[""|yes|no], [UNPRIV_GROUP="nogroup"],
80
[*], [UNPRIV_GROUP=$with_unpriv_group])
81
AC_DEFINE_UNQUOTED([UNPRIV_GROUP], ["${UNPRIV_GROUP}"], [Unprivileged group])
83
AC_MSG_RESULT(${UNPRIV_USER}:${UNPRIV_GROUP})
85
dnl Check for clock_gettime. Some systems put it into -lc, while
86
dnl others use -lrt. Try the first and fallback to the latter.
88
AC_CHECK_FUNC([clock_gettime], [:],
89
[AC_CHECK_LIB([rt], [clock_gettime], [RT_LIB="-lrt"],
90
[AC_MSG_ERROR([Your system lacks clock_gettime])])])
94
[AS_HELP_STRING([--disable-dbus],
95
[Disable automatically dbus support])])
96
AS_IF([test "x$enable_dbus" = xyes], [
97
PKG_CHECK_MODULES([DBUS], [dbus-1], [
98
AC_DEFINE([HAVE_DBUS], [1], [Enable dbus support])
99
AC_MSG_CHECKING([user/group to use for dbus])
100
AC_ARG_WITH([dbus-user],
101
[AS_HELP_STRING([--with-dbus-user=<user>],
102
[User to send dbus signals from @<:@default: nobody@:>@])])
103
AS_CASE([$with_dbus_user],
104
[""|yes|no], [DBUS_USER="nobody"],
105
[*], [DBUS_USER=$with_dbus_user])
106
AC_ARG_WITH([dbus-group],
107
[AS_HELP_STRING([--with-dbus-group=<group>],
108
[Group to send dbus signals from @<:@default: nogroup@:>@])])
109
AS_CASE([$with_dbus_group],
110
[""|yes|no], [DBUS_GROUP="nogroup"],
111
[*], [DBUS_GROUP=$with_dbus_group])
112
AC_MSG_RESULT(${DBUS_USER}:${DBUS_GROUP})
113
AC_DEFINE_UNQUOTED([DBUS_USER], ["${DBUS_USER}"], [DBus user])
114
AC_DEFINE_UNQUOTED([DBUS_GROUP], ["${DBUS_GROUP}"], [DBus group])
116
AS_IF([test "x$enable_dbus" = xyes],
117
[AC_MSG_ERROR([dbus requested but not found])])
121
AC_SUBST(DBUS_CFLAGS)
124
dnl Debug and hardening flags all in one shot
125
dnl Always do this at the end, otherwise you end up filtering system/other libraries
126
AC_ARG_ENABLE([hardened-checks],
127
[AS_HELP_STRING([--disable-hardened-checks],
128
[Disable automatically enabling hardened toolchain options])])
71
129
AC_DEFUN([LOCAL_CHECK_FLAGS],[
72
130
AC_REQUIRE([AX_CHECK_LINK_FLAG])
73
131
AC_REQUIRE([AX_APPEND_COMPILE_FLAGS])
77
AX_APPEND_COMPILE_FLAGS([-g -O1 -Wall])
78
AX_APPEND_COMPILE_FLAGS([-fno-strict-aliasing])
79
AX_APPEND_COMPILE_FLAGS([-D_FORTIFY_SOURCE=2 -fstack-protector-all])
80
AX_APPEND_COMPILE_FLAGS([-fwrapv -fPIE -Wstack-protector])
81
AX_APPEND_COMPILE_FLAGS([--param=ssp-buffer-size=1])
82
AX_CHECK_LINK_FLAG([-z relro -z now])
83
AX_CHECK_LINK_FLAG([-pie])
133
AS_IF([test "x$enable_hardened_checks" != xno], [
136
AX_APPEND_COMPILE_FLAGS([-g -O1])
138
AC_MSG_WARN([using hardened flags is HIGHLY RECOMMENDED and disabling them is a BAD IDEA])
140
AX_APPEND_COMPILE_FLAGS([-Wall -fno-strict-aliasing])
141
AS_IF([test "x$enable_hardened_checks" != xno], [
142
AX_APPEND_COMPILE_FLAGS([-D_FORTIFY_SOURCE=2 -fstack-protector-all])
143
AX_APPEND_COMPILE_FLAGS([-fwrapv -fPIE -Wstack-protector])
144
AX_APPEND_COMPILE_FLAGS([--param=ssp-buffer-size=1])
145
AX_CHECK_LINK_FLAG([-z relro -z now])
146
AX_CHECK_LINK_FLAG([-pie])
152
AC_ARG_ENABLE([code-coverage-checks],
153
[AS_HELP_STRING([--enable-code-coverage-checks],
154
[Enable gcov/lcov compile time options])],
155
[AX_APPEND_COMPILE_FLAGS([-ftest-coverage -fprofile-arcs])])
88
157
AC_CONFIG_FILES([Makefile])