2013-07-30 14:55:09 -05:00
|
|
|
# -*- Autoconf -*-
|
|
|
|
# Process this file with autoconf to produce a configure script.
|
2013-08-08 20:14:43 -05:00
|
|
|
# known to work with autconf version: autoconf (GNU Autoconf) 2.69
|
|
|
|
#
|
2013-07-30 14:55:09 -05:00
|
|
|
# @configure_input@
|
|
|
|
#
|
|
|
|
|
2013-11-29 08:41:06 -06:00
|
|
|
AC_PREREQ([2.56])
|
2014-01-22 18:55:04 -06:00
|
|
|
AC_INIT([getdns], [0.1.0], [stub-resolver@verisignlabs.com])
|
2013-08-15 09:16:15 -05:00
|
|
|
AC_CONFIG_SRCDIR([src/getdns/getdns.h])
|
2013-10-07 10:08:41 -05:00
|
|
|
# AM_INIT_AUTOMAKE
|
|
|
|
# LT_INIT
|
2013-08-08 20:14:43 -05:00
|
|
|
AC_CONFIG_MACRO_DIR([m4])
|
2013-07-30 14:55:09 -05:00
|
|
|
|
2013-11-29 10:10:09 -06:00
|
|
|
AC_PROG_CC
|
|
|
|
AC_PROG_CPP
|
|
|
|
|
2013-07-30 14:55:09 -05:00
|
|
|
# Checks for programs.
|
2013-10-07 10:08:41 -05:00
|
|
|
AC_CANONICAL_HOST
|
|
|
|
case "$host_os" in
|
|
|
|
linux* ) CFLAGS="$CFLAGS -D_XOPEN_SOURCE=501" # unfortunate, but needed to
|
|
|
|
# pick up strdup() declaration
|
|
|
|
# in <string.h>
|
2013-12-09 02:49:28 -06:00
|
|
|
;;
|
|
|
|
solaris* ) CFLAGS="$CFLAGS -D__EXTENSIONS__" # for strdup() from <string.h>
|
|
|
|
;;
|
2013-10-07 10:08:41 -05:00
|
|
|
esac
|
|
|
|
|
2013-11-29 08:41:06 -06:00
|
|
|
# always use ./libtool unless override from commandline (libtool=mylibtool)
|
|
|
|
if test -z "$libtool"; then
|
|
|
|
libtool="`pwd`/libtool"
|
|
|
|
fi
|
|
|
|
AC_SUBST(libtool)
|
|
|
|
AC_PROG_LIBTOOL
|
|
|
|
AC_PROG_INSTALL
|
|
|
|
|
|
|
|
dnl Add option to disable the evil rpath. Check whether to use rpath or not.
|
|
|
|
dnl Adds the --disable-rpath option. Uses trick to edit the ./libtool.
|
|
|
|
AC_DEFUN([ACX_ARG_RPATH],
|
|
|
|
[
|
|
|
|
AC_ARG_ENABLE(rpath,
|
|
|
|
[ --disable-rpath disable hardcoded rpath (default=enabled)],
|
|
|
|
enable_rpath=$enableval, enable_rpath=yes)
|
|
|
|
if test "x$enable_rpath" = xno; then
|
|
|
|
dnl AC_MSG_RESULT([Fixing libtool for -rpath problems.])
|
|
|
|
AC_CONFIG_COMMANDS([disable-rpath], [
|
|
|
|
sed < libtool > libtool-2 \
|
|
|
|
's/^hardcode_libdir_flag_spec.*$'/'hardcode_libdir_flag_spec=" -D__LIBTOOL_RPATH_SED__ "/'
|
|
|
|
mv libtool-2 libtool
|
|
|
|
chmod 755 libtool
|
|
|
|
libtool="./libtool"
|
|
|
|
])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
ACX_ARG_RPATH
|
|
|
|
|
2013-11-29 10:03:01 -06:00
|
|
|
# search to set include and library paths right
|
|
|
|
# find libidn
|
|
|
|
AC_ARG_WITH(libidn, AC_HELP_STRING([--with-libidn=pathname],
|
|
|
|
[path to libidn (default: search /usr/local ..)]),
|
|
|
|
[], [withval="yes"])
|
|
|
|
if test x_$withval = x_yes; then
|
|
|
|
for dir in /usr/local /opt/local /usr/pkg /usr/sfw; do
|
|
|
|
if test -f "$dir/include/idna.h"; then
|
2013-11-29 10:10:09 -06:00
|
|
|
CFLAGS="$CFLAGS -I$dir/include"
|
2013-11-29 10:03:01 -06:00
|
|
|
LDFLAGS="$LDFLAGS -L$dir/lib"
|
|
|
|
AC_MSG_NOTICE([Found libidn in $dir])
|
|
|
|
break
|
|
|
|
fi
|
2013-12-03 04:45:42 -06:00
|
|
|
if test -f "$dir/include/idn/idna.h"; then
|
|
|
|
CFLAGS="$CFLAGS -I$dir/include/idn"
|
|
|
|
LDFLAGS="$LDFLAGS -L$dir/lib"
|
|
|
|
AC_MSG_NOTICE([Found libidn in $dir])
|
|
|
|
break
|
|
|
|
fi
|
2013-11-29 10:03:01 -06:00
|
|
|
done
|
2013-12-03 04:45:42 -06:00
|
|
|
if test -f "/usr/include/idn/idna.h"; then
|
|
|
|
CFLAGS="$CFLAGS -I/usr/include/idn"
|
|
|
|
#LDFLAGS="$LDFLAGS -L/usr/lib"
|
|
|
|
AC_MSG_NOTICE([Found libidn in /usr])
|
|
|
|
fi
|
2013-11-29 10:10:09 -06:00
|
|
|
else
|
|
|
|
if test x_$withval != x_no; then
|
|
|
|
CFLAGS="$CFLAGS -I$withval/include"
|
|
|
|
LDFLAGS="$LDFLAGS -L$withval/lib"
|
|
|
|
fi
|
2013-11-29 10:03:01 -06:00
|
|
|
fi
|
|
|
|
|
|
|
|
# find libldns
|
|
|
|
AC_ARG_WITH(libldns, AC_HELP_STRING([--with-libldns=pathname],
|
|
|
|
[path to libldns (default: search /usr/local ..)]),
|
|
|
|
[], [withval="yes"])
|
|
|
|
if test x_$withval = x_yes; then
|
|
|
|
for dir in /usr/local /opt/local /usr/pkg /usr/sfw; do
|
|
|
|
if test -f "$dir/include/ldns/ldns.h"; then
|
2013-11-29 10:10:09 -06:00
|
|
|
CFLAGS="$CFLAGS -I$dir/include"
|
2013-11-29 10:03:01 -06:00
|
|
|
LDFLAGS="$LDFLAGS -L$dir/lib"
|
|
|
|
AC_MSG_NOTICE([Found libldns in $dir])
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
2013-11-29 10:10:09 -06:00
|
|
|
else
|
|
|
|
if test x_$withval != x_no; then
|
|
|
|
CFLAGS="$CFLAGS -I$withval/include"
|
|
|
|
LDFLAGS="$LDFLAGS -L$withval/lib"
|
|
|
|
fi
|
2013-11-29 10:03:01 -06:00
|
|
|
fi
|
|
|
|
|
|
|
|
# find libunbound
|
|
|
|
AC_ARG_WITH(libunbound, AC_HELP_STRING([--with-libunbound=pathname],
|
|
|
|
[path to libunbound (default: search /usr/local ..)]),
|
|
|
|
[], [withval="yes"])
|
|
|
|
if test x_$withval = x_yes; then
|
|
|
|
for dir in /usr/local /opt/local /usr/pkg /usr/sfw; do
|
|
|
|
if test -f "$dir/include/unbound.h"; then
|
2013-11-29 10:10:09 -06:00
|
|
|
CFLAGS="$CFLAGS -I$dir/include"
|
2013-11-29 10:03:01 -06:00
|
|
|
LDFLAGS="$LDFLAGS -L$dir/lib"
|
|
|
|
AC_MSG_NOTICE([Found libunbound in $dir])
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
2013-11-29 10:10:09 -06:00
|
|
|
else
|
|
|
|
if test x_$withval != x_no; then
|
|
|
|
CFLAGS="$CFLAGS -I$withval/include"
|
|
|
|
LDFLAGS="$LDFLAGS -L$withval/lib"
|
|
|
|
fi
|
2013-11-29 10:03:01 -06:00
|
|
|
fi
|
|
|
|
|
2013-07-30 14:55:09 -05:00
|
|
|
# Checks for libraries.
|
2013-08-09 16:04:25 -05:00
|
|
|
found_all_libs=1
|
2014-01-22 18:55:04 -06:00
|
|
|
AC_MSG_NOTICE([Checking for dependencies ldns])
|
2013-08-09 16:04:25 -05:00
|
|
|
AC_CHECK_LIB([ldns], [ldns_dname_new_frm_str], [], [found_all_libs=0])
|
2013-11-25 19:40:38 -06:00
|
|
|
AC_CHECK_LIB([idn], [idna_to_ascii_8z], [], [found_all_libs=0])
|
|
|
|
|
2013-08-09 16:04:25 -05:00
|
|
|
if test $found_all_libs == 0
|
|
|
|
then
|
|
|
|
AC_MSG_ERROR([One more dependencies is missing])
|
|
|
|
fi
|
2013-07-30 14:55:09 -05:00
|
|
|
|
2014-01-21 14:31:22 -06:00
|
|
|
# break out libunbound from other libraries since we are currently using a
|
2013-11-03 15:40:24 -06:00
|
|
|
# patch to the sources
|
|
|
|
found_libunbound=1
|
|
|
|
AC_MSG_NOTICE([Checking for dependency libunbound])
|
2014-01-21 14:31:22 -06:00
|
|
|
AC_CHECK_LIB([unbound], [ub_fd], [], [found_libunbound=0])
|
2013-11-03 15:40:24 -06:00
|
|
|
if test $found_libunbound == 0
|
|
|
|
then
|
2014-01-21 14:31:22 -06:00
|
|
|
AC_MSG_ERROR([libunbound is missing.])
|
2013-11-03 15:40:24 -06:00
|
|
|
fi
|
|
|
|
|
2013-10-10 18:15:17 -05:00
|
|
|
AC_CHECK_PROGS([DOXYGEN], [doxygen])
|
|
|
|
if test -z "$DOXYGEN";
|
|
|
|
then AC_MSG_WARN([Doxygen not found, continuing without])
|
|
|
|
fi
|
2013-10-07 10:08:41 -05:00
|
|
|
|
2013-07-30 14:55:09 -05:00
|
|
|
# Checks for header files.
|
2013-12-03 05:13:10 -06:00
|
|
|
AC_CHECK_HEADERS([inttypes.h netinet/in.h stdint.h stdlib.h string.h event2/event.h],,, [AC_INCLUDES_DEFAULT])
|
2013-07-30 14:55:09 -05:00
|
|
|
|
|
|
|
# Checks for typedefs, structures, and compiler characteristics.
|
|
|
|
AC_TYPE_SIZE_T
|
|
|
|
AC_TYPE_UINT16_T
|
|
|
|
AC_TYPE_UINT32_T
|
|
|
|
AC_TYPE_UINT64_T
|
|
|
|
AC_TYPE_UINT8_T
|
|
|
|
|
2014-01-22 18:55:04 -06:00
|
|
|
have_libevent=1
|
|
|
|
AC_SEARCH_LIBS([event_loop],
|
|
|
|
[event_core event],
|
|
|
|
[AC_DEFINE([HAVE_LIBEVENT], [1], [Define to 1 to enable the libevent extension])]
|
|
|
|
[AC_CHECK_FUNCS([event_base_new event_base_free])]
|
|
|
|
[AH_BOTTOM([
|
|
|
|
#ifndef HAVE_EVENT_BASE_FREE
|
|
|
|
#define event_base_free(x) /* nop */
|
|
|
|
#endif
|
|
|
|
#ifndef HAVE_EVENT_BASE_NEW
|
|
|
|
#define event_base_new event_init
|
|
|
|
#endif
|
|
|
|
])],
|
|
|
|
[have_libevent=0])
|
|
|
|
|
|
|
|
AC_SUBST(have_libevent)
|
2013-11-04 17:37:54 -06:00
|
|
|
AC_CONFIG_FILES([Makefile src/Makefile src/getdns/Makefile src/example/Makefile src/test/Makefile doc/Makefile])
|
2013-10-10 18:15:17 -05:00
|
|
|
if [ test -n "$DOXYGEN" ]
|
|
|
|
then AC_CONFIG_FILES([src/Doxyfile])
|
|
|
|
fi
|
2013-11-30 06:53:57 -06:00
|
|
|
AC_CONFIG_HEADER([src/config.h])
|
2013-07-30 14:55:09 -05:00
|
|
|
AC_OUTPUT
|