1
## Process this file with autoconf to produce configure.
2
## In general, the safest way to proceed is to run the following:
3
## % aclocal -I . -I `pwd`/../autoconf && autoheader && autoconf && automake
5
# make sure we're interpreted by some minimal autoconf
8
AC_INIT(glog, 0.3.1, opensource@google.com)
9
# The argument here is just something that should be in the current directory
10
# (for sanity checking)
11
AC_CONFIG_SRCDIR(README)
12
AC_CONFIG_MACRO_DIR([m4])
14
AM_CONFIG_HEADER(src/config.h)
18
# Checks for programs.
22
AM_CONDITIONAL(GCC, test "$GCC" = yes) # let the Makefile know if we're gcc
25
AC_SUBST(LIBTOOL_DEPS)
27
# Check whether some low-level functions/files are available
30
# These are tested for by AC_HEADER_STDC, but I check again to set the var
31
AC_CHECK_HEADER(stdint.h, ac_cv_have_stdint_h=1, ac_cv_have_stdint_h=0)
32
AC_CHECK_HEADER(sys/types.h, ac_cv_have_systypes_h=1, ac_cv_have_systypes_h=0)
33
AC_CHECK_HEADER(inttypes.h, ac_cv_have_inttypes_h=1, ac_cv_have_inttypes_h=0)
34
AC_CHECK_HEADERS(unistd.h, ac_cv_have_unistd_h=1, ac_cv_have_unistd_h=0)
35
AC_CHECK_HEADERS(syscall.h)
36
AC_CHECK_HEADERS(sys/syscall.h)
37
# For backtrace with glibc.
38
AC_CHECK_HEADERS(execinfo.h)
39
# For backtrace with libunwind.
40
AC_CHECK_HEADERS(libunwind.h, ac_cv_have_libunwind_h=1, ac_cv_have_libunwind_h=0)
41
AC_CHECK_HEADERS(ucontext.h)
42
AC_CHECK_HEADERS(sys/utsname.h)
43
AC_CHECK_HEADERS(pwd.h)
44
AC_CHECK_HEADERS(syslog.h)
45
AC_CHECK_HEADERS(sys/time.h)
46
AC_CHECK_HEADERS(glob.h)
48
AC_CHECK_SIZEOF(void *)
50
# These are the types I need. We look for them in either stdint.h,
51
# sys/types.h, or inttypes.h, all of which are part of the default-includes.
52
AC_CHECK_TYPE(uint16_t, ac_cv_have_uint16_t=1, ac_cv_have_uint16_t=0)
53
AC_CHECK_TYPE(u_int16_t, ac_cv_have_u_int16_t=1, ac_cv_have_u_int16_t=0)
54
AC_CHECK_TYPE(__uint16, ac_cv_have___uint16=1, ac_cv_have___uint16=0)
56
AC_CHECK_FUNC(sigaltstack,
57
AC_DEFINE(HAVE_SIGALTSTACK, 1,
58
[Define if you have the `sigaltstack' function]))
60
AC_DEFINE(HAVE_DLADDR, 1,
61
[Define if you have the `dladdr' function]))
63
AC_DEFINE(HAVE_FCNTL, 1,
64
[Define if you have the `fcntl' function]))
67
# We only care about these two attributes.
68
if test x"$ac_cv___attribute__" = x"yes"; then
69
ac_cv___attribute___noreturn="__attribute__ ((noreturn))"
70
ac_cv___attribute___printf_4_5="__attribute__((__format__ (__printf__, 4, 5)))"
72
ac_cv___attribute___noreturn=
73
ac_cv___attribute___printf_4_5=
77
if test x"$ac_cv___builtin_expect" = x"yes"; then
78
ac_cv_have___builtin_expect=1
80
ac_cv_have___builtin_expect=0
83
AX_C___SYNC_VAL_COMPARE_AND_SWAP
85
# On x86_64, instead of libunwind, we can choose to compile with frame-pointers
86
# (This isn't needed on i386, where -fno-omit-frame-pointer is the default).
87
AC_ARG_ENABLE(frame_pointers,
88
AS_HELP_STRING([--enable-frame-pointers],
89
[On x86_64 systems, compile with -fno-omit-frame-pointer (see INSTALL)]),,
90
enable_frame_pointers=no)
91
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [return __x86_64__ == 1 ? 0 : 1])],
92
[is_x86_64=yes], [is_x86_64=no])
93
AM_CONDITIONAL(ENABLE_FRAME_POINTERS, test "$enable_frame_pointers" = yes)
94
AM_CONDITIONAL(X86_64, test "$is_x86_64" = yes)
96
# Some of the code in this directory depends on pthreads
98
if test x"$acx_pthread_ok" = x"yes"; then
99
# To make libglog depend on libpthread on Linux, we need to add
100
# -lpthread in addition to -pthread.
101
AC_CHECK_LIB(pthread, pthread_self)
104
# Check if there is google-gflags library installed.
105
SAVE_CFLAGS="$CFLAGS"
107
AC_ARG_WITH(gflags, AS_HELP_STRING[--with-gflags=GFLAGS_DIR],
108
GFLAGS_CFLAGS="-I${with_gflags}/include"
109
GFLAGS_LIBS="-L${with_gflags}/lib -lgflags"
110
CFLAGS="$CFLAGS $GFLAGS_CFLAGS"
111
LIBS="$LIBS $GFLAGS_LIBS"
113
AC_CHECK_LIB(gflags, main, ac_cv_have_libgflags=1, ac_cv_have_libgflags=0)
114
if test x"$ac_cv_have_libgflags" = x"1"; then
115
AC_DEFINE(HAVE_LIB_GFLAGS, 1, [define if you have google gflags library])
116
if test x"$GFLAGS_LIBS" = x""; then
117
GFLAGS_LIBS="-lgflags"
123
CFLAGS="$SAVE_CFLAGS"
126
# TODO(hamaji): Use official m4 macros provided by testing libraries
127
# once the m4 macro of Google Mocking becomes ready.
128
# Check if there is Google Test library installed.
129
AC_CHECK_PROG(GTEST_CONFIG, gtest-config, "yes")
130
if test x"$GTEST_CONFIG" = "xyes"; then
131
GTEST_CFLAGS=`gtest-config --cppflags --cxxflags`
132
GTEST_LIBS=`gtest-config --ldflags --libs`
133
AC_DEFINE(HAVE_LIB_GTEST, 1, [define if you have google gtest library])
135
# Check if there is Google Mocking library installed.
136
AC_CHECK_PROG(GMOCK_CONFIG, gmock-config, "yes")
137
if test x"$GMOCK_CONFIG" = "xyes"; then
138
GMOCK_CFLAGS=`gmock-config --cppflags --cxxflags`
139
GMOCK_LIBS=`gmock-config --ldflags --libs`
140
AC_DEFINE(HAVE_LIB_GMOCK, 1, [define if you have google gmock library])
142
# We don't run test cases which use Google Mocking framework.
147
# We'll use src/googletest.h for our unittests.
151
AM_CONDITIONAL(HAVE_GMOCK, test x"$GMOCK_CONFIG" = "xyes")
153
# We want to link in libunwind if it exists
155
# Unfortunately, we need to check the header file in addition to the
156
# lib file to check if libunwind is available since libunwind-0.98
157
# doesn't install all necessary header files.
158
if test x"$ac_cv_have_libunwind_h" = x"1"; then
159
AC_CHECK_LIB(unwind, backtrace, UNWIND_LIBS=-lunwind)
161
AC_SUBST(UNWIND_LIBS)
162
if test x"$UNWIND_LIBS" != x""; then
163
AC_DEFINE(HAVE_LIB_UNWIND, 1, [define if you have libunwind])
166
# We'd like to use read/write locks in several places in the code.
167
# See if our pthreads support extends to that. Note: for linux, it
168
# does as long as you define _XOPEN_SOURCE appropriately.
171
# Find out what namespace 'normal' STL code lives in, and also what namespace
172
# the user wants our classes to be defined in
174
AC_DEFINE_GOOGLE_NAMESPACE(google)
176
AC_CXX_USING_OPERATOR
178
AC_PC_FROM_UCONTEXT(AC_MSG_WARN(Could not find the PC. Will not output failed addresses...))
180
AC_DEFINE_UNQUOTED(TEST_SRC_DIR, "$srcdir", [location of source code])
182
# These are what's needed by logging.h.in and raw_logging.h.in
183
AC_SUBST(ac_google_start_namespace)
184
AC_SUBST(ac_google_end_namespace)
185
AC_SUBST(ac_google_namespace)
186
AC_SUBST(ac_cv_cxx_using_operator)
187
AC_SUBST(ac_cv___attribute___noreturn)
188
AC_SUBST(ac_cv___attribute___printf_4_5)
189
AC_SUBST(ac_cv_have___builtin_expect)
190
AC_SUBST(ac_cv_have_stdint_h)
191
AC_SUBST(ac_cv_have_systypes_h)
192
AC_SUBST(ac_cv_have_inttypes_h)
193
AC_SUBST(ac_cv_have_unistd_h)
194
AC_SUBST(ac_cv_have_uint16_t)
195
AC_SUBST(ac_cv_have_u_int16_t)
196
AC_SUBST(ac_cv_have___uint16)
197
AC_SUBST(ac_cv_have_libgflags)
198
AC_SUBST(GFLAGS_CFLAGS)
199
AC_SUBST(GTEST_CFLAGS)
200
AC_SUBST(GMOCK_CFLAGS)
201
AC_SUBST(GFLAGS_LIBS)
205
# Write generated configuration file
206
AC_CONFIG_FILES([Makefile src/glog/logging.h src/glog/raw_logging.h src/glog/vlog_is_on.h src/glog/stl_logging.h])
207
AC_OUTPUT(libglog.pc)