]>
Commit | Line | Data |
---|---|---|
1 | AC_PREREQ(2.60) | |
2 | AC_INIT([libloc], | |
3 | [0.9.16], | |
4 | [location@lists.ipfire.org], | |
5 | [libloc], | |
6 | [https://location.ipfire.org/]) | |
7 | ||
8 | AC_CONFIG_SRCDIR([src/libloc.c]) | |
9 | AC_CONFIG_AUX_DIR([build-aux]) | |
10 | AM_INIT_AUTOMAKE([ | |
11 | foreign | |
12 | 1.11 | |
13 | -Wall | |
14 | -Wno-portability | |
15 | silent-rules | |
16 | tar-pax | |
17 | no-dist-gzip | |
18 | dist-xz | |
19 | subdir-objects | |
20 | ]) | |
21 | AC_PROG_CC | |
22 | AC_USE_SYSTEM_EXTENSIONS | |
23 | AC_SYS_LARGEFILE | |
24 | AC_CONFIG_MACRO_DIR([m4]) | |
25 | AM_SILENT_RULES([yes]) | |
26 | LT_INIT([ | |
27 | disable-static | |
28 | pic-only | |
29 | ]) | |
30 | AC_PREFIX_DEFAULT([/usr]) | |
31 | gl_LD_VERSION_SCRIPT | |
32 | ||
33 | IT_PROG_INTLTOOL([0.40.0]) | |
34 | ||
35 | # Interpret embedded Python in HTML files | |
36 | XGETTEXT="${XGETTEXT} -L Python --keyword=_:1,2 --keyword=N_:1,2 --no-location" | |
37 | ||
38 | GETTEXT_PACKAGE=${PACKAGE_TARNAME} | |
39 | AC_SUBST(GETTEXT_PACKAGE) | |
40 | ||
41 | AC_PROG_SED | |
42 | AC_PROG_MKDIR_P | |
43 | ||
44 | # - man ------------------------------------------------------------------------ | |
45 | ||
46 | have_man_pages=no | |
47 | AC_ARG_ENABLE(man_pages, AS_HELP_STRING([--disable-man-pages], | |
48 | [do not install man pages])) | |
49 | AS_IF([test "x$enable_man_pages" != xno], [have_man_pages=yes]) | |
50 | AM_CONDITIONAL(ENABLE_MAN_PAGES, [test "x$have_man_pages" = "xyes"]) | |
51 | ||
52 | AC_PATH_PROG([XSLTPROC], [xsltproc]) | |
53 | ||
54 | AC_CHECK_PROGS(ASCIIDOC, [asciidoc]) | |
55 | if test "${have_man_pages}" = "yes" && test -z "${ASCIIDOC}"; then | |
56 | AC_MSG_ERROR([Required program 'asciidoc' not found]) | |
57 | fi | |
58 | # - debug ---------------------------------------------------------------------- | |
59 | ||
60 | AC_ARG_ENABLE([debug], | |
61 | AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]), | |
62 | [], [enable_debug=no]) | |
63 | AS_IF([test "x$enable_debug" = "xyes"], [ | |
64 | AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.]) | |
65 | ]) | |
66 | ||
67 | AC_CHECK_HEADERS_ONCE([ | |
68 | arpa/inet.h \ | |
69 | arpa/nameser.h \ | |
70 | arpa/nameser_compat.h \ | |
71 | endian.h \ | |
72 | netinet/in.h \ | |
73 | resolv.h \ | |
74 | string.h \ | |
75 | ]) | |
76 | ||
77 | AC_CHECK_FUNCS([ \ | |
78 | be16toh \ | |
79 | be32toh \ | |
80 | be64toh \ | |
81 | htobe16 \ | |
82 | htobe32 \ | |
83 | htobe64 \ | |
84 | madvise \ | |
85 | mmap \ | |
86 | munmap \ | |
87 | res_query \ | |
88 | __secure_getenv \ | |
89 | secure_getenv \ | |
90 | qsort \ | |
91 | ]) | |
92 | ||
93 | my_CFLAGS="\ | |
94 | -Wall \ | |
95 | -Wchar-subscripts \ | |
96 | -Wformat-security \ | |
97 | -Wmissing-declarations \ | |
98 | -Wmissing-prototypes \ | |
99 | -Wnested-externs \ | |
100 | -Wpointer-arith \ | |
101 | -Wshadow \ | |
102 | -Wsign-compare \ | |
103 | -Wstrict-prototypes \ | |
104 | -Wtype-limits \ | |
105 | " | |
106 | AC_SUBST([my_CFLAGS]) | |
107 | AC_SUBST([my_LDFLAGS]) | |
108 | ||
109 | # Enable -fanalyzer if requested | |
110 | AC_ARG_ENABLE([analyzer], | |
111 | AS_HELP_STRING([--enable-analyzer], [enable static analyzer (-fanalyzer) @<:@default=disabled@:>@]), | |
112 | [], [enable_analyzer=no]) | |
113 | AS_IF([test "x$enable_analyzer" = "xyes"], | |
114 | CC_CHECK_FLAGS_APPEND([my_CFLAGS], [CFLAGS], [-fanalyzer]) | |
115 | ) | |
116 | ||
117 | # Enable -fno-semantic-interposition (if available) | |
118 | CC_CHECK_FLAGS_APPEND([my_CFLAGS], [CFLAGS], [-fno-semantic-interposition]) | |
119 | CC_CHECK_FLAGS_APPEND([my_LDFLAGS], [LDFLAGS], [-fno-semantic-interposition]) | |
120 | ||
121 | # ------------------------------------------------------------------------------ | |
122 | ||
123 | AC_ARG_WITH([database-path], | |
124 | AS_HELP_STRING([--with-database-path], [The default database path]), | |
125 | [], [with_database_path=/var/lib/location/database.db] | |
126 | ) | |
127 | ||
128 | if test -z "${with_database_path}"; then | |
129 | AC_MSG_ERROR([The default database path is empty]) | |
130 | fi | |
131 | ||
132 | AC_DEFINE_UNQUOTED([LIBLOC_DEFAULT_DATABASE_PATH], ["${with_database_path}"], | |
133 | [The default path for the database]) | |
134 | AC_SUBST([DEFAULT_DATABASE_PATH], [${with_database_path}]) | |
135 | ||
136 | AC_ARG_WITH([systemd], | |
137 | AS_HELP_STRING([--with-systemd], [Enable systemd support.]) | |
138 | ) | |
139 | ||
140 | AS_IF([test "x$with_systemd" != "xno"], | |
141 | [PKG_CHECK_MODULES(systemd, [libsystemd], | |
142 | [have_systemd=yes], [have_systemd=no])], | |
143 | [have_systemd=no] | |
144 | ) | |
145 | ||
146 | AS_IF([test "x$have_systemd" = "xyes"], | |
147 | [AC_MSG_CHECKING([for systemd system unit directory]) | |
148 | AC_ARG_WITH([systemdsystemunitdir], | |
149 | AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), | |
150 | [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)] | |
151 | ) | |
152 | ||
153 | AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) | |
154 | ||
155 | if test -n "$systemdsystemunitdir" -a "x$systemdsystemunitdir" != xno; then | |
156 | AC_MSG_RESULT([$systemdsystemunitdir]) | |
157 | else | |
158 | AC_MSG_ERROR([not found (try --with-systemdsystemunitdir)]) | |
159 | fi | |
160 | ], | |
161 | [AS_IF([test "x$with_systemd" = "xyes"], | |
162 | [AC_MSG_ERROR([Systemd support is enabled but no systemd has been found.]) | |
163 | ]) | |
164 | ]) | |
165 | ||
166 | AM_CONDITIONAL(HAVE_SYSTEMD, [test "x$have_systemd" = "xyes"]) | |
167 | ||
168 | # ------------------------------------------------------------------------------ | |
169 | ||
170 | # Python | |
171 | AM_PATH_PYTHON([3.4]) | |
172 | PKG_CHECK_MODULES([PYTHON], [python-${PYTHON_VERSION}]) | |
173 | ||
174 | # Perl | |
175 | AC_PATH_PROG(PERL, perl, no) | |
176 | AC_SUBST(PERL) | |
177 | ||
178 | AX_PROG_PERL_MODULES(Config ExtUtils::MakeMaker,, AC_MSG_WARN(Need some Perl modules)) | |
179 | ||
180 | AC_ARG_ENABLE(perl, AS_HELP_STRING([--disable-perl], [do not build the perl modules]), [],[enable_perl=yes]) | |
181 | AM_CONDITIONAL(ENABLE_PERL, test "$enable_perl" = "yes") | |
182 | AS_IF([test "$enable_perl" = "yes"], | |
183 | [ | |
184 | PERL_MODPATH=$($PERL -MConfig -e 'print $Config{installvendorarch}') | |
185 | PERL_MANPATH=$($PERL -MConfig -e 'print $Config{installvendorman3dir}') | |
186 | AC_SUBST(PERL_MODPATH) | |
187 | AC_SUBST(PERL_MANPATH) | |
188 | ], | |
189 | ) | |
190 | ||
191 | dnl Checking for libresolv | |
192 | case "${host}" in | |
193 | *-gnu*) | |
194 | AC_CHECK_LIB(resolv, ns_msg_getflag, [LIBS="-lresolv $LIBS"], AC_MSG_ERROR([libresolv has not been found]), -lresolv) | |
195 | ;; | |
196 | *) | |
197 | AC_CHECK_LIB(resolv, res_init, [LIBS="-lresolv $LIBS"], AC_MSG_ERROR([libresolv has not been found]), -lresolv) | |
198 | ;; | |
199 | esac | |
200 | RESOLV_LIBS="${LIBS}" | |
201 | AC_SUBST(RESOLV_LIBS) | |
202 | ||
203 | dnl Checking for OpenSSL | |
204 | LIBS= | |
205 | AC_CHECK_LIB(crypto, EVP_EncryptInit,, AC_MSG_ERROR([libcrypto has not been found])) | |
206 | OPENSSL_LIBS="${LIBS}" | |
207 | AC_SUBST(OPENSSL_LIBS) | |
208 | ||
209 | AC_CONFIG_HEADERS(config.h) | |
210 | AC_CONFIG_FILES([ | |
211 | Makefile | |
212 | po/Makefile.in | |
213 | ]) | |
214 | ||
215 | AC_OUTPUT | |
216 | AC_MSG_RESULT([ | |
217 | $PACKAGE $VERSION | |
218 | ===== | |
219 | ||
220 | prefix: ${prefix} | |
221 | sysconfdir: ${sysconfdir} | |
222 | libdir: ${libdir} | |
223 | includedir: ${includedir} | |
224 | ||
225 | compiler: ${CC} | |
226 | cflags: ${CFLAGS} | |
227 | ldflags: ${LDFLAGS} | |
228 | ||
229 | database path: ${with_database_path} | |
230 | debug: ${enable_debug} | |
231 | systemd support: ${have_systemd} | |
232 | ||
233 | Bindings: | |
234 | Perl: ${enable_perl} | |
235 | Perl module path: ${PERL_MODPATH} | |
236 | Perl manual path: ${PERL_MANPATH} | |
237 | ]) |