]> git.ipfire.org Git - location/libloc.git/blob - configure.ac
Bump version to 0.9.12
[location/libloc.git] / configure.ac
1 AC_PREREQ(2.60)
2 AC_INIT([libloc],
3 [0.9.12],
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_STDC
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 mmap \
85 munmap \
86 res_query \
87 __secure_getenv \
88 secure_getenv \
89 qsort \
90 ])
91
92 my_CFLAGS="\
93 -Wall \
94 -Wchar-subscripts \
95 -Wformat-security \
96 -Wmissing-declarations \
97 -Wmissing-prototypes \
98 -Wnested-externs \
99 -Wpointer-arith \
100 -Wshadow \
101 -Wsign-compare \
102 -Wstrict-prototypes \
103 -Wtype-limits \
104 "
105 AC_SUBST([my_CFLAGS])
106 AC_SUBST([my_LDFLAGS])
107
108 # Enable -fanalyzer if requested
109 AC_ARG_ENABLE([analyzer],
110 AS_HELP_STRING([--enable-analyzer], [enable static analyzer (-fanalyzer) @<:@default=disabled@:>@]),
111 [], [enable_analyzer=no])
112 AS_IF([test "x$enable_analyzer" = "xyes"],
113 CC_CHECK_FLAGS_APPEND([my_CFLAGS], [CFLAGS], [-fanalyzer])
114 )
115
116 # Enable -fno-semantic-interposition (if available)
117 CC_CHECK_FLAGS_APPEND([my_CFLAGS], [CFLAGS], [-fno-semantic-interposition])
118 CC_CHECK_FLAGS_APPEND([my_LDFLAGS], [LDFLAGS], [-fno-semantic-interposition])
119
120 # ------------------------------------------------------------------------------
121
122 AC_ARG_WITH([systemd],
123 AS_HELP_STRING([--with-systemd], [Enable systemd support.])
124 )
125
126 AS_IF([test "x$with_systemd" != "xno"],
127 [PKG_CHECK_MODULES(systemd, [libsystemd],
128 [have_systemd=yes], [have_systemd=no])],
129 [have_systemd=no]
130 )
131
132 AS_IF([test "x$have_systemd" = "xyes"],
133 [AC_MSG_CHECKING([for systemd system unit directory])
134 AC_ARG_WITH([systemdsystemunitdir],
135 AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
136 [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)]
137 )
138
139 AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
140
141 if test -n "$systemdsystemunitdir" -a "x$systemdsystemunitdir" != xno; then
142 AC_MSG_RESULT([$systemdsystemunitdir])
143 else
144 AC_MSG_ERROR([not found (try --with-systemdsystemunitdir)])
145 fi
146 ],
147 [AS_IF([test "x$with_systemd" = "xyes"],
148 [AC_MSG_ERROR([Systemd support is enabled but no systemd has been found.])
149 ])
150 ])
151
152 AM_CONDITIONAL(HAVE_SYSTEMD, [test "x$have_systemd" = "xyes"])
153
154 # ------------------------------------------------------------------------------
155
156 # Python
157 AM_PATH_PYTHON([3.4])
158 PKG_CHECK_MODULES([PYTHON], [python-${PYTHON_VERSION}])
159
160 # Perl
161 AC_PATH_PROG(PERL, perl, no)
162 AC_SUBST(PERL)
163
164 AX_PROG_PERL_MODULES(ExtUtils::MakeMaker,, AC_MSG_WARN(Need some Perl modules))
165
166 AC_ARG_ENABLE(perl, AS_HELP_STRING([--disable-perl], [do not build the perl modules]), [],[enable_perl=yes])
167 AM_CONDITIONAL(ENABLE_PERL, test "$enable_perl" = "yes")
168
169 dnl Checking for libresolv
170 case "${host}" in
171 *-gnu*)
172 AC_CHECK_LIB(resolv, ns_msg_getflag, [LIBS="-lresolv $LIBS"], AC_MSG_ERROR([libresolv has not been found]), -lresolv)
173 ;;
174 *)
175 AC_CHECK_LIB(resolv, res_init, [LIBS="-lresolv $LIBS"], AC_MSG_ERROR([libresolv has not been found]), -lresolv)
176 ;;
177 esac
178 RESOLV_LIBS="${LIBS}"
179 AC_SUBST(RESOLV_LIBS)
180
181 dnl Checking for OpenSSL
182 LIBS=
183 AC_CHECK_LIB(crypto, EVP_EncryptInit,, AC_MSG_ERROR([libcrypto has not been found]))
184 OPENSSL_LIBS="${LIBS}"
185 AC_SUBST(OPENSSL_LIBS)
186
187 AC_CONFIG_HEADERS(config.h)
188 AC_CONFIG_FILES([
189 Makefile
190 po/Makefile.in
191 ])
192
193 AC_OUTPUT
194 AC_MSG_RESULT([
195 $PACKAGE $VERSION
196 =====
197
198 prefix: ${prefix}
199 sysconfdir: ${sysconfdir}
200 libdir: ${libdir}
201 includedir: ${includedir}
202
203 compiler: ${CC}
204 cflags: ${CFLAGS}
205 ldflags: ${LDFLAGS}
206
207 debug: ${enable_debug}
208 systemd support: ${have_systemd}
209
210 Bindings:
211 perl: ${enable_perl}
212 ])