configure.ac 5.97 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 13 14
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
CXXFLAGS="-g -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare"
23 24 25 26 27 28 29
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

30 31
# Checks for libraries.

32 33 34
AC_SEARCH_LIBS(inet_pton, [nsl])
AC_SEARCH_LIBS(recvfrom, [socket])

35 36 37 38 39 40
# Checks for header files.

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

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

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

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


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

#
92
# Check availability of gtest, which will be used for unit tests.
93
#
94
if test "$gtest_path" != "no"
95
then
96 97
	if test "$gtest_path" != "yes"; then
		GTEST_PATHS=$gtest_path
98 99 100
		if test -x "${gtest_path}/bin/gtest-config" ; then
			GTEST_CONFIG="${gtest_path}/bin/gtest-config"
		fi
101
	else
102
		AC_PATH_PROG([GTEST_CONFIG], [gtest-config])
103
	fi
104 105 106 107 108 109 110 111 112 113
	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"
114
		fi
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
		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
130 131
		AC_MSG_ERROR([Cannot find gtest in: $GTEST_PATHS])
	fi
132
else
133 134 135
	GTEST_INCLUDES=
	GTEST_LDFLAGS=
	GTEST_LDADD=
136
fi
137 138 139 140
AM_CONDITIONAL(HAVE_GTEST, test $gtest_path != "no")
AC_SUBST(GTEST_INCLUDES)
AC_SUBST(GTEST_LDFLAGS)
AC_SUBST(GTEST_LDADD)
141

142 143 144 145
# Checks for library functions.

AC_CONFIG_FILES([Makefile
                 src/Makefile
146
                 src/bin/Makefile
147
                 src/bin/bind10/Makefile
Jelte Jansen's avatar
Jelte Jansen committed
148
                 src/bin/cmdctl/Makefile
Jeremy C. Reed's avatar
Jeremy C. Reed committed
149
                 src/bin/bindctl/Makefile
Jelte Jansen's avatar
Jelte Jansen committed
150
                 src/bin/cfgmgr/Makefile
151
                 src/bin/host/Makefile
152
                 src/bin/msgq/Makefile
153
                 src/bin/auth/Makefile
154
                 src/lib/Makefile
155 156
                 src/lib/cc/Makefile
                 src/lib/cc/cpp/Makefile
157
                 src/lib/cc/python/Makefile
158 159 160
                 src/lib/cc/python/isc/Makefile
                 src/lib/cc/python/isc/cc/Makefile
                 src/lib/cc/python/isc/Util/Makefile
161 162
                 src/lib/config/Makefile
                 src/lib/config/cpp/Makefile
163 164 165
                 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
166
                 src/lib/dns/Makefile
167
                 src/lib/dns/cpp/Makefile
168 169
                 src/lib/exceptions/cpp/Makefile
                 src/lib/exceptions/Makefile
170 171
                 src/lib/auth/Makefile
                 src/lib/auth/cpp/Makefile
Jelte Jansen's avatar
Jelte Jansen committed
172
               ])
173 174
AC_OUTPUT([src/bin/cfgmgr/b10-cfgmgr.py
           src/bin/cfgmgr/run_b10-cfgmgr.sh
175
           src/bin/cmdctl/cmdctl.py
176
           src/bin/cmdctl/run_b10-cmdctl.sh
177
           src/bin/cmdctl/unittest/cmdctl_test
178
           src/bin/bind10/bind10.py
Shane Kerr's avatar
Shane Kerr committed
179
           src/bin/bind10/bind10_test
180
           src/bin/bind10/run_bind10.sh
181
           src/bin/bindctl/bindctl
182
           src/bin/bindctl/unittest/bindctl_test
183
           src/bin/msgq/msgq.py
184
           src/bin/msgq/msgq_test
185
           src/bin/msgq/run_msgq.sh
186
           src/bin/auth/config.h
Jelte Jansen's avatar
Jelte Jansen committed
187
           src/lib/config/cpp/data_def_unittests_config.h
188
           src/lib/config/python/isc/config/config_test
189
           src/lib/dns/cpp/gen-rdatacode.py
190
          ], [
191
           chmod +x src/bin/cfgmgr/run_b10-cfgmgr.sh
192 193
           chmod +x src/bin/cmdctl/run_b10-cmdctl.sh
           chmod +x src/bin/bind10/run_bind10.sh
194 195
           chmod +x src/bin/cmdctl/unittest/cmdctl_test
           chmod +x src/bin/bindctl/unittest/bindctl_test
196
           chmod +x src/bin/bindctl/bindctl
197
           chmod +x src/bin/msgq/run_msgq.sh
Michael Graff's avatar
Michael Graff committed
198
           chmod +x src/bin/msgq/msgq_test
199
	   chmod +x src/lib/dns/cpp/gen-rdatacode.py
200
          ])
201
AC_OUTPUT