]> git.ipfire.org Git - pakfire.git/blob - configure.ac
configure: Depend on GPGME
[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.64])
22
23 AC_INIT([pakfire],
24 [0.9.27],
25 [info@ipfire.org],
26 [pakfire],
27 [http://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 GETTEXT_PACKAGE=pakfire
53 AC_SUBST(GETTEXT_PACKAGE)
54
55 AC_PROG_LN_S
56 AC_PROG_MKDIR_P
57 AC_PROG_SED
58
59 # pkg-config
60 PKG_PROG_PKG_CONFIG
61 # This makes sure pkg.m4 is available.
62 m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
63
64 # C Compiler
65 AC_PROG_CC
66 AC_PROG_CC_C99
67 AC_PROG_CC_C_O
68 AC_PROG_GCC_TRADITIONAL
69 AC_OPENMP
70
71 CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
72 -pipe \
73 -Wall \
74 -Wextra \
75 -Wno-inline \
76 -Wundef \
77 "-Wformat=2 -Wformat-security -Wformat-nonliteral" \
78 -Wno-unused-parameter \
79 -Wno-unused-result \
80 -fno-strict-aliasing \
81 -ffunction-sections \
82 -fdata-sections \
83 -fstack-protector-all \
84 --param=ssp-buffer-size=4])
85 AC_SUBST([OUR_CFLAGS], $with_cflags)
86
87 AS_CASE([$CFLAGS], [*-O[[12345g\ ]]*],
88 [CC_CHECK_FLAGS_APPEND([with_cppflags], [CPPFLAGS], [\
89 -Wp,-D_FORTIFY_SOURCE=2])],
90 [AC_MSG_RESULT([skipping -D_FORTIFY_SOURCE, optimization not enabled])])
91 AC_SUBST([OUR_CPPFLAGS], $with_cppflags)
92
93 CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
94 -Wl,--as-needed \
95 -Wl,--no-undefined \
96 -Wl,--gc-sections \
97 -Wl,-z,relro \
98 -Wl,-z,now])
99 AC_SUBST([OUR_LDFLAGS], $with_ldflags)
100
101 # Python
102 AM_PATH_PYTHON([3.6])
103
104 AC_C_CONST
105 AC_CHECK_LIB([m], [round])
106
107 AC_CHECK_HEADERS([ \
108 assert.h \
109 math.h \
110 stdlib.h \
111 string.h \
112 sys/stat.h \
113 unistd.h
114 ])
115
116 AC_CHECK_FUNCS([ \
117 assert \
118 strcmp \
119 strdup
120 ])
121
122 save_LIBS="$LIBS"
123
124 # libdl
125 LIBS=
126 AC_SEARCH_LIBS([dlsym], [dl], [], [AC_MSG_ERROR([*** Dynamic linking loader library not found])])
127 DL_LIBS="$LIBS"
128 AC_SUBST(DL_LIBS)
129
130 # libcap
131 AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([*** POSIX caps headers not found])])
132
133 LIBS=
134 AC_SEARCH_LIBS([cap_init], [cap], [], [AC_MSG_ERROR([*** POSIX caps library not found])])
135 CAP_LIBS="$LIBS"
136 AC_SUBST(CAP_LIBS)
137
138 # libsolv
139 AC_CHECK_HEADERS([solv/solvversion.h], [], [AC_MSG_ERROR([*** libsolv headers not found])])
140
141 LIBS=
142 AC_SEARCH_LIBS([solver_create], [solv], [], [AC_MSG_ERROR([*** libsolv library not found])])
143 SOLV_LIBS="$LIBS"
144 AC_SUBST(SOLV_LIBS)
145 LIBS="$save_LIBS"
146
147 PKG_CHECK_MODULES([ARCHIVE], [libarchive])
148 PKG_CHECK_MODULES([PYTHON_DEVEL], [python-${PYTHON_VERSION}])
149 PKG_CHECK_MODULES([LZMA], [liblzma])
150
151 AM_PATH_GPGME([1.6.0], [], [AC_MSG_ERROR([*** GPGME not found])])
152
153 AC_ARG_WITH([systemdsystemunitdir],
154 AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
155 [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
156 AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
157 AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir"])
158
159 AC_CONFIG_FILES([
160 Makefile
161 po/Makefile.in
162 src/pakfire/__version__.py
163 ])
164
165 AC_OUTPUT
166 AC_MSG_RESULT([
167 $PACKAGE_NAME $VERSION
168
169 CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
170 CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
171 LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
172 PYTHON_CFLAGS: ${PYTHON_DEVEL_CFLAGS}
173 PYTHON_LIBS: ${PYTHON_DEVEL_LIBS}
174 ])