]> git.ipfire.org Git - location/libloc.git/blame - configure.ac
location-importer.in: Conduct sanity checks per DROP list
[location/libloc.git] / configure.ac
CommitLineData
46aded9a
MT
1AC_PREREQ(2.60)
2AC_INIT([libloc],
ab8a1787 3 [0.9.15],
3b4f1368 4 [location@lists.ipfire.org],
46aded9a 5 [libloc],
3b4f1368 6 [https://location.ipfire.org/])
46aded9a
MT
7
8AC_CONFIG_SRCDIR([src/libloc.c])
9AC_CONFIG_AUX_DIR([build-aux])
10AM_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])
45197e29 21AC_PROG_CC
46aded9a
MT
22AC_USE_SYSTEM_EXTENSIONS
23AC_SYS_LARGEFILE
24AC_CONFIG_MACRO_DIR([m4])
25AM_SILENT_RULES([yes])
26LT_INIT([
27 disable-static
28 pic-only
29])
30AC_PREFIX_DEFAULT([/usr])
a76b0b96 31gl_LD_VERSION_SCRIPT
46aded9a 32
2bb7d64e 33IT_PROG_INTLTOOL([0.40.0])
7b76dffa
MT
34
35# Interpret embedded Python in HTML files
36XGETTEXT="${XGETTEXT} -L Python --keyword=_:1,2 --keyword=N_:1,2 --no-location"
37
2bb7d64e
MT
38GETTEXT_PACKAGE=${PACKAGE_TARNAME}
39AC_SUBST(GETTEXT_PACKAGE)
40
46aded9a
MT
41AC_PROG_SED
42AC_PROG_MKDIR_P
43
161ac92d
MT
44# - man ------------------------------------------------------------------------
45
5b4bd18a
MT
46have_man_pages=no
47AC_ARG_ENABLE(man_pages, AS_HELP_STRING([--disable-man-pages],
161ac92d 48 [do not install man pages]))
5b4bd18a
MT
49AS_IF([test "x$enable_man_pages" != xno], [have_man_pages=yes])
50AM_CONDITIONAL(ENABLE_MAN_PAGES, [test "x$have_man_pages" = "xyes"])
161ac92d
MT
51
52AC_PATH_PROG([XSLTPROC], [xsltproc])
53
54AC_CHECK_PROGS(ASCIIDOC, [asciidoc])
5b4bd18a 55if test "${have_man_pages}" = "yes" && test -z "${ASCIIDOC}"; then
161ac92d
MT
56 AC_MSG_ERROR([Required program 'asciidoc' not found])
57fi
58# - debug ----------------------------------------------------------------------
59
46aded9a
MT
60AC_ARG_ENABLE([debug],
61 AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
62 [], [enable_debug=no])
63AS_IF([test "x$enable_debug" = "xyes"], [
64 AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
65])
66
dda7cfb5
MT
67AC_CHECK_HEADERS_ONCE([
68 arpa/inet.h \
f7b7019a
MT
69 arpa/nameser.h \
70 arpa/nameser_compat.h \
dda7cfb5
MT
71 endian.h \
72 netinet/in.h \
f4fef543 73 resolv.h \
dda7cfb5
MT
74 string.h \
75])
76
46aded9a 77AC_CHECK_FUNCS([ \
f4fef543
MT
78 be16toh \
79 be32toh \
80 be64toh \
81 htobe16 \
82 htobe32 \
83 htobe64 \
9294469c 84 madvise \
f4fef543
MT
85 mmap \
86 munmap \
87 res_query \
46aded9a 88 __secure_getenv \
a5db3e49 89 secure_getenv \
f4fef543 90 qsort \
46aded9a
MT
91])
92
93my_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"
106AC_SUBST([my_CFLAGS])
1c75dcbb 107AC_SUBST([my_LDFLAGS])
46aded9a 108
40ae2a9c
MT
109# Enable -fanalyzer if requested
110AC_ARG_ENABLE([analyzer],
111 AS_HELP_STRING([--enable-analyzer], [enable static analyzer (-fanalyzer) @<:@default=disabled@:>@]),
112 [], [enable_analyzer=no])
113AS_IF([test "x$enable_analyzer" = "xyes"],
114 CC_CHECK_FLAGS_APPEND([my_CFLAGS], [CFLAGS], [-fanalyzer])
115)
116
1c75dcbb
MT
117# Enable -fno-semantic-interposition (if available)
118CC_CHECK_FLAGS_APPEND([my_CFLAGS], [CFLAGS], [-fno-semantic-interposition])
119CC_CHECK_FLAGS_APPEND([my_LDFLAGS], [LDFLAGS], [-fno-semantic-interposition])
120
be748fa8
MT
121# ------------------------------------------------------------------------------
122
a0e8d454
MT
123AC_ARG_WITH([database-path],
124 AS_HELP_STRING([--with-database-path], [The default database path]),
125 [], [with_database_path=/var/lib/${PACKAGE_NAME}/database.db]
126)
127
128if test -z "${with_database_path}"; then
129 AC_MSG_ERROR([The default database path is empty])
130fi
131
132AC_DEFINE_UNQUOTED([LIBLOC_DEFAULT_DATABASE_PATH], ["${with_database_path}"],
133 [The default path for the database])
134AC_SUBST([DEFAULT_DATABASE_PATH], [${with_database_path}])
135
be748fa8
MT
136AC_ARG_WITH([systemd],
137 AS_HELP_STRING([--with-systemd], [Enable systemd support.])
138)
139
140AS_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
146AS_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
166AM_CONDITIONAL(HAVE_SYSTEMD, [test "x$have_systemd" = "xyes"])
167
168# ------------------------------------------------------------------------------
169
18e2b14c 170# Python
1cd4ddbc 171AM_PATH_PYTHON([3.4])
18e2b14c
MT
172PKG_CHECK_MODULES([PYTHON], [python-${PYTHON_VERSION}])
173
747cbcb1
MT
174# Perl
175AC_PATH_PROG(PERL, perl, no)
176AC_SUBST(PERL)
177
178AX_PROG_PERL_MODULES(ExtUtils::MakeMaker,, AC_MSG_WARN(Need some Perl modules))
179
180AC_ARG_ENABLE(perl, AS_HELP_STRING([--disable-perl], [do not build the perl modules]), [],[enable_perl=yes])
181AM_CONDITIONAL(ENABLE_PERL, test "$enable_perl" = "yes")
182
f4fef543 183dnl Checking for libresolv
f60ee33f
MT
184case "${host}" in
185 *-gnu*)
186 AC_CHECK_LIB(resolv, ns_msg_getflag, [LIBS="-lresolv $LIBS"], AC_MSG_ERROR([libresolv has not been found]), -lresolv)
187 ;;
188 *)
189 AC_CHECK_LIB(resolv, res_init, [LIBS="-lresolv $LIBS"], AC_MSG_ERROR([libresolv has not been found]), -lresolv)
190 ;;
191esac
f4fef543 192RESOLV_LIBS="${LIBS}"
18ecd261 193AC_SUBST(RESOLV_LIBS)
f4fef543 194
e568f8d4
MT
195dnl Checking for OpenSSL
196LIBS=
197AC_CHECK_LIB(crypto, EVP_EncryptInit,, AC_MSG_ERROR([libcrypto has not been found]))
198OPENSSL_LIBS="${LIBS}"
18ecd261 199AC_SUBST(OPENSSL_LIBS)
e568f8d4 200
46aded9a
MT
201AC_CONFIG_HEADERS(config.h)
202AC_CONFIG_FILES([
203 Makefile
2bb7d64e 204 po/Makefile.in
46aded9a
MT
205])
206
207AC_OUTPUT
208AC_MSG_RESULT([
209 $PACKAGE $VERSION
210 =====
211
212 prefix: ${prefix}
213 sysconfdir: ${sysconfdir}
214 libdir: ${libdir}
215 includedir: ${includedir}
216
217 compiler: ${CC}
218 cflags: ${CFLAGS}
219 ldflags: ${LDFLAGS}
220
a0e8d454 221 database path: ${with_database_path}
46aded9a 222 debug: ${enable_debug}
be748fa8 223 systemd support: ${have_systemd}
747cbcb1
MT
224
225 Bindings:
226 perl: ${enable_perl}
46aded9a 227])