]>
Commit | Line | Data |
---|---|---|
46aded9a MT |
1 | AC_PREREQ(2.60) |
2 | AC_INIT([libloc], | |
b729df58 | 3 | [0.9.0], |
46aded9a MT |
4 | [michael.tremer@ipfire.org], |
5 | [libloc], | |
6 | [https://www.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]) | |
a76b0b96 | 31 | gl_LD_VERSION_SCRIPT |
46aded9a | 32 | |
2bb7d64e MT |
33 | IT_PROG_INTLTOOL([0.40.0]) |
34 | GETTEXT_PACKAGE=${PACKAGE_TARNAME} | |
35 | AC_SUBST(GETTEXT_PACKAGE) | |
36 | ||
46aded9a MT |
37 | AC_PROG_SED |
38 | AC_PROG_MKDIR_P | |
39 | ||
161ac92d MT |
40 | # - man ------------------------------------------------------------------------ |
41 | ||
42 | have_manpages=no | |
43 | AC_ARG_ENABLE(manpages, AS_HELP_STRING([--disable-man-pages], | |
44 | [do not install man pages])) | |
45 | AS_IF([test "x$enable_manpages" != xno], [have_manpages=yes]) | |
46 | AM_CONDITIONAL(ENABLE_MANPAGES, [test "x$have_manpages" = "xyes"]) | |
47 | ||
48 | AC_PATH_PROG([XSLTPROC], [xsltproc]) | |
49 | ||
50 | AC_CHECK_PROGS(ASCIIDOC, [asciidoc]) | |
51 | if test "${have_manpages}" = "yes" && test -z "${ASCIIDOC}"; then | |
52 | AC_MSG_ERROR([Required program 'asciidoc' not found]) | |
53 | fi | |
54 | # - debug ---------------------------------------------------------------------- | |
55 | ||
46aded9a MT |
56 | AC_ARG_ENABLE([debug], |
57 | AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]), | |
58 | [], [enable_debug=no]) | |
59 | AS_IF([test "x$enable_debug" = "xyes"], [ | |
60 | AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.]) | |
61 | ]) | |
62 | ||
dda7cfb5 MT |
63 | AC_CHECK_HEADERS_ONCE([ |
64 | arpa/inet.h \ | |
f7b7019a MT |
65 | arpa/nameser.h \ |
66 | arpa/nameser_compat.h \ | |
dda7cfb5 MT |
67 | endian.h \ |
68 | netinet/in.h \ | |
f4fef543 | 69 | resolv.h \ |
dda7cfb5 MT |
70 | string.h \ |
71 | ]) | |
72 | ||
46aded9a | 73 | AC_CHECK_FUNCS([ \ |
f4fef543 MT |
74 | be16toh \ |
75 | be32toh \ | |
76 | be64toh \ | |
77 | htobe16 \ | |
78 | htobe32 \ | |
79 | htobe64 \ | |
80 | mmap \ | |
81 | munmap \ | |
82 | res_query \ | |
46aded9a | 83 | __secure_getenv \ |
a5db3e49 | 84 | secure_getenv \ |
f4fef543 | 85 | qsort \ |
46aded9a MT |
86 | ]) |
87 | ||
88 | my_CFLAGS="\ | |
89 | -Wall \ | |
90 | -Wchar-subscripts \ | |
91 | -Wformat-security \ | |
92 | -Wmissing-declarations \ | |
93 | -Wmissing-prototypes \ | |
94 | -Wnested-externs \ | |
95 | -Wpointer-arith \ | |
96 | -Wshadow \ | |
97 | -Wsign-compare \ | |
98 | -Wstrict-prototypes \ | |
99 | -Wtype-limits \ | |
100 | " | |
101 | AC_SUBST([my_CFLAGS]) | |
102 | ||
be748fa8 MT |
103 | # ------------------------------------------------------------------------------ |
104 | ||
105 | AC_ARG_WITH([systemd], | |
106 | AS_HELP_STRING([--with-systemd], [Enable systemd support.]) | |
107 | ) | |
108 | ||
109 | AS_IF([test "x$with_systemd" != "xno"], | |
110 | [PKG_CHECK_MODULES(systemd, [libsystemd], | |
111 | [have_systemd=yes], [have_systemd=no])], | |
112 | [have_systemd=no] | |
113 | ) | |
114 | ||
115 | AS_IF([test "x$have_systemd" = "xyes"], | |
116 | [AC_MSG_CHECKING([for systemd system unit directory]) | |
117 | AC_ARG_WITH([systemdsystemunitdir], | |
118 | AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), | |
119 | [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)] | |
120 | ) | |
121 | ||
122 | AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) | |
123 | ||
124 | if test -n "$systemdsystemunitdir" -a "x$systemdsystemunitdir" != xno; then | |
125 | AC_MSG_RESULT([$systemdsystemunitdir]) | |
126 | else | |
127 | AC_MSG_ERROR([not found (try --with-systemdsystemunitdir)]) | |
128 | fi | |
129 | ], | |
130 | [AS_IF([test "x$with_systemd" = "xyes"], | |
131 | [AC_MSG_ERROR([Systemd support is enabled but no systemd has been found.]) | |
132 | ]) | |
133 | ]) | |
134 | ||
135 | AM_CONDITIONAL(HAVE_SYSTEMD, [test "x$have_systemd" = "xyes"]) | |
136 | ||
137 | # ------------------------------------------------------------------------------ | |
138 | ||
18e2b14c MT |
139 | # Python |
140 | AM_PATH_PYTHON([3.4]) | |
141 | PKG_CHECK_MODULES([PYTHON], [python-${PYTHON_VERSION}]) | |
142 | ||
747cbcb1 MT |
143 | # Perl |
144 | AC_PATH_PROG(PERL, perl, no) | |
145 | AC_SUBST(PERL) | |
146 | ||
147 | AX_PROG_PERL_MODULES(ExtUtils::MakeMaker,, AC_MSG_WARN(Need some Perl modules)) | |
148 | ||
149 | AC_ARG_ENABLE(perl, AS_HELP_STRING([--disable-perl], [do not build the perl modules]), [],[enable_perl=yes]) | |
150 | AM_CONDITIONAL(ENABLE_PERL, test "$enable_perl" = "yes") | |
151 | ||
f4fef543 | 152 | dnl Checking for libresolv |
f60ee33f MT |
153 | case "${host}" in |
154 | *-gnu*) | |
155 | AC_CHECK_LIB(resolv, ns_msg_getflag, [LIBS="-lresolv $LIBS"], AC_MSG_ERROR([libresolv has not been found]), -lresolv) | |
156 | ;; | |
157 | *) | |
158 | AC_CHECK_LIB(resolv, res_init, [LIBS="-lresolv $LIBS"], AC_MSG_ERROR([libresolv has not been found]), -lresolv) | |
159 | ;; | |
160 | esac | |
f4fef543 MT |
161 | RESOLV_LIBS="${LIBS}" |
162 | ||
e568f8d4 MT |
163 | dnl Checking for OpenSSL |
164 | LIBS= | |
165 | AC_CHECK_LIB(crypto, EVP_EncryptInit,, AC_MSG_ERROR([libcrypto has not been found])) | |
166 | OPENSSL_LIBS="${LIBS}" | |
167 | ||
46aded9a MT |
168 | AC_CONFIG_HEADERS(config.h) |
169 | AC_CONFIG_FILES([ | |
170 | Makefile | |
2bb7d64e | 171 | po/Makefile.in |
46aded9a MT |
172 | ]) |
173 | ||
174 | AC_OUTPUT | |
175 | AC_MSG_RESULT([ | |
176 | $PACKAGE $VERSION | |
177 | ===== | |
178 | ||
179 | prefix: ${prefix} | |
180 | sysconfdir: ${sysconfdir} | |
181 | libdir: ${libdir} | |
182 | includedir: ${includedir} | |
183 | ||
184 | compiler: ${CC} | |
185 | cflags: ${CFLAGS} | |
186 | ldflags: ${LDFLAGS} | |
187 | ||
46aded9a | 188 | debug: ${enable_debug} |
be748fa8 | 189 | systemd support: ${have_systemd} |
747cbcb1 MT |
190 | |
191 | Bindings: | |
192 | perl: ${enable_perl} | |
46aded9a | 193 | ]) |