configure.ac 7.46 KB
Newer Older
1 2 3
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

4
AC_PREREQ([2.59])
5
AC_INIT(bind10, 10.0.0, bind10-bugs@isc.org)
6 7 8 9 10 11 12
AC_CONFIG_SRCDIR(README)
AM_INIT_AUTOMAKE
AC_CONFIG_HEADERS([config.h])

# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
13 14
AC_PROG_LIBTOOL

15 16 17 18
# Use C++ language
AC_LANG_CPLUSPLUS
AX_COMPILER_VENDOR

19 20 21
m4_define([_AM_PYTHON_INTERPRETER_LIST], [python python3 python3.1])
AM_PATH_PYTHON([3.1])

22 23
# default compiler warning settings
if test "X$GCC" = "Xyes"; then
24
CXXFLAGS="-g -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare"
25 26 27 28 29 30 31
fi

# produce PIC unless we disable shared libraries. need this for python bindings.
if test $enable_shared != "no" -a "X$GCC" = "Xyes"; then
   CXXFLAGS="$CXXFLAGS -fPIC"
fi

32 33
# Checks for libraries.

34 35 36
AC_SEARCH_LIBS(inet_pton, [nsl])
AC_SEARCH_LIBS(recvfrom, [socket])

37 38 39 40 41 42
# Checks for header files.

# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_TYPE_SIZE_T

43 44 45 46 47 48 49 50 51
AC_MSG_CHECKING(for sa_len in struct sockaddr)
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>],
[struct sockaddr sa; sa.sa_len = 0; return (0);],
        [AC_MSG_RESULT(yes)
        AC_DEFINE(HAVE_SIN_LEN, 1, Define to 1 if sockaddr_in has a sin_len member)],
        AC_MSG_RESULT(no))

52
AC_ARG_WITH(lcov,
53
[  --with-lcov[=PROGRAM]         enable gtest and coverage target using the specified lcov], lcov="$withval", lcov="no")
54

55
AC_ARG_WITH(gtest,
56
[  --with-gtest=PATH       specify a path to gtest header files (PATH/include) and library (PATH/lib)],
57
    gtest_path="$withval", gtest_path="no")
58 59 60 61 62 63


USE_LCOV="no"
if test "$lcov" != "no"; then
	# force gtest if not set
	if test "$gtest_path" = "no"; then
64 65
#		AC_MSG_ERROR("lcov needs gtest for test coverage report")
		AC_MSG_NOTICE([gtest support is now enabled, because used by coverage tests])
66 67 68
		gtest_path="yes"
	fi
	if test "$lcov" != "yes"; then
69
		LCOV=$lcov
70
	else
71
		AC_PATH_PROG([LCOV], [lcov])
72
	fi
73 74 75 76
	if test -x "${LCOV}"; then
		USE_LCOV="yes"
	else
		AC_MSG_ERROR([Cannot find lcov.])
77 78 79 80 81 82
	fi
	# is genhtml always in the same directory?
	GENHTML=`echo "$LCOV" | sed s/lcov$/genhtml/`
	if test ! -x $GENHTML; then
		AC_MSG_ERROR([genhtml not found, needed for lcov])
	fi
83
	# GCC specific?
84
	CXXFLAGS="$CXXFLAGS -fprofile-arcs -ftest-coverage"
85
	LIBS=" $LIBS -lgcov"
86 87 88 89 90 91 92
	AC_SUBST(CPPFLAGS)
	AC_SUBST(LIBS)
	AC_SUBST(LCOV)
	AC_SUBST(GENHTML)
fi
AC_SUBST(USE_LCOV)

93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
# Check availability of the Boost System library

AC_MSG_CHECKING([for boost::system library])
AC_ARG_WITH([boostlib],
AC_HELP_STRING([--with-boostlib=PATH],
  [specify a path to boost libraries if it is not automatically found]),
  [boostlib_path="$withval"], [boostlib_path="no"])
if test "$boostlib_path" != "no"; then
	BOOST_LDFLAGS="-L$boostlib_path"
fi

LDFLAGS_SAVED="$LDFLAGS"
LIBS_SAVED="$LIBS"
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -Iext"

