]> git.ipfire.org Git - people/ms/pakfire.git/blob - configure.ac
buildservice: Move the old stuff into the new wrapper
[people/ms/pakfire.git] / configure.ac
1 ###############################################################################
2 # #
3 # Pakfire - The IPFire package management system #
4 # Copyright (C) 2013 Pakfire development team #
5 # #
6 # This program is free software: you can redistribute it and/or modify #
7 # it 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. #
10 # #
11 # This program is distributed in the hope that it will be useful, #
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14 # GNU General Public License for more details. #
15 # #
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/>. #
18 # #
19 ###############################################################################
20
21 AC_PREREQ([2.69])
22
23 AC_INIT([pakfire],
24 [0.9.29],
25 [info@ipfire.org],
26 [pakfire],
27 [https://git.ipfire.org/?p=pakfire.git;a=summary])
28
29 AC_CONFIG_MACRO_DIR([m4])
30 AC_CONFIG_HEADERS([config.h])
31 AC_CONFIG_AUX_DIR([build-aux])
32
33 AC_USE_SYSTEM_EXTENSIONS
34 AC_SYS_LARGEFILE
35 AC_PREFIX_DEFAULT([/usr])
36
37 AM_INIT_AUTOMAKE([
38 foreign
39 1.11
40 -Wall
41 -Wno-portability
42 silent-rules
43 tar-pax
44 subdir-objects
45 ])
46 AM_SILENT_RULES([yes])
47 LT_PREREQ(2.2)
48 LT_INIT([disable-static])
49
50 IT_PROG_INTLTOOL([0.40.0])
51
52 XGETTEXT="${XGETTEXT} --keyword=_:1,2 --keyword=N_:1,2 --no-location"
53
54 GETTEXT_PACKAGE=pakfire
55 AC_SUBST(GETTEXT_PACKAGE)
56
57 AC_PROG_LN_S
58 AC_PROG_MKDIR_P
59 AC_PROG_SED
60
61 AC_ARG_ENABLE([debug],
62 AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
63 [], [enable_debug=no])
64 AS_IF([test "x$enable_debug" = "xyes"], [
65 AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
66 ])
67
68 # Online Tests
69 AC_ARG_ENABLE([online-tests],
70 AS_HELP_STRING(
71 [--enable-online-tests],
72 [enable tests that require internet access @<:@default=disabled@:>@]
73 ), [], [enable_online_tests=no]
74 )
75 AS_IF([test "x$enable_online_tests" = "xyes"], [
76 AC_DEFINE(ENABLE_ONLINE_TESTS, [1], [Online Tests])
77 ])
78
79 # Man Pages
80
81 have_man_pages=no
82 AC_ARG_ENABLE(man_pages, AS_HELP_STRING([--disable-man-pages],
83 [do not install man pages]))
84 AS_IF([test "x$enable_man_pages" != xno], [have_man_pages=yes])
85 AM_CONDITIONAL(ENABLE_MAN_PAGES, [test "x$have_man_pages" = "xyes"])
86
87 AC_PATH_PROG([XSLTPROC], [xsltproc])
88
89 AC_CHECK_PROGS(ASCIIDOC, [asciidoc])
90 if test "${have_man_pages}" = "yes" && test -z "${ASCIIDOC}"; then
91 AC_MSG_ERROR([Required program 'asciidoc' not found])
92 fi
93
94 # pkg-config
95 PKG_PROG_PKG_CONFIG
96 # This makes sure pkg.m4 is available.
97 m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
98
99 # C Compiler
100 AC_PROG_CC
101
102 CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
103 -std=gnu11 \
104 -Wall \
105 -Wextra \
106 -Warray-bounds=2 \
107 -Wdate-time \
108 -Wendif-labels \
109 -Werror=format=2 \
110 -Werror=format-signedness \
111 -Werror=implicit-function-declaration \
112 -Werror=implicit-int \
113 -Werror=incompatible-pointer-types \
114 -Werror=int-conversion \
115 -Werror=missing-declarations \
116 -Werror=missing-prototypes \
117 -Werror=overflow \
118 -Werror=override-init \
119 -Werror=return-type \
120 -Werror=shift-count-overflow \
121 -Werror=shift-overflow=2 \
122 -Werror=strict-flex-arrays \
123 -Werror=undef \
124 -Wfloat-equal \
125 -Wimplicit-fallthrough=5 \
126 -Winit-self \
127 -Wlogical-op \
128 -Wmissing-include-dirs \
129 -Wmissing-noreturn \
130 -Wnested-externs \
131 -Wold-style-definition \
132 -Wpointer-arith \
133 -Wredundant-decls \
134 -Wshadow \
135 -Wstrict-aliasing=2 \
136 -Wstrict-prototypes \
137 -Wsuggest-attribute=noreturn \
138 -Wunused-function \
139 -Wwrite-strings \
140 -Wzero-length-bounds \
141 -Wno-unused-parameter \
142 -Wno-missing-field-initializers \
143 -fdiagnostics-show-option \
144 -fno-common \
145 ])
146
147 # Enable -fanalyzer if requested
148 AC_ARG_ENABLE([analyzer],
149 AS_HELP_STRING([--enable-analyzer], [enable static analyzer (-fanalyzer) @<:@default=disabled@:>@]),
150 [], [enable_analyzer=no])
151 AS_IF([test "x$enable_analyzer" = "xyes"],
152 CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [-fanalyzer])
153 )
154
155 # Enable -fno-semantic-interposition (if available)
156 CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [-fno-semantic-interposition])
157 CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [-fno-semantic-interposition])
158
159 AC_SUBST([OUR_CPPFLAGS], $with_cppflags)
160 AC_SUBST([OUR_CFLAGS], $with_cflags)
161 AC_SUBST([OUR_LDFLAGS], $with_ldflags)
162
163 # C Types
164 AC_TYPE_INT64_T
165 AC_TYPE_INTMAX_T
166 AC_TYPE_INTPTR_T
167 AC_TYPE_MODE_T
168 AC_TYPE_OFF_T
169 AC_TYPE_PID_T
170 AC_TYPE_SIZE_T
171 AC_TYPE_SSIZE_T
172 AC_TYPE_UID_T
173 AC_TYPE_UINT64_T
174
175 # Bison
176 AC_PROG_YACC
177
178 if test -z "${ac_cv_prog_YACC}"; then
179 echo "*** Error: No suitable bison/yacc found. ***"
180 echo " Please install the 'bison' package."
181 exit 1
182 fi
183
184 # Flex
185 AM_PROG_LEX
186
187 if test -z "${ac_cv_prog_LEX}"; then
188 echo "*** Error: No suitable flex/lex found. ***"
189 echo " Please install the 'flex' package."
190 exit 1
191 fi
192
193 AC_C_CONST
194 AC_CHECK_LIB([m], [round])
195
196 AC_CHECK_HEADERS([ \
197 ctype.h \
198 dirent.h \
199 errno.h \
200 fcntl.h \
201 fnmatch.h \
202 fts.h \
203 ftw.h \
204 glob.h \
205 grp.h \
206 libgen.h \
207 libintl.h \
208 linux/bpf.h \
209 linux/capability.h \
210 linux/limits.h \
211 linux/magic.h \
212 linux/sched.h \
213 math.h \
214 pwd.h \
215 regex.h \
216 sched.h \
217 signal.h \
218 stdarg.h \
219 stdint.h \
220 stdio.h \
221 stdlib.h \
222 string.h \
223 syslog.h \
224 sys/capability.h \
225 sys/epoll.h \
226 sys/file.h \
227 sys/ioctl.h \
228 sys/mount.h \
229 sys/personality.h \
230 sys/prctl.h \
231 sys/random.h \
232 sys/resource.h \
233 sys/sendfile.h \
234 sys/stat.h \
235 sys/sysmacros.h \
236 sys/types.h \
237 sys/user.h \
238 sys/utsname.h \
239 sys/vfs.h \
240 sys/wait.h \
241 time.h \
242 unistd.h \
243 utime.h
244 ])
245
246 AC_CHECK_FUNCS([ \
247 asprintf \
248 bpf \
249 epoll_ctl \
250 epoll_create1 \
251 epoll_wait \
252 flock \
253 fnctl \
254 getpid \
255 glob \
256 nftw \
257 openlog \
258 personality \
259 prctl \
260 remove \
261 secure_getenv \
262 sendfile \
263 snprintf \
264 strcmp \
265 strdup \
266 syslog \
267 qsort \
268 uname \
269 unlink \
270 vasprintf \
271 vsnprintf
272 ])
273
274 # Python Stuff
275 AM_PATH_PYTHON([3.6])
276
277 AX_PYTHON_MODULE([cpuinfo], [fatal])
278 AX_PYTHON_MODULE([kerberos], [fatal])
279 AX_PYTHON_MODULE([psutil], [fatal])
280 AX_PYTHON_MODULE([setproctitle], [fatal])
281 AX_PYTHON_MODULE([systemd], [fatal])
282 AX_PYTHON_MODULE([tornado], [fatal])
283
284 # Libraries we depend on
285 PKG_CHECK_MODULES([ARCHIVE], [libarchive >= 3.4.0])
286 PKG_CHECK_MODULES([BPF], [libbpf])
287 PKG_CHECK_MODULES([CAP], [libcap])
288 PKG_CHECK_MODULES([CURL], [libcurl])
289 PKG_CHECK_MODULES([ELF], [libelf])
290 PKG_CHECK_MODULES([PYTHON_DEVEL], [python-${PYTHON_VERSION}-embed],
291 [], [PKG_CHECK_MODULES([PYTHON_DEVEL], [python-${PYTHON_VERSION}])])
292 PKG_CHECK_MODULES([JSON_C], [json-c >= 0.15])
293 PKG_CHECK_MODULES([KRB5], [krb5])
294 PKG_CHECK_MODULES([LZMA], [liblzma])
295 PKG_CHECK_MODULES([MAGIC], [libmagic])
296 PKG_CHECK_MODULES([MOUNT], [mount])
297 PKG_CHECK_MODULES([NL3], [libnl-3.0])
298 PKG_CHECK_MODULES([NL3_ROUTE], [libnl-route-3.0])
299 PKG_CHECK_MODULES([OPENSSL], [openssl >= 1.1.1])
300 PKG_CHECK_MODULES([PCRE2], [libpcre2-8])
301 PKG_CHECK_MODULES([SECCOMP], [libseccomp])
302 PKG_CHECK_MODULES([SOLV], [libsolv >= 0.7.5])
303 PKG_CHECK_MODULES([SQLITE3], [sqlite3])
304 PKG_CHECK_MODULES([SYSTEMD], [libsystemd],
305 [AC_DEFINE([HAVE_SYSTEMD], [1], [Use systemd])])
306 PKG_CHECK_MODULES([UUID], [uuid])
307 PKG_CHECK_MODULES([ZSTD], [libzstd])
308
309 save_LIBS="$LIBS"
310
311 # subid
312 #LIBS=
313 #AC_SEARCH_LIBS([subid_init], [subid],
314 # [AC_DEFINE([HAVE_SUBID], [], [subid is present])],
315 # [AC_MSG_WARN([*** subid library not found])])
316 #SUBID_LIBS="$LIBS"
317 #AC_SUBST(SUBID_LIBS)
318
319 LIBS="$save_LIBS"
320
321 AC_ARG_WITH([systemdsystemunitdir],
322 AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
323 [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
324 AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
325 AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir"])
326
327 AC_DEFINE_UNQUOTED([PAKFIRE_CONFIG_DIR], ["${sysconfdir}/${PACKAGE_NAME}"],
328 [The path where Pakfire stores configuration files])
329 AC_DEFINE_UNQUOTED([PAKFIRE_CACHE_DIR], ["/var/cache/${PACKAGE_NAME}"],
330 [The path where Pakfire caches downloaded data])
331 AC_DEFINE_UNQUOTED([PAKFIRE_PRIVATE_DIR], ["/var/lib/${PACKAGE_NAME}"],
332 [The path where Pakfire stores its private data])
333 AC_DEFINE_UNQUOTED([PAKFIRE_SCRIPTS_DIR], ["${PREFIX}/lib/${PACKAGE_NAME}"],
334 [The path where Pakfire stores its scripts])
335 AC_DEFINE_UNQUOTED([PAKFIRE_TMP_DIR], ["/var/tmp"],
336 [The path where Pakfire stores temporary data])
337
338 AC_CONFIG_FILES([
339 Makefile
340 po/Makefile.in
341 src/pakfire/__version__.py
342 ])
343
344 AC_OUTPUT
345 AC_MSG_RESULT([
346 $PACKAGE_NAME $VERSION
347
348 Debug: ${enable_debug}
349 Online Tests: ${enable_online_tests}
350
351 CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
352 CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
353 LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
354 PYTHON_CFLAGS: ${PYTHON_DEVEL_CFLAGS}
355 PYTHON_LIBS: ${PYTHON_DEVEL_LIBS}
356 ])