1# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4# This file is part of nss-mdns.
5#
6# nss-mdns is free software; you can redistribute it and/or modify it
7# under the terms of the GNU Lesser General Public License as
8# published by the Free Software Foundation; either version 2 of the
9# License, or (at your option) any later version.
10#
11# nss-mdns is distributed in the hope that it will be useful, but
12# WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14# General Public License for more details.
15#
16# You should have received a copy of the GNU Lesser General Public
17# License along with nss-mdns; if not, write to the Free Software
18# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19
20AC_PREREQ([2.69])
21AC_INIT([nss-mdns],[0.14.1],[https://github.com/lathiat/nss-mdns/issues])
22AC_CONFIG_SRCDIR([src/nss.c])
23AC_CONFIG_HEADERS([config.h])
24AM_INIT_AUTOMAKE([foreign 1.9 -Wall subdir-objects])
25AC_CONFIG_MACRO_DIRS([m4])
26
27AC_SUBST(PACKAGE_URL, [https://github.com/lathiat/nss-mdns])
28
29AC_PREFIX_DEFAULT([])
30
31AC_USE_SYSTEM_EXTENSIONS
32
33AM_SILENT_RULES([yes])
34
35# Conditionally enable unittests.
36AC_ARG_ENABLE([tests],
37  AS_HELP_STRING([--disable-tests],
38                 [disable building tests]))
39
40AS_IF([test "x$enable_tests" != "xno"],
41      [PKG_CHECK_MODULES([CHECK], [check >= 0.11],
42                         [have_check=yes], [have_check=no])],
43      [have_check=no])
44
45AS_IF([test "x$have_check" = "xyes"],
46      [],
47      [AS_IF([test "x$enable_tests" = "xyes"],
48           [AC_MSG_ERROR([Cannot enable tests: $CHECK_PKG_ERRORS])
49    ])
50])
51
52AM_CONDITIONAL([ENABLE_TESTS], [test "x$have_check" = "xyes"])
53
54# Options for file locations.
55AC_ARG_VAR([AVAHI_SOCKET],
56           [Full path to the avahi-daemon socket, overriding default])
57AS_IF([test "x$AVAHI_SOCKET" = x],
58      [AVAHI_SOCKET="${localstatedir}/run/avahi-daemon/socket"])
59
60AC_ARG_VAR([MDNS_ALLOW_FILE],
61           [Full path to the mdns.allow file, overriding default])
62AS_IF([test "x$MDNS_ALLOW_FILE" = x],
63      [MDNS_ALLOW_FILE="${sysconfdir}/mdns.allow"])
64
65# Checks for programs.
66AM_PROG_AR
67AC_PROG_CC
68AC_PROG_CPP
69AC_PROG_INSTALL
70AC_PROG_LN_S
71AC_PROG_MAKE_SET
72
73# libtool stuff
74AC_DISABLE_STATIC
75LT_INIT
76
77# Checks for header files.
78AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h sys/time.h unistd.h nss.h sys/ioctl.h])
79
80# Enable C99.
81AC_PROG_CC_C99
82
83# Checks for library functions.
84AC_SEARCH_LIBS([__res_nquery], [resolv])
85AC_CHECK_FUNCS([gethostbyaddr gethostbyname gettimeofday inet_ntoa memset select socket strcspn strdup strerror strncasecmp strcasecmp strspn])
86
87# FreeBSD has a slightly different NSS interface
88case ${host} in
89     *-dragonfly*|*-freebsd*) freebsd="yes" ;;
90esac
91
92AM_CONDITIONAL([FREEBSD_NSS], [test "x$freebsd" = "xyes"])
93
94AC_CONFIG_FILES([Makefile])
95AC_OUTPUT
96