1 ###############################################################################
3 # Pakfire - The IPFire package management system #
4 # Copyright (C) 2013 IPFire Network Development Team #
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. #
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. #
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/>. #
19 ###############################################################################
27 [http://www.ipfire.org/])
29 AC_CONFIG_AUX_DIR([build-aux])
31 AC_PREFIX_DEFAULT([/usr])
42 AM_SILENT_RULES([yes])
53 AC_PATH_PROG([NITSI], [nitsi])
54 AC_PATH_PROG([WGET], [wget])
55 AC_PATH_PROG([XSLTPROC], [xsltproc])
59 # This makes sure pkg.m4 is available.
60 m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
66 AC_PROG_GCC_TRADITIONAL
68 AC_USE_SYSTEM_EXTENSIONS
70 CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
76 "-Wformat=2 -Wformat-security -Wformat-nonliteral" \
77 -Wno-unused-parameter \
79 -fno-strict-aliasing \
82 -fstack-protector-all \
83 --param=ssp-buffer-size=4])
84 AC_SUBST([OUR_CFLAGS], $with_cflags)
86 AS_CASE([$CFLAGS], [*-O[[12345g\ ]]*],
87 [CC_CHECK_FLAGS_APPEND([with_cppflags], [CPPFLAGS], [\
88 -Wp,-D_FORTIFY_SOURCE=2])],
89 [AC_MSG_RESULT([skipping -D_FORTIFY_SOURCE, optimization not enabled])])
90 AC_SUBST([OUR_CPPFLAGS], $with_cppflags)
92 CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
98 AC_SUBST([OUR_LDFLAGS], $with_ldflags)
100 # ------------------------------------------------------------------------------
102 AC_CHECK_HEADERS_ONCE([
119 # ------------------------------------------------------------------------------
121 AC_ARG_ENABLE([debug],
122 AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
123 [], [enable_debug=no])
124 AS_IF([test "x$enable_debug" = "xyes"], [
125 AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
128 # ------------------------------------------------------------------------------
131 AC_ARG_ENABLE(manpages, AS_HELP_STRING([--disable-man-pages],
132 [do not install man pages]))
133 AS_IF([test "x$enable_manpages" != xno], [have_manpages=yes])
134 AM_CONDITIONAL(ENABLE_MANPAGES, [test "x$have_manpages" = "xyes"])
136 # ------------------------------------------------------------------------------
141 [--with-dbuspolicydir=arg],
142 [directory for D-Bus policies (default: ${dbusdatadir|datarootdir}/dbus-1/system.d)]
144 [dbuspolicydir="$withval"],
145 [PKG_CHECK_VAR([dbusdatadir], [dbus-1], [datadir],, [dbusdatadir="${datarootdir}"])
146 dbuspolicydir="${dbusdatadir}/dbus-1/system.d"]
148 AC_SUBST(dbuspolicydir)
150 AC_ARG_WITH([dbussystembusdir], AS_HELP_STRING([--with-dbussystembusdir=DIR],
151 [path to D-Bus system bus services directory]), [with_dbussystembusdir=${withval}])
152 if test -z "${with_dbussystembusdir}"; then
153 AC_MSG_CHECKING([D-Bus system bus services dir])
154 with_dbussystembusdir="$($PKG_CONFIG --variable=system_bus_services_dir dbus-1)"
155 if test -z "${with_dbussystembusdir}"; then
156 AC_MSG_ERROR([D-Bus system bus services directory is required])
158 AC_MSG_RESULT([${with_dbussystembusdir}])
160 AC_SUBST(dbussystembusdir, [${with_dbussystembusdir}])
162 # ------------------------------------------------------------------------------
163 AC_ARG_WITH([systemdsystemunitdir],
164 AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
165 [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
166 AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
167 AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir"])
169 # ------------------------------------------------------------------------------
170 AC_ARG_WITH([udevdir],
171 AS_HELP_STRING([--with-udevdir=DIR], [Directory for udev files]),
172 [], [with_udevdir=$($PKG_CONFIG --variable=udevdir udev)])
173 AC_SUBST([udevdir], [$with_udevdir])
174 AM_CONDITIONAL(HAVE_UDEV, [test -n "$with_udevdir"])
176 # ------------------------------------------------------------------------------
178 PKG_CHECK_MODULES([LIBNL], [libnl-3.0 libnl-genl-3.0])
179 PKG_CHECK_MODULES([SYSTEMD], [libsystemd])
181 # ------------------------------------------------------------------------------
183 AC_CHECK_PROGS(ASCIIDOC, [asciidoc])
184 if test "${have_manpages}" = "yes" && test -z "${ASCIIDOC}"; then
185 AC_MSG_ERROR([Required program 'asciidoc' not found])
188 # ------------------------------------------------------------------------------
190 AC_CONFIG_HEADERS(config.h)
197 $PACKAGE_NAME $VERSION
199 CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
200 CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
201 LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
205 dbussystembusdir: ${dbussystembusdir}
206 systemdsystemunitdir: $systemdsystemunitdir
209 Generate man-pages: ${have_manpages}