]> git.ipfire.org Git - people/ms/network.git/blob - configure.ac
nitsi: Create "nitsi" Makefile target
[people/ms/network.git] / configure.ac
1 ###############################################################################
2 # #
3 # Pakfire - The IPFire package management system #
4 # Copyright (C) 2013 IPFire Network 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([network],
24 [009],
25 [info@ipfire.org],
26 [network],
27 [http://www.ipfire.org/])
28
29 AC_CONFIG_AUX_DIR([build-aux])
30
31 AC_PREFIX_DEFAULT([/usr])
32
33 AM_INIT_AUTOMAKE([
34 foreign
35 1.11
36 -Wall
37 -Wno-portability
38 silent-rules
39 tar-pax
40 subdir-objects
41 ])
42 AM_SILENT_RULES([yes])
43
44 LT_INIT([
45 disable-static
46 pic-only
47 ])
48
49 AC_PROG_LN_S
50 AC_PROG_MKDIR_P
51 AC_PROG_SED
52
53 AC_PATH_PROG([NITSI], [nitsi])
54 AC_PATH_PROG([XSLTPROC], [xsltproc])
55
56 # pkg-config
57 PKG_PROG_PKG_CONFIG
58 # This makes sure pkg.m4 is available.
59 m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
60
61 # C Compiler
62 AC_PROG_CC
63 AC_PROG_CC_C99
64 AC_PROG_CC_C_O
65 AC_PROG_GCC_TRADITIONAL
66
67 CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
68 -pipe \
69 -Wall \
70 -Wextra \
71 -Wno-inline \
72 -Wundef \
73 "-Wformat=2 -Wformat-security -Wformat-nonliteral" \
74 -Wno-unused-parameter \
75 -Wno-unused-result \
76 -fno-strict-aliasing \
77 -ffunction-sections \
78 -fdata-sections \
79 -fstack-protector-all \
80 --param=ssp-buffer-size=4])
81 AC_SUBST([OUR_CFLAGS], $with_cflags)
82
83 AS_CASE([$CFLAGS], [*-O[[12345g\ ]]*],
84 [CC_CHECK_FLAGS_APPEND([with_cppflags], [CPPFLAGS], [\
85 -Wp,-D_FORTIFY_SOURCE=2])],
86 [AC_MSG_RESULT([skipping -D_FORTIFY_SOURCE, optimization not enabled])])
87 AC_SUBST([OUR_CPPFLAGS], $with_cppflags)
88
89 CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
90 -Wl,--as-needed \
91 -Wl,--no-undefined \
92 -Wl,--gc-sections \
93 -Wl,-z,relro \
94 -Wl,-z,now])
95 AC_SUBST([OUR_LDFLAGS], $with_ldflags)
96
97 # ------------------------------------------------------------------------------
98
99 AC_CHECK_HEADERS_ONCE([
100 ctype.h
101 errno.h
102 linux/netlink.h
103 net/if.h
104 stdarg.h
105 stdio.h
106 stdlib.h
107 string.h
108 syslog.h
109 ])
110
111 AC_CHECK_FUNCS([ \
112 __secure_getenv \
113 secure_getenv \
114 ])
115
116 # ------------------------------------------------------------------------------
117
118 AC_ARG_ENABLE([debug],
119 AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
120 [], [enable_debug=no])
121 AS_IF([test "x$enable_debug" = "xyes"], [
122 AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
123 ])
124
125 # ------------------------------------------------------------------------------
126 AC_ARG_WITH([systemdsystemunitdir],
127 AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
128 [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
129 AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
130 AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir"])
131
132 # ------------------------------------------------------------------------------
133 AC_ARG_WITH([udevdir],
134 AS_HELP_STRING([--with-udevdir=DIR], [Directory for udev files]),
135 [], [with_udevdir=$($PKG_CONFIG --variable=udevdir udev)])
136 AC_SUBST([udevdir], [$with_udevdir])
137 AM_CONDITIONAL(HAVE_UDEV, [test -n "$with_udevdir"])
138
139 # ------------------------------------------------------------------------------
140
141 PKG_CHECK_MODULES([LIBNL], [libnl-3.0 libnl-genl-3.0])
142
143 # ------------------------------------------------------------------------------
144
145 AC_CONFIG_HEADERS(config.h)
146 AC_CONFIG_FILES([
147 Makefile
148 ])
149
150 AC_OUTPUT
151 AC_MSG_RESULT([
152 $PACKAGE_NAME $VERSION
153
154 CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
155 CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
156 LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
157
158 prefix: $prefix
159
160 systemdsystemunitdir: $systemdsystemunitdir
161 udevdir: $udevdir
162 ])