]>
Commit | Line | Data |
---|---|---|
46aded9a MT |
1 | AC_PREREQ(2.60) |
2 | AC_INIT([libloc], | |
3 | [0], | |
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 \ | |
f4fef543 | 65 | arpa/nameser.h \ |
dda7cfb5 MT |
66 | endian.h \ |
67 | netinet/in.h \ | |
f4fef543 | 68 | resolv.h \ |
dda7cfb5 MT |
69 | string.h \ |
70 | ]) | |
71 | ||
46aded9a | 72 | AC_CHECK_FUNCS([ \ |
f4fef543 MT |
73 | be16toh \ |
74 | be32toh \ | |
75 | be64toh \ | |
76 | htobe16 \ | |
77 | htobe32 \ | |
78 | htobe64 \ | |
79 | mmap \ | |
80 | munmap \ | |
81 | res_query \ | |
46aded9a | 82 | __secure_getenv \ |
a5db3e49 | 83 | secure_getenv \ |
f4fef543 | 84 | qsort \ |
46aded9a MT |
85 | ]) |
86 | ||
87 | my_CFLAGS="\ | |
88 | -Wall \ | |
89 | -Wchar-subscripts \ | |
90 | -Wformat-security \ | |
91 | -Wmissing-declarations \ | |
92 | -Wmissing-prototypes \ | |
93 | -Wnested-externs \ | |
94 | -Wpointer-arith \ | |
95 | -Wshadow \ | |
96 | -Wsign-compare \ | |
97 | -Wstrict-prototypes \ | |
98 | -Wtype-limits \ | |
99 | " | |
100 | AC_SUBST([my_CFLAGS]) | |
101 | ||
be748fa8 MT |
102 | # ------------------------------------------------------------------------------ |
103 | ||
104 | AC_ARG_WITH([systemd], | |
105 | AS_HELP_STRING([--with-systemd], [Enable systemd support.]) | |
106 | ) | |
107 | ||
108 | AS_IF([test "x$with_systemd" != "xno"], | |
109 | [PKG_CHECK_MODULES(systemd, [libsystemd], | |
110 | [have_systemd=yes], [have_systemd=no])], | |
111 | [have_systemd=no] | |
112 | ) | |
113 | ||
114 | AS_IF([test "x$have_systemd" = "xyes"], | |
115 | [AC_MSG_CHECKING([for systemd system unit directory]) | |
116 | AC_ARG_WITH([systemdsystemunitdir], | |
117 | AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), | |
118 | [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)] | |
119 | ) | |
120 | ||
121 | AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) | |
122 | ||
123 | if test -n "$systemdsystemunitdir" -a "x$systemdsystemunitdir" != xno; then | |
124 | AC_MSG_RESULT([$systemdsystemunitdir]) | |
125 | else | |
126 | AC_MSG_ERROR([not found (try --with-systemdsystemunitdir)]) | |
127 | fi | |
128 | ], | |
129 | [AS_IF([test "x$with_systemd" = "xyes"], | |
130 | [AC_MSG_ERROR([Systemd support is enabled but no systemd has been found.]) | |
131 | ]) | |
132 | ]) | |
133 | ||
134 | AM_CONDITIONAL(HAVE_SYSTEMD, [test "x$have_systemd" = "xyes"]) | |
135 | ||
136 | # ------------------------------------------------------------------------------ | |
137 | ||
18e2b14c MT |
138 | # Python |
139 | AM_PATH_PYTHON([3.4]) | |
140 | PKG_CHECK_MODULES([PYTHON], [python-${PYTHON_VERSION}]) | |
141 | ||
747cbcb1 MT |
142 | # Perl |
143 | AC_PATH_PROG(PERL, perl, no) | |
144 | AC_SUBST(PERL) | |
145 | ||
146 | AX_PROG_PERL_MODULES(ExtUtils::MakeMaker,, AC_MSG_WARN(Need some Perl modules)) | |
147 | ||
148 | AC_ARG_ENABLE(perl, AS_HELP_STRING([--disable-perl], [do not build the perl modules]), [],[enable_perl=yes]) | |
149 | AM_CONDITIONAL(ENABLE_PERL, test "$enable_perl" = "yes") | |
150 | ||
f4fef543 MT |
151 | dnl Checking for libresolv |
152 | AC_CHECK_LIB(resolv, ns_msg_getflag, [LIBS="-lresolv $LIBS"], AC_MSG_ERROR([libresolv has not been found]), -lresolv) | |
153 | RESOLV_LIBS="${LIBS}" | |
154 | ||
46aded9a MT |
155 | AC_CONFIG_HEADERS(config.h) |
156 | AC_CONFIG_FILES([ | |
157 | Makefile | |
2bb7d64e | 158 | po/Makefile.in |
46aded9a MT |
159 | ]) |
160 | ||
161 | AC_OUTPUT | |
162 | AC_MSG_RESULT([ | |
163 | $PACKAGE $VERSION | |
164 | ===== | |
165 | ||
166 | prefix: ${prefix} | |
167 | sysconfdir: ${sysconfdir} | |
168 | libdir: ${libdir} | |
169 | includedir: ${includedir} | |
170 | ||
171 | compiler: ${CC} | |
172 | cflags: ${CFLAGS} | |
173 | ldflags: ${LDFLAGS} | |
174 | ||
46aded9a | 175 | debug: ${enable_debug} |
be748fa8 | 176 | systemd support: ${have_systemd} |
747cbcb1 MT |
177 | |
178 | Bindings: | |
179 | perl: ${enable_perl} | |
46aded9a | 180 | ]) |