3 # userv is copyright Ian Jackson and other contributors.
4 # See README for full authorship information.
6 # This is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 AC_CONFIG_HEADER(config.h)
22 AC_PREFIX_DEFAULT(/usr/local)
30 [ --enable-debug build debugging version],
32 if test "x$enable_debug" = xyes; then
33 DEBUGDEFS="-DDEBUG -DVARDIR='\"$crdir/vd\"' -DSYSTEMCONFIGDIR='\"$crdir/slash-etc\"' -DSERVICEUSERDIR='\"$crdir/tilde\"'"
35 echo will build debugging version
36 elif test "x$enable_debug" != xno; then
37 AC_MSG_ERROR(--enable-debug does not allow any arguments except 'yes' and 'no')
44 AC_CHECK_PROGS(MD5SUM_SIMPLE, md5sum md5 gmd5sum)
46 CFLAGS="$CFLAGS -D_GNU_SOURCE"
48 AC_CHECK_LIB(socket,socket)
49 AC_CHECK_FUNCS(setenv strsignal vsnprintf)
51 AC_CACHE_CHECK([for EPROTO],userv_cv_hdr_eproto,[
58 ],userv_cv_hdr_eproto=yes,userv_cv_hdr_eproto=no)])
59 if test $userv_cv_hdr_eproto = yes
61 AC_DEFINE(HAVE_EPROTO)
64 AC_CACHE_CHECK([for LOG_AUTHPRIV],userv_cv_hdr_logauthpriv,[
71 ],userv_cv_hdr_logauthpriv=yes,userv_cv_hdr_logauthpriv=no)])
72 if test $userv_cv_hdr_logauthpriv = yes
74 AC_DEFINE(HAVE_LOG_AUTHPRIV)
77 AC_CACHE_CHECK([for WCOREDUMP],userv_cv_hdr_wcoredump,[
80 #include <sys/types.h>
85 ],userv_cv_hdr_wcoredump=yes,userv_cv_hdr_wcoredump=no)])
86 if test $userv_cv_hdr_wcoredump = yes
88 AC_DEFINE(HAVE_WCOREDUMP)
92 if test "${GCC-no}" = yes; then
98 dnl DPKG_CACHED_TRY_COMPILE(<description>,<cachevar>,<include>,<program>,<ifyes>,<ifno>)
99 define(DPKG_CACHED_TRY_COMPILE,[
102 AC_TRY_COMPILE([$3],[$4],[$2=yes],[$2=no])
104 if test "x$$2" = xyes; then
113 DPKG_CACHED_TRY_COMPILE(your C compiler,dpkg_cv_c_works,
114 [#include <string.h>], [strcmp("a","b")],
115 AC_MSG_RESULT(works),
116 AC_MSG_RESULT(broken)
117 AC_MSG_ERROR(C compiler is broken))
119 DPKG_CACHED_TRY_COMPILE(__attribute__((,,)),dpkg_cv_c_attribute_supported,,
120 [extern int testfunction(int x) __attribute__((,,))],
122 AC_DEFINE(HAVE_GNUC25_ATTRIB)
123 DPKG_CACHED_TRY_COMPILE(__attribute__((noreturn)),dpkg_cv_c_attribute_noreturn,,
124 [extern int testfunction(int x) __attribute__((noreturn))],
126 AC_DEFINE(HAVE_GNUC25_NORETURN),
128 DPKG_CACHED_TRY_COMPILE(__attribute__((unused)),dpkg_cv_c_attribute_unused,,
129 [extern int testfunction(int x) __attribute__((unused))],
131 AC_DEFINE(HAVE_GNUC25_UNUSED),
133 DPKG_CACHED_TRY_COMPILE(__attribute__((format...)),dpkg_cv_attribute_format,,
134 [extern int testfunction(char *y, ...) __attribute__((format(printf,1,2)))],
136 AC_DEFINE(HAVE_GNUC25_PRINTFFORMAT),
143 dnl DPKG_C_GCC_TRY_WARNS(<warnings>,<cachevar>)
144 define(DPKG_C_GCC_TRY_WARNS,[
145 AC_MSG_CHECKING([GCC warning flag(s) $1])
146 if test "${GCC-no}" = yes
149 oldcflags="${CFLAGS-}"
150 CFLAGS="${CFLAGS-} ${CWARNS} $1 -Werror"
155 strcmp("a","b"); fprintf(stdout,"test ok\n");
156 ], [$2=yes], [$2=no])
157 CFLAGS="${oldcflags}"])
158 if test "x$$2" = xyes; then
159 CWARNS="${CWARNS} $1"
166 AC_MSG_RESULT(no, not using GCC)
170 DPKG_C_GCC_TRY_WARNS(-Wall -Wno-implicit, dpkg_cv_c_gcc_warn_all)
171 DPKG_C_GCC_TRY_WARNS(-Wwrite-strings, dpkg_cv_c_gcc_warn_writestrings)
172 DPKG_C_GCC_TRY_WARNS(-Wpointer-arith, dpkg_cv_c_gcc_warn_pointerarith)
173 DPKG_C_GCC_TRY_WARNS(-Wimplicit -Wnested-externs, dpkg_cv_c_gcc_warn_implicit)
175 if test "${GCC-no}" = yes; then
176 CWARNS="${CWARNS} -Wmissing-prototypes -Wstrict-prototypes"
178 [CFLAGS="`echo $CFLAGS $CWARNS | sed -e 's/-O[0-9]*/$(OPTIMISE)/'`"]
181 VERSION="`sed -n '/^userv (.*)/!d; s/^userv (//; s/).*//; p; q' debian/changelog`"
182 echo will build version $VERSION