1 # Copyright (C) 2012-2020 all contributors <cmogstored-public@yhbt.net>
2 # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
4 m4_esyscmd([build-aux/git-version-gen .tarball-version]),
5 [cmogstored-public@yhbt.net])
6 AC_CONFIG_SRCDIR([cmogstored.c])
7 AC_CONFIG_AUX_DIR([build-aux])
8 AM_INIT_AUTOMAKE([foreign silent-rules parallel-tests subdir-objects])
12 AC_CONFIG_HEADER(config.h)
13 AC_CONFIG_MACRO_DIR([m4])
15 dnl we use C99 struct initializers
21 gl_WARN_ADD([-Wcast-qual])
22 gl_WARN_ADD([-Wstrict-prototypes])
23 gl_WARN_ADD([-Wredundant-decls])
24 gl_WARN_ADD([-Wshadow])
25 gl_WARN_ADD([-Werror=write-strings])
26 gl_WARN_ADD([-Werror=aggregate-return])
27 gl_WARN_ADD([-Werror=char-subscripts])
28 gl_WARN_ADD([-Werror=pointer-arith])
29 gl_WARN_ADD([-Werror-implicit-function-declaration])
30 gl_WARN_ADD([-Werror=declaration-after-statement]) dnl I hate C99 for this :P
31 gl_WARN_ADD([-ggdb3],[CFLAGS])
33 gl_UNISTD_MODULE_INDICATOR([environ])
37 AC_C_FLEXIBLE_ARRAY_MEMBER
39 dnl gnulib *at functions aren't thread-safe, ask for the real thing
40 AC_CHECK_FUNCS([openat renameat mkdirat fstatat unlinkat])
42 AC_CHECK_FUNCS([epoll_wait epoll_pwait ppoll])
43 AC_CHECK_FUNCS([epoll_ctl], [HAVE_EPOLL=1], [HAVE_EPOLL=0])
45 AM_CONDITIONAL(HAVE_EPOLL, test "x$HAVE_EPOLL" = "x1")
47 AC_CHECK_HEADERS([sys/sendfile.h])
49 dnl libkqueue should work in the future
50 AC_CHECK_FUNCS([kqueue])
52 AC_CHECK_FUNCS([ioctl])
53 AC_CHECK_FUNCS([sendfile])
54 AC_CHECK_FUNCS([open_memstream])
55 AC_CHECK_FUNCS([posix_fadvise])
56 AC_CHECK_FUNCS([vfork])
58 dnl need LIBS=-lfreebsd-glue (but not CFLAGS=-I/usr/include/freebsd)
59 AC_CHECK_FUNCS([bsd_sendfile])
61 dnl non-standard, but common
62 AC_CHECK_FUNCS([pthread_yield])
64 dnl gnulib doesn't actually define SOCK_NONBLOCK/SOCK_CLOEXEC, and
65 dnl even if it did, emulation wouldn't be thread-safe
66 AC_CHECK_FUNCS([accept4])
68 AC_SUBST(NOSTD_CFLAGS)
70 # This works for all platforms we care about:
71 # GNU/Linux, FreeBSD, Debian GNU/kFreeBSD
72 AC_CHECK_FUNCS([setproctitle], [NOSTD_CFLAGS=-DHAVE_SETPROCTITLE=1],
76 *) NOSTD_CFLAGS=-DSETPROCTITLE_NOOP;;
83 AC_CONFIG_FILES([Makefile lib/Makefile])