for BOOST_TRY_LIB in boost_system boost_system-mt; do
	LDFLAGS="$LDFLAGS_SAVED ${BOOST_LDFLAGS}"
	LIBS="$LIBS_SAVED -l${BOOST_TRY_LIB}"
	AC_TRY_LINK([#include <boost/system/error_code.hpp>],
		[ boost::system::error_code error_code;
		  std::string message(error_code.message());
		  return 0; ],
116
	[ AC_MSG_RESULT(yes)
117 118 119 120 121 122 123 124 125
	  BOOST_SYSTEM_LIB="-l${BOOST_TRY_LIB}"
	  ],[])
	if test "X${BOOST_SYSTEM_LIB}" != X; then
        	break
	fi
done

if test "X${BOOST_SYSTEM_LIB}" = X; then
	AC_MSG_RESULT(not found)
126 127
else
	AC_DEFINE(HAVE_BOOSTLIB, 1, Define to 1 if boost libraries are available)
128 129
fi

130 131
AM_CONDITIONAL(HAVE_BOOSTLIB, test "X${BOOST_SYSTEM_LIB}" != X)
LDFLAGS="$LDFLAGS_SAVED"
132 133
CPPFLAGS="$CPPFLAGS_SAVED"
LIBS="$LIBS_SAVED"
134
AC_SUBST(BOOST_LDFLAGS)
135 136
AC_SUBST(BOOST_SYSTEM_LIB)

137
#
138
# Check availability of gtest, which will be used for unit tests.
139
#
140
if test "$gtest_path" != "no"
141
then
142 143
	if test "$gtest_path" != "yes"; then
		GTEST_PATHS=$gtest_path
144 145 146
		if test -x "${gtest_path}/bin/gtest-config" ; then
			GTEST_CONFIG="${gtest_path}/bin/gtest-config"
		fi
147
	else
148
		AC_PATH_PROG([GTEST_CONFIG], [gtest-config])
149
	fi
150 151 152 153 154 155 156 157 158 159
	if test -x "${GTEST_CONFIG}" ; then :
		# using cppflags instead of cxxflags
		GTEST_INCLUDES=`${GTEST_CONFIG} --cppflags`
		GTEST_LDFLAGS=`${GTEST_CONFIG} --ldflags`
		GTEST_LDADD=`${GTEST_CONFIG} --libs`
		GTEST_FOUND="true"
	else
		AC_MSG_WARN([Unable to locate Google Test gtest-config.])
		if test -z "${GTEST_PATHS}" ; then
			GTEST_PATHS="/usr /usr/local"
160
		fi
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
		GTEST_FOUND="false"
	fi
	if test "${GTEST_FOUND}" != "true"; then
		GTEST_FOUND="false"
		for dir in $GTEST_PATHS; do
			if test -f "$dir/include/gtest/gtest.h"; then
				GTEST_INCLUDES="-I$dir/include"
				GTEST_LDFLAGS="-L$dir/lib"
				GTEST_LDADD="-lgtest"
				GTEST_FOUND="true"
				break
			fi
		done
	fi
	if test "${GTEST_FOUND}" != "true"; then
176 177
		AC_MSG_ERROR([Cannot find gtest in: $GTEST_PATHS])
	fi
178
else
179 180 181
	GTEST_INCLUDES=
	GTEST_LDFLAGS=
	GTEST_LDADD=
182
fi
183 184 185 186
AM_CONDITIONAL(HAVE_GTEST, test $gtest_path != "no")
AC_SUBST(GTEST_INCLUDES)
AC_SUBST(GTEST_LDFLAGS)
AC_SUBST(GTEST_LDADD)
187

188
PKG_CHECK_MODULES(SQLITE, sqlite3 >= 3.3.9)
189

190 191 192 193
# Checks for library functions.

AC_CONFIG_FILES([Makefile
                 src/Makefile
194
                 src/bin/Makefile
195
                 src/bin/bind10/Makefile
Jelte Jansen's avatar
Jelte Jansen committed
196
                 src/bin/cmdctl/Makefile
Jeremy C. Reed's avatar
Jeremy C. Reed committed
197
                 src/bin/bindctl/Makefile
Jelte Jansen's avatar
Jelte Jansen committed
198
                 src/bin/cfgmgr/Makefile
199
                 src/bin/host/Makefile
Evan Hunt's avatar
Evan Hunt committed
200
                 src/bin/loadzone/Makefile
201
                 src/bin/msgq/Makefile
202
                 src/bin/auth/Makefile
Likun Zhang's avatar
Likun Zhang committed
203
                 src/bin/xfrin/Makefile
204
                 src/lib/Makefile
205
                 src/lib/cc/Makefile
Jeremy C. Reed's avatar
Jeremy C. Reed committed
206 207
                 src/lib/python/Makefile
                 src/lib/python/isc/Makefile
Evan Hunt's avatar
Evan Hunt committed
208
                 src/lib/python/isc/auth/Makefile
Jeremy C. Reed's avatar
Jeremy C. Reed committed
209 210 211
                 src/lib/python/isc/cc/Makefile
                 src/lib/python/isc/config/Makefile
                 src/lib/python/isc/Util/Makefile
212
                 src/lib/config/Makefile
Jelte Jansen's avatar
Jelte Jansen committed
213
                 src/lib/dns/Makefile
Jeremy C. Reed's avatar
Jeremy C. Reed committed
214
                 src/lib/dns/tests/Makefile
215
                 src/lib/exceptions/Makefile
216
                 src/lib/auth/Makefile
Jelte Jansen's avatar
Jelte Jansen committed
217
               ])
218
AC_OUTPUT([src/bin/cfgmgr/b10-cfgmgr.py
219
           src/bin/cmdctl/cmdctl.py
220
           src/bin/cmdctl/run_b10-cmdctl.sh
221
           src/bin/cmdctl/unittest/cmdctl_test
Likun Zhang's avatar
Likun Zhang committed
222 223 224
           src/bin/xfrin/unittest/xfrin_test
           src/bin/xfrin/xfrin.py
           src/bin/xfrin/run_b10-xfrin.sh
225
           src/bin/bind10/bind10.py
226
           src/bin/bind10/tests/bind10_test
227
           src/bin/bind10/run_bind10.sh
228
           src/bin/bindctl/bindctl
229
           src/bin/bindctl/unittest/bindctl_test
Evan Hunt's avatar
Evan Hunt committed
230 231
           src/bin/loadzone/run_loadzone
           src/bin/loadzone/b10-loadzone.py
232
           src/bin/msgq/msgq.py
233
           src/bin/msgq/msgq_test
234
           src/bin/msgq/run_msgq.sh
235
           src/bin/auth/config.h
Jeremy C. Reed's avatar
Jeremy C. Reed committed
236 237 238 239
           src/lib/config/data_def_unittests_config.h
           src/lib/python/isc/config/unittests/config_test
           src/lib/dns/gen-rdatacode.py
           src/lib/dns/tests/testdata/gen-wiredata.py
240
          ], [
241
           chmod +x src/bin/cmdctl/run_b10-cmdctl.sh
Likun Zhang's avatar
Likun Zhang committed
242
           chmod +x src/bin/xfrin/run_b10-xfrin.sh
243
           chmod +x src/bin/bind10/run_bind10.sh
244
           chmod +x src/bin/cmdctl/unittest/cmdctl_test
Likun Zhang's avatar
Likun Zhang committed
245
           chmod +x src/bin/xfrin/unittest/xfrin_test
246
           chmod +x src/bin/bindctl/unittest/bindctl_test
247
           chmod +x src/bin/bindctl/bindctl
Evan Hunt's avatar
Evan Hunt committed
248
           chmod +x src/bin/loadzone/run_loadzone
249
           chmod +x src/bin/msgq/run_msgq.sh
Michael Graff's avatar
Michael Graff committed
250
           chmod +x src/bin/msgq/msgq_test
Jeremy C. Reed's avatar
Jeremy C. Reed committed
251 252
	   chmod +x src/lib/dns/gen-rdatacode.py
	   chmod +x src/lib/dns/tests/testdata/gen-wiredata.py
253
          ])
254
AC_OUTPUT