forked from google/certificate-transparency
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
134 lines (119 loc) · 4.86 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
AC_PREREQ([2.69])
AC_INIT([certificate-transparency], [0.9], [certificate-transparency@googlegroups.com])
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects])
AC_CONFIG_SRCDIR([cpp/server/ct-server.cc])
AC_CONFIG_HEADERS([cpp/config.h])
AC_CONFIG_MACRO_DIRS([m4])
AM_SILENT_RULES([yes])
AC_LANG([C++])
GMOCK_DIR="${GMOCK_DIR=/usr/src/gmock}"
AC_ARG_VAR([GMOCK_DIR], [directory containing Google Mock])
GTEST_DIR="${GTEST_DIR="$GMOCK_DIR/gtest"}"
AC_ARG_VAR([GTEST_DIR], [directory containing Google Test])
# Checks for programs.
AC_PROG_AWK
AC_PROG_CXX
AC_PROG_CC
AC_PROG_CPP
AC_PROG_LN_S
AC_PROG_RANLIB
AM_PROG_AR
AX_CXX_COMPILE_STDCXX_11
AC_CHECK_PROGS([ANT], [ant])
PKG_CHECK_MODULES([json_c], [json-c])
# Checks for header files.
AC_HEADER_RESOLV
AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netinet/in.h stddef.h stdint.h stdlib.h string.h sys/socket.h sys/time.h unistd.h leveldb/filter_policy.h])
AC_CHECK_HEADER([event2/event.h],,
[AC_MSG_ERROR([libevent headers could not be found])])
AC_CHECK_HEADER([gflags/gflags.h],,
[AC_MSG_ERROR([gflags headers could not be found])])
AC_CHECK_HEADER([glog/logging.h],,
[AC_MSG_ERROR([glog headers could not be found])])
AC_CHECK_HEADER([google/protobuf/message.h],,
[AC_MSG_ERROR([protobuf headers could not be found])])
AC_CHECK_HEADER([leveldb/db.h],,
[AC_MSG_ERROR([leveldb headers could not be found])])
AC_CHECK_HEADER([ldns/ldns.h],, [missing_ldns=yes])
# Check for working GTest/GMock.
saved_CPPFLAGS="$CPPFLAGS"
AS_UNSET([missing_gtest])
AS_UNSET([missing_gmock])
AS_VAR_APPEND([CPPFLAGS], [" -I$GTEST_DIR/include"])
AC_CHECK_HEADER([gtest/gtest.h],, [missing_gtest=1])
AS_VAR_APPEND([CPPFLAGS], [" -I$GMOCK_DIR/include"])
AC_CHECK_HEADER([gmock/gmock.h],, [missing_gmock=1])
AS_VAR_APPEND([CPPFLAGS], [" -I$GTEST_DIR"])
AC_CHECK_HEADER([$GTEST_DIR/src/gtest-all.cc],, [missing_gtest=1])
AS_VAR_APPEND([CPPFLAGS], [" -I$GMOCK_DIR"])
AC_CHECK_HEADER([$GMOCK_DIR/src/gmock-all.cc],, [missing_gmock=1])
CPPFLAGS="$saved_CPPFLAGS"
AS_IF([test -n "$missing_gtest"],
[AC_MSG_ERROR([could not find a working Google Test])])
AS_IF([test -n "$missing_gmock"],
[AC_MSG_ERROR([could not find a working Google Mock])])
# Checks for libraries.
AC_SEARCH_LIBS([__b64_ntop], [resolv])
AC_SEARCH_LIBS([pthread_create], [pthread])
AC_MSG_CHECKING([checking for gflags library])
LIBS="-lgflags $LIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <gflags/gflags.h>], [google::ParseCommandLineFlags(NULL, NULL, true)])], [have_gflags=yes], [have_gflags=no])
AC_MSG_RESULT([$have_gflags])
AS_IF([test "x$have_gflags" = "xno"],
[AC_MSG_ERROR([gflags library could not be found])])
AC_MSG_CHECKING([checking for glog library])
LIBS="-lglog $LIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <glog/logging.h>], [google::InitGoogleLogging(NULL)])], [have_glog=yes], [have_glog=no])
AC_MSG_RESULT([$have_glog])
AS_IF([test "x$have_glog" = "xno"],
[AC_MSG_ERROR([glog library could not be found])])
save_LIBS="$LIBS"
AS_UNSET([LIBS])
AC_SEARCH_LIBS([snappy_compress], [snappy],,, [$save_LIBS])
AC_SEARCH_LIBS([leveldb_open], [leveldb],, [missing_leveldb=1], [$save_LIBS])
AC_SUBST([leveldb_LIBS], [$LIBS])
AS_IF([test -n "$missing_leveldb"],
[AC_MSG_ERROR([could not find the leveldb/snappy libraries])])
LIBS="$save_LIBS"
save_LIBS="$LIBS"
AS_UNSET([LIBS])
AC_SEARCH_LIBS([event_base_dispatch], [event],, [missing_libevent=1],
[$save_LIBS])
AC_SEARCH_LIBS([evthread_use_pthreads], [event_pthreads],, [missing_libevent=1],
[$save_LIBS])
AC_SUBST([libevent_LIBS], [$LIBS])
AS_IF([test -n "$missing_libevent"],
[AC_MSG_ERROR([could not find the libevent libraries])])
LIBS="$save_LIBS"
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_MODE_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
AC_MSG_CHECKING([whether pthread_t is a pointer])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
#include <pthread.h>
void TakesPointer(void*);
], [TakesPointer(pthread_self())])], [PTHREAD_T_IS_POINTER=yes],
[PTHREAD_T_IS_POINTER=no])
AC_MSG_RESULT([$PTHREAD_T_IS_POINTER])
AS_IF([test "x$PTHREAD_T_IS_POINTER" = xyes],
[AC_DEFINE([PTHREAD_T_IS_POINTER], [],
[Whether pthread_t is a pointer.])])
# Checks for library functions.
AC_FUNC_FORK
AC_CHECK_FUNCS([alarm gettimeofday memset mkdir select socket strdup strerror strtol])
# TODO(pphaneuf): We should validate that we have all the tools and
# libraries that we require here, instead of letting the compilation
# fail later during the build (sometimes in ways that are unclear to
# the user.
AM_CONDITIONAL([HAVE_ANT], [test -n "$ANT"])
AM_CONDITIONAL([HAVE_LDNS], [test -z "$missing_ldns"])
AC_DEFINE_UNQUOTED([TEST_SRCDIR], ["$srcdir"], [Top of the source directory, for tests.])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT