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

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

# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_RANLIB

15 16
AC_PROG_LIBTOOL

17 18 19
m4_define([_AM_PYTHON_INTERPRETER_LIST], [python python3 python3.1])
AM_PATH_PYTHON([3.1])

20 21
# default compiler warning settings
if test "X$GCC" = "Xyes"; then
22 23 24 25 26
#-Woverloaded-virtual will produce so many warnings.  Suppress them for rapid
# prototyping, but we should soon fix the code, rather than ignoring the
# warnings!!
#CXXFLAGS="-g -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare"
CXXFLAGS="-g -Wall -Wwrite-strings -Wno-sign-compare"
27 28 29 30 31 32 33
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

34 35 36 37 38 39 40 41
# Checks for libraries.

# Checks for header files.

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

42 43 44 45 46 47 48 49 50
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))

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

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


USE_LCOV="no"
if test "$lcov" != "no"; then
	# force gtest if not set
	if test "$gtest_path" = "no"; then
63 64
#		AC_MSG_ERROR("lcov needs gtest for test coverage report")
		AC_MSG_NOTICE([gtest support is now enabled, because used by coverage tests])
65 66 67
		gtest_path="yes"
	fi
	if test "$lcov" != "yes"; then
68
		LCOV=$lcov
69
	else
70
		AC_PATH_PROG([LCOV], [lcov])
71
	fi
72 73 74 75
	if test -x "${LCOV}"; then
		USE_LCOV="yes"
	else
		AC_MSG_ERROR([Cannot find lcov.])
76 77 78 79 80 81
	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
82
	# GCC specific?
83
	CXXFLAGS="$CXXFLAGS -fprofile-arcs -ftest-coverage"
84
	LIBS=" $LIBS -lgcov"
85 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
# Check availability of gtest, which will be used for unit tests.
94
#
95
if test "$gtest_path" != "no"
96
then
97 98
	if test "$gtest_path" != "yes"; then
		GTEST_PATHS=$gtest_path
99 100 101
		if test -x "${gtest_path}/bin/gtest-config" ; then
			GTEST_CONFIG="${gtest_path}/bin/gtest-config"
		fi
102
	else
103
		AC_PATH_PROG([GTEST_CONFIG], [gtest-config])
104
	fi
105 106 107 108 109 110 111 112 113 114
	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"
115
		fi
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
		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
131 132
		AC_MSG_ERROR([Cannot find gtest in: $GTEST_PATHS])
	fi
133
else
134 135 136
	GTEST_INCLUDES=
	GTEST_LDFLAGS=
	GTEST_LDADD=
137
fi
138 139 140 141
AM_CONDITIONAL(HAVE_GTEST, test $gtest_path != "no")
AC_SUBST(GTEST_INCLUDES)
AC_SUBST(GTEST_LDFLAGS)
AC_SUBST(GTEST_LDADD)
142

143 144 145 146
# Checks for library functions.

AC_CONFIG_FILES([Makefile
                 src/Makefile
147
                 src/bin/Makefile
148
                 src/bin/bind10/Makefile
Jelte Jansen's avatar
Jelte Jansen committed
149
                 src/bin/cmdctl/Makefile
Jeremy C. Reed's avatar
Jeremy C. Reed committed
150
                 src/bin/bindctl/Makefile
Jelte Jansen's avatar
Jelte Jansen committed
151
                 src/bin/cfgmgr/Makefile
152
                 src/bin/host/Makefile
153
                 src/bin/msgq/Makefile
154
                 src/bin/parkinglot/Makefile
155
                 src/lib/Makefile
156 157
                 src/lib/cc/Makefile
                 src/lib/cc/cpp/Makefile
158 159 160 161
                 src/lib/cc/python/Makefile
                 src/lib/cc/python/ISC/Makefile
                 src/lib/cc/python/ISC/CC/Makefile
                 src/lib/cc/python/ISC/Util/Makefile
162 163
                 src/lib/config/Makefile
                 src/lib/config/cpp/Makefile
164 165 166
                 src/lib/config/python/Makefile
                 src/lib/config/python/isc/Makefile
                 src/lib/config/python/isc/config/Makefile
Jelte Jansen's avatar
Jelte Jansen committed
167
                 src/lib/dns/Makefile
168
                 src/lib/dns/cpp/Makefile
Jelte Jansen's avatar
Jelte Jansen committed
169
               ])
Jelte Jansen's avatar
Jelte Jansen committed
170
AC_OUTPUT([src/bin/cfgmgr/b10-cfgmgr
Jelte Jansen's avatar
Jelte Jansen committed
171
           src/bin/cmdctl/b10-cmdctl
172
           src/bin/bind10/bind10.py
Shane Kerr's avatar
Shane Kerr committed
173
           src/bin/bind10/bind10_test
174
           src/bin/bind10/run_bind10.sh
175
           src/bin/bindctl/bindctl
176
           src/bin/bindctl/unittest/bindctl_test
177 178
           src/bin/msgq/msgq
           src/bin/msgq/msgq_test
179
           src/bin/parkinglot/config.h
180
          ], [
Jelte Jansen's avatar
Jelte Jansen committed
181
           chmod +x src/bin/cfgmgr/b10-cfgmgr
Jelte Jansen's avatar
Jelte Jansen committed
182
           chmod +x src/bin/cmdctl/b10-cmdctl
183
           chmod +x src/bin/bind10/bind10
184
           chmod +x src/bin/bindctl/bindctl
Michael Graff's avatar
Michael Graff committed
185 186
           chmod +x src/bin/msgq/msgq
           chmod +x src/bin/msgq/msgq_test
187
          ])
188
AC_OUTPUT