3 AC_INIT([buxton],[3],[william.douglas@intel.com],[buxton],[https://github.com/sofar/buxton])
4 AM_INIT_AUTOMAKE([foreign -Wall -Werror -Wno-portability silent-rules subdir-objects color-tests no-dist-gzip dist-xz])
5 AC_CONFIG_MACRO_DIR([m4])
6 AC_CONFIG_FILES([Makefile])
7 AC_CONFIG_SRCDIR([src/core/main.c])
8 AC_CONFIG_HEADERS([config.h])
9 AC_PREFIX_DEFAULT(/usr/local)
12 LT_INIT([disable-static])
14 # Checks for programs.
20 # Checks for libraries.
21 AC_CHECK_LIB([dl], [dlopen])
22 AC_CHECK_LIB([gdbm], [gdbm_open])
23 AC_CHECK_LIB([rt], [clock_gettime])
24 AC_CHECK_LIB([m], [sqrt])
26 # Checks for typedefs, structures, and compiler characteristics.
39 # Checks for library functions.
44 AC_CHECK_FUNCS([atexit])
45 AC_CHECK_FUNCS([memmove])
46 AC_CHECK_FUNCS([memset])
47 AC_CHECK_FUNCS([socket])
48 AC_CHECK_FUNCS([strchr])
49 AC_CHECK_FUNCS([strdup])
50 AC_CHECK_FUNCS([strndup])
51 AC_CHECK_FUNCS([strtol])
52 AC_CHECK_FUNCS([__secure_getenv secure_getenv])
54 AC_MSG_CHECKING([[whether preprocessor supports #pragma once]])
56 [AC_LANG_PROGRAM([[#pragma once]])],
59 AC_DEFINE([HAVE_PRAGMA_ONCE], [1], [Preprocessor support for #pragma once])
61 [AC_MSG_RESULT([no])])
63 AH_VERBATIM([_GNU_SOURCE],
64 [/* Enable GNU extensions on systems that have them. */
69 AH_TOP([#ifndef CONFIG_H_INCLUDED
70 #define CONFIG_H_INCLUDED 1])
74 PKG_CHECK_MODULES([CHECK], [check])
75 PKG_CHECK_MODULES([SYSTEMD], [libsystemd-daemon])
77 # Checks for header files.
80 AC_CHECK_HEADERS([attr/xattr.h], [], [AC_MSG_ERROR([Unable to find xattr headers])])
81 AC_CHECK_HEADERS([fcntl.h])
82 AC_CHECK_HEADERS([gdbm.h], [], [AC_MSG_ERROR([Unable to find gdbm headers])])
83 AC_CHECK_HEADERS([inttypes.h])
84 AC_CHECK_HEADERS([limits.h])
85 AC_CHECK_HEADERS([locale.h])
86 AC_CHECK_HEADERS([malloc.h])
87 AC_CHECK_HEADERS([stddef.h])
88 AC_CHECK_HEADERS([stdint.h])
89 AC_CHECK_HEADERS([stdlib.h])
90 AC_CHECK_HEADERS([string.h])
91 AC_CHECK_HEADERS([time.h])
92 AC_CHECK_HEADERS([math.h])
93 AC_CHECK_HEADERS([pthread.h])
94 AC_CHECK_HEADERS([sys/param.h])
95 AC_CHECK_HEADERS([sys/signalfd.h])
96 AC_CHECK_HEADERS([sys/socket.h])
97 AC_CHECK_HEADERS([sys/stat.h])
98 AC_CHECK_HEADERS([sys/time.h])
99 AC_CHECK_HEADERS([unistd.h])
100 AC_CHECK_HEADERS([linux/inotify.h])
101 AC_CHECK_FUNC(inotify_init)
104 AC_ARG_WITH([systemdsystemunitdir], AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
105 [path to systemd system service directory]), [path_systemdsystemunit=${withval}],
106 [path_systemdsystemunit="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`"])
107 SYSTEMD_SYSTEMUNITDIR="${path_systemdsystemunit}"
108 AC_SUBST(SYSTEMD_SYSTEMUNITDIR)
109 AM_CONDITIONAL(SYSTEMD, test -n "${path_systemdsystemunit}")
111 AC_ARG_WITH([user], AS_HELP_STRING([--with-user=USER],
112 [user to run buxton as]), [username=${withval}],
114 BUXTON_USERNAME="${username}"
115 AC_SUBST(BUXTON_USERNAME)
117 INIPARSER_CFLAGS="-I${srcdir}/src/shared/"
118 AC_ARG_WITH([local-iniparser],
119 AS_HELP_STRING([--with-local-iniparser[default=yes]],
120 [Use built-in iniparser for config parsing]),
121 [use_local_iniparser="true"],
122 [PKG_CHECK_MODULES([INIPARSER], [iniparser >= 3.1],
123 [use_local_iniparser="false"],
124 [use_local_iniparser="true"; AC_SUBST(INIPARSER_CFLAGS)])])
125 AM_CONDITIONAL([USE_LOCAL_INIPARSER], [test x$use_local_iniparser = x"true"])
127 AC_ARG_WITH([module-dir], AS_HELP_STRING([--with-module-dir=MODULEDIR],
128 [path to buxton modules]), [moduledir=${withval}],
129 [moduledir="${libdir}/buxton"])
130 MODULEDIR="${moduledir}"
133 AC_ARG_WITH([config-path], AS_HELP_STRING([--with-config-path=CONFPATH],
134 [path to buxton configuration file]), [confpath=${withval}],
135 [confpath="${sysconfdir}/buxton.conf"])
136 CONFPATH="${confpath}"
139 AC_ARG_WITH([db-path], AS_HELP_STRING([--with-db-path=DBPATH],
140 [path to buxton db files]), [dbpath=${withval}],
141 [dbpath="${localstatedir}/lib/buxton"])
145 AC_ARG_WITH([socket-path], AS_HELP_STRING([--with-socket-path=SOCKETPATH],
146 [path to buxton socket file]), [socketpath=${withval}],
147 [socketpath="/run/buxton-0"])
148 BUXTON_SOCKET="${socketpath}"
149 AC_SUBST(BUXTON_SOCKET)
151 AC_ARG_WITH([smack-load-file], AS_HELP_STRING([--with-smack-load-file=SMACKLOADFILE],
152 [path to smack load2 file]), [smack_load_file=${withval}],
153 [smack_load_file="/sys/fs/smackfs/load2"])
154 SMACK_LOAD_FILE="${smack_load_file}"
155 AC_SUBST(SMACK_LOAD_FILE)
157 AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [enable debug mode @<:@default=no@:>@]),
158 [], [enable_debug=no])
159 AS_IF([test "x$enable_debug" = "xyes"],
160 [AC_DEFINE([DEBUG], [1], [Debugging mode enabled])],
161 [AC_DEFINE([NDEBUG], [1], [Debugging and assertions disabled])])
162 AM_CONDITIONAL([DEBUG], [test x$enable_debug = x"yes"])
164 AC_ARG_ENABLE(manpages, AS_HELP_STRING([--enable-manpages], [enable man pages @<:@default=yes@:>@]),
165 [], [enable_manpages=yes])
166 AS_IF([test "x$enable_manpages" = "xyes"],
167 [AC_DEFINE([MANPAGE], [1], [Man pages will be included])],
168 [AC_DEFINE([NMANPAGE], [1], [Man pages will not be included])])
169 AM_CONDITIONAL([MANPAGE], [test x$enable_manpages = x"yes"])
172 AC_ARG_ENABLE(coverage, AS_HELP_STRING([--enable-coverage], [enable test coverage]))
173 if test "x$enable_coverage" = "xyes" ; then
174 AC_CHECK_PROG(lcov_found, [lcov], [yes], [no])
175 if test "x$lcov_found" = xno ; then
176 AC_MSG_ERROR([*** lcov support requested but the program was not found])
178 lcov_version_major="`lcov --version | cut -d ' ' -f 4 | cut -d '.' -f 1`"
179 lcov_version_minor="`lcov --version | cut -d ' ' -f 4 | cut -d '.' -f 2`"
180 if test "$lcov_version_major" -eq 1 -a "$lcov_version_minor" -lt 10; then
181 AC_MSG_ERROR([*** lcov version is too old. 1.10 required])
184 AC_DEFINE([COVERAGE], [1], [Coverage enabled])
188 AM_CONDITIONAL([COVERAGE], [test "$have_coverage" = "yes"])
190 AC_ARG_ENABLE(demos, AS_HELP_STRING([--enable-demos], [enable demos @<:@default=no@:>@]),
191 [], [enable_demos=no])
192 AS_IF([test "x$enable_demos" = "xyes"],
193 [AC_DEFINE([DEMOS], [1], [Building demos])],
195 AM_CONDITIONAL([BUILD_DEMOS], [test x$enable_demos = x"yes"])
198 AC_ARG_ENABLE(gtk-demo, AS_HELP_STRING([--enable-gtk-demo], [enable demos @<:@default=no@:>@]),
199 [], [enable_gtk_demo=no])
200 AS_IF([test "x$enable_gtk_demo" = "xyes"],
201 [AC_DEFINE([DEMOS], [1], [Building GTK demo])],
203 AM_CONDITIONAL([BUILD_GTK_DEMO], [test x$enable_gtk_demo = x"yes"])
205 if test "x$enable_gtk_demo" = "xyes"; then
206 # Require GTK3 for client demonstration
207 PKG_CHECK_MODULES([GTK3], [gtk+-3.0 >= 3.10])
210 AC_CONFIG_COMMANDS([mkdir], [$MKDIR_P test/databases])
227 sysconfdir: ${sysconfdir}
228 exec_prefix: ${exec_prefix}
231 datarootdir: ${datarootdir}
233 modules: ${MODULEDIR}
239 debug: ${enable_debug}
240 demos: ${enable_demos}
241 coverage: ${have_coverage}
242 manpages: ${enable_manpages}