configure.ac 3.51 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 17
m4_define([_AM_PYTHON_INTERPRETER_LIST], [python python3 python3.1])
AM_PATH_PYTHON([3.1])

18 19 20 21 22 23 24 25
# Checks for libraries.

# Checks for header files.

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

26 27 28 29 30 31 32 33 34
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))

35 36 37
AC_ARG_WITH(lcov,
[  --with-lcov         enable gtest and coverage target using the specified lcov], lcov="yes", lcov="no")

38
AC_ARG_WITH(gtest,
39
[  --with-gtest=PATH       specify a path to gtest header files (PATH/include) and library (PATH/lib)],
40
    gtest_path="$withval", gtest_path="no")
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79


USE_LCOV="no"
if test "$lcov" != "no"; then
	# force gtest if not set
	if test "$gtest_path" = "no"; then
		gtest_path="yes"
	fi
	if test "$lcov" != "yes"; then
		LCOV_PATHS=$lcov
	else
		LCOV_PATHS="/usr/bin/lcov /usr/local/bin/lcov"
	fi
	for f in $LCOV_PATHS; do
		if test -x "$f"; then
			USE_LCOV="yes"
			LCOV=$f
		fi
	done
	if test $USE_LCOV != "yes"; then
		AC_MSG_ERROR([Cannot find lcov in: $LCOV_PATHS])
	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
	CPPFLAGS="$(CPPFLAGS) -fprofile-arcs -ftest-coverage"
	LIBS=" $(LIBS) -lgcov"
	AC_SUBST(CPPFLAGS)
	AC_SUBST(LIBS)
	AC_SUBST(LCOV)
	AC_SUBST(GENHTML)
fi
AC_SUBST(USE_LCOV)

#
# Check availablity of gtest, which will be used for unit tests.
#
80
if test "$gtest_path" != "no"
81
then
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
	if test "$gtest_path" != "yes"; then
		GTEST_PATHS=$gtest_path
	else
		GTEST_PATHS="/usr /usr/local"
	fi

	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"
		fi
	done
	if test $GTEST_FOUND != "true"; then
		AC_MSG_ERROR([Cannot find gtest in: $GTEST_PATHS])
	fi
100
else
101 102 103
	GTEST_INCLUDES=
	GTEST_LDFLAGS=
	GTEST_LDADD=
104
fi
105 106 107 108
AM_CONDITIONAL(HAVE_GTEST, test $gtest_path != "no")
AC_SUBST(GTEST_INCLUDES)
AC_SUBST(GTEST_LDFLAGS)
AC_SUBST(GTEST_LDADD)
109

110 111 112 113
# Checks for library functions.

AC_CONFIG_FILES([Makefile
                 src/Makefile
114
                 src/bin/Makefile
115 116
                 src/bin/bigtool/Makefile
                 src/bin/bind10/Makefile
117
                 src/bin/host/Makefile
118
                 src/bin/msgq/Makefile
119
                 src/bin/parkinglot/Makefile
120
                 src/lib/Makefile
121 122
                 src/lib/cc/Makefile
                 src/lib/cc/cpp/Makefile
Jelte Jansen's avatar
Jelte Jansen committed
123 124
                 src/lib/dns/Makefile
               ])
125
AC_OUTPUT([src/bin/bind-cfgd/bind-cfgd
126
           src/bin/bigtool/run_bigtool
127
           src/bin/bind10/bind10
Michael Graff's avatar
Michael Graff committed
128 129
	   src/bin/msgq/msgq
	   src/bin/msgq/msgq_test
130
           src/bin/parkinglot/config.h
131 132
          ], [
           chmod +x src/bin/bind-cfgd/bind-cfgd
133
           chmod +x src/bin/bigtool/run_bigtool
134
           chmod +x src/bin/bind10/bind10
Michael Graff's avatar
Michael Graff committed
135 136
           chmod +x src/bin/msgq/msgq
           chmod +x src/bin/msgq/msgq_test
137
          ])
138
AC_OUTPUT