]> git.ipfire.org Git - pakfire.git/blame - configure.ac
configure: Allow to enable debug mode
[pakfire.git] / configure.ac
CommitLineData
b55979b4
MT
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
21AC_PREREQ([2.64])
22
23AC_INIT([pakfire],
48b888dc 24 [0.9.27],
b55979b4
MT
25 [info@ipfire.org],
26 [pakfire],
27 [http://git.ipfire.org/?p=pakfire.git;a=summary])
28
29AC_CONFIG_MACRO_DIR([m4])
30AC_CONFIG_HEADERS([config.h])
31AC_CONFIG_AUX_DIR([build-aux])
32
33AC_USE_SYSTEM_EXTENSIONS
34AC_SYS_LARGEFILE
35AC_PREFIX_DEFAULT([/usr])
36
37AM_INIT_AUTOMAKE([
38 foreign
39 1.11
40 -Wall
41 -Wno-portability
42 silent-rules
43 tar-pax
44 subdir-objects
45])
46AM_SILENT_RULES([yes])
47LT_PREREQ(2.2)
48LT_INIT([disable-static])
49
50IT_PROG_INTLTOOL([0.40.0])
51
52GETTEXT_PACKAGE=pakfire
53AC_SUBST(GETTEXT_PACKAGE)
54
55AC_PROG_LN_S
56AC_PROG_MKDIR_P
57AC_PROG_SED
58
a5fc19b7
MT
59AC_ARG_ENABLE([debug],
60 AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
61 [], [enable_debug=no])
62AS_IF([test "x$enable_debug" = "xyes"], [
63 AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
64])
65
b55979b4
MT
66# pkg-config
67PKG_PROG_PKG_CONFIG
68# This makes sure pkg.m4 is available.
69m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
70
71# C Compiler
72AC_PROG_CC
73AC_PROG_CC_C99
74AC_PROG_CC_C_O
75AC_PROG_GCC_TRADITIONAL
76AC_OPENMP
77
78CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
79 -pipe \
80 -Wall \
81 -Wextra \
82 -Wno-inline \
83 -Wundef \
84 "-Wformat=2 -Wformat-security -Wformat-nonliteral" \
85 -Wno-unused-parameter \
86 -Wno-unused-result \
87 -fno-strict-aliasing \
88 -ffunction-sections \
89 -fdata-sections \
90 -fstack-protector-all \
91 --param=ssp-buffer-size=4])
92AC_SUBST([OUR_CFLAGS], $with_cflags)
93
94AS_CASE([$CFLAGS], [*-O[[12345g\ ]]*],
95 [CC_CHECK_FLAGS_APPEND([with_cppflags], [CPPFLAGS], [\
96 -Wp,-D_FORTIFY_SOURCE=2])],
97 [AC_MSG_RESULT([skipping -D_FORTIFY_SOURCE, optimization not enabled])])
98AC_SUBST([OUR_CPPFLAGS], $with_cppflags)
99
100CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
101 -Wl,--as-needed \
102 -Wl,--no-undefined \
103 -Wl,--gc-sections \
104 -Wl,-z,relro \
105 -Wl,-z,now])
106AC_SUBST([OUR_LDFLAGS], $with_ldflags)
107
108# Python
2e708cdf 109AM_PATH_PYTHON([3.6])
b55979b4 110
221cc3ce
MT
111AC_C_CONST
112AC_CHECK_LIB([m], [round])
113
114AC_CHECK_HEADERS([ \
115 assert.h \
116 math.h \
117 stdlib.h \
118 string.h \
119 sys/stat.h \
120 unistd.h
121])
122
123AC_CHECK_FUNCS([ \
124 assert \
125 strcmp \
126 strdup
127])
128
b55979b4
MT
129save_LIBS="$LIBS"
130
b55979b4
MT
131# libdl
132LIBS=
133AC_SEARCH_LIBS([dlsym], [dl], [], [AC_MSG_ERROR([*** Dynamic linking loader library not found])])
134DL_LIBS="$LIBS"
135AC_SUBST(DL_LIBS)
136
137# libcap
138AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([*** POSIX caps headers not found])])
139
140LIBS=
141AC_SEARCH_LIBS([cap_init], [cap], [], [AC_MSG_ERROR([*** POSIX caps library not found])])
142CAP_LIBS="$LIBS"
143AC_SUBST(CAP_LIBS)
144
b55979b4
MT
145# libsolv
146AC_CHECK_HEADERS([solv/solvversion.h], [], [AC_MSG_ERROR([*** libsolv headers not found])])
147
148LIBS=
149AC_SEARCH_LIBS([solver_create], [solv], [], [AC_MSG_ERROR([*** libsolv library not found])])
150SOLV_LIBS="$LIBS"
151AC_SUBST(SOLV_LIBS)
152LIBS="$save_LIBS"
153
221cc3ce 154PKG_CHECK_MODULES([ARCHIVE], [libarchive])
b55979b4
MT
155PKG_CHECK_MODULES([PYTHON_DEVEL], [python-${PYTHON_VERSION}])
156PKG_CHECK_MODULES([LZMA], [liblzma])
157
6d33e7ed 158AM_PATH_LIBGCRYPT([1.8.0], [], [AC_MSG_ERROR([*** libgcrypt not found])])
0e75ae24
MT
159AM_PATH_GPGME([1.6.0], [], [AC_MSG_ERROR([*** GPGME not found])])
160
b55979b4
MT
161AC_ARG_WITH([systemdsystemunitdir],
162 AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
163 [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
164AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
165AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir"])
166
167AC_CONFIG_FILES([
168 Makefile
169 po/Makefile.in
b55979b4
MT
170 src/pakfire/__version__.py
171])
172
173AC_OUTPUT
174AC_MSG_RESULT([
175 $PACKAGE_NAME $VERSION
176
a5fc19b7
MT
177 Debug: ${enable_debug}
178
b55979b4
MT
179 CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
180 CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
181 LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
182 PYTHON_CFLAGS: ${PYTHON_DEVEL_CFLAGS}
183 PYTHON_LIBS: ${PYTHON_DEVEL_LIBS}
184])