PageRenderTime 94ms CodeModel.GetById 86ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/thirdparty/breakpad/third_party/glog/configure.ac

http://github.com/tomahawk-player/tomahawk
m4 | 207 lines | 144 code | 26 blank | 37 comment | 0 complexity | 54943b5f9178f86341c939c78c06945f MD5 | raw file
  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
  4
  5# make sure we're interpreted by some minimal autoconf
  6AC_PREREQ(2.57)
  7
  8AC_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)
 11AC_CONFIG_SRCDIR(README)
 12AC_CONFIG_MACRO_DIR([m4])
 13AM_INIT_AUTOMAKE
 14AM_CONFIG_HEADER(src/config.h)
 15
 16AC_LANG(C++)
 17
 18# Checks for programs.
 19AC_PROG_CC
 20AC_PROG_CPP
 21AC_PROG_CXX
 22AM_CONDITIONAL(GCC, test "$GCC" = yes)   # let the Makefile know if we're gcc
 23
 24AC_PROG_LIBTOOL
 25AC_SUBST(LIBTOOL_DEPS)
 26
 27# Check whether some low-level functions/files are available
 28AC_HEADER_STDC
 29
 30# These are tested for by AC_HEADER_STDC, but I check again to set the var
 31AC_CHECK_HEADER(stdint.h, ac_cv_have_stdint_h=1, ac_cv_have_stdint_h=0)
 32AC_CHECK_HEADER(sys/types.h, ac_cv_have_systypes_h=1, ac_cv_have_systypes_h=0)
 33AC_CHECK_HEADER(inttypes.h, ac_cv_have_inttypes_h=1, ac_cv_have_inttypes_h=0)
 34AC_CHECK_HEADERS(unistd.h, ac_cv_have_unistd_h=1, ac_cv_have_unistd_h=0)
 35AC_CHECK_HEADERS(syscall.h)
 36AC_CHECK_HEADERS(sys/syscall.h)
 37# For backtrace with glibc.
 38AC_CHECK_HEADERS(execinfo.h)
 39# For backtrace with libunwind.
 40AC_CHECK_HEADERS(libunwind.h, ac_cv_have_libunwind_h=1, ac_cv_have_libunwind_h=0)
 41AC_CHECK_HEADERS(ucontext.h)
 42AC_CHECK_HEADERS(sys/utsname.h)
 43AC_CHECK_HEADERS(pwd.h)
 44AC_CHECK_HEADERS(syslog.h)
 45AC_CHECK_HEADERS(sys/time.h)
 46AC_CHECK_HEADERS(glob.h)
 47
 48AC_CHECK_SIZEOF(void *)
 49
 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.
 52AC_CHECK_TYPE(uint16_t, ac_cv_have_uint16_t=1, ac_cv_have_uint16_t=0)
 53AC_CHECK_TYPE(u_int16_t, ac_cv_have_u_int16_t=1, ac_cv_have_u_int16_t=0)
 54AC_CHECK_TYPE(__uint16, ac_cv_have___uint16=1, ac_cv_have___uint16=0)
 55
 56AC_CHECK_FUNC(sigaltstack,
 57              AC_DEFINE(HAVE_SIGALTSTACK, 1,
 58                        [Define if you have the `sigaltstack' function]))
 59AC_CHECK_FUNC(dladdr,
 60              AC_DEFINE(HAVE_DLADDR, 1,
 61                        [Define if you have the `dladdr' function]))
 62AC_CHECK_FUNC(fcntl,
 63              AC_DEFINE(HAVE_FCNTL, 1,
 64                        [Define if you have the `fcntl' function]))
 65
 66AX_C___ATTRIBUTE__
 67# We only care about these two attributes.
 68if 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)))"
 71else
 72  ac_cv___attribute___noreturn=
 73  ac_cv___attribute___printf_4_5=
 74fi
 75
 76AX_C___BUILTIN_EXPECT
 77if test x"$ac_cv___builtin_expect" = x"yes"; then
 78  ac_cv_have___builtin_expect=1
 79else
 80  ac_cv_have___builtin_expect=0
 81fi
 82
 83AX_C___SYNC_VAL_COMPARE_AND_SWAP
 84
 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).
 87AC_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)
 91AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [return __x86_64__ == 1 ? 0 : 1])],
 92                  [is_x86_64=yes], [is_x86_64=no])
 93AM_CONDITIONAL(ENABLE_FRAME_POINTERS, test "$enable_frame_pointers" = yes)
 94AM_CONDITIONAL(X86_64, test "$is_x86_64" = yes)
 95
 96# Some of the code in this directory depends on pthreads
 97ACX_PTHREAD
 98if 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)
102fi
103
104# Check if there is google-gflags library installed.
105SAVE_CFLAGS="$CFLAGS"
106SAVE_LIBS="$LIBS"
107AC_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"
112)
113AC_CHECK_LIB(gflags, main, ac_cv_have_libgflags=1, ac_cv_have_libgflags=0)
114if 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"
118  fi
119else
120  GFLAGS_CFLAGS=
121  GFLAGS_LIBS=
122fi
123CFLAGS="$SAVE_CFLAGS"
124LIBS="$SAVE_LIBS"
125
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.
129AC_CHECK_PROG(GTEST_CONFIG, gtest-config, "yes")
130if 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])
134
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])
141  else
142    # We don't run test cases which use Google Mocking framework.
143    GMOCK_CFLAGS=
144    GMOCK_LIBS=
145  fi
146else
147  # We'll use src/googletest.h for our unittests.
148  GTEST_CFLAGS=
149  GTEST_LIBS=
150fi
151AM_CONDITIONAL(HAVE_GMOCK, test x"$GMOCK_CONFIG" = "xyes")
152
153# We want to link in libunwind if it exists
154UNWIND_LIBS=
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.
158if test x"$ac_cv_have_libunwind_h" = x"1"; then
159 AC_CHECK_LIB(unwind, backtrace, UNWIND_LIBS=-lunwind)
160fi
161AC_SUBST(UNWIND_LIBS)
162if test x"$UNWIND_LIBS" != x""; then
163  AC_DEFINE(HAVE_LIB_UNWIND, 1, [define if you have libunwind])
164fi
165
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.
169AC_RWLOCK
170
171# Find out what namespace 'normal' STL code lives in, and also what namespace
172# the user wants our classes to be defined in
173AC_CXX_STL_NAMESPACE
174AC_DEFINE_GOOGLE_NAMESPACE(google)
175
176AC_CXX_USING_OPERATOR
177
178AC_PC_FROM_UCONTEXT(AC_MSG_WARN(Could not find the PC.  Will not output failed addresses...))
179
180AC_DEFINE_UNQUOTED(TEST_SRC_DIR, "$srcdir", [location of source code])
181
182# These are what's needed by logging.h.in and raw_logging.h.in
183AC_SUBST(ac_google_start_namespace)
184AC_SUBST(ac_google_end_namespace)
185AC_SUBST(ac_google_namespace)
186AC_SUBST(ac_cv_cxx_using_operator)
187AC_SUBST(ac_cv___attribute___noreturn)
188AC_SUBST(ac_cv___attribute___printf_4_5)
189AC_SUBST(ac_cv_have___builtin_expect)
190AC_SUBST(ac_cv_have_stdint_h)
191AC_SUBST(ac_cv_have_systypes_h)
192AC_SUBST(ac_cv_have_inttypes_h)
193AC_SUBST(ac_cv_have_unistd_h)
194AC_SUBST(ac_cv_have_uint16_t)
195AC_SUBST(ac_cv_have_u_int16_t)
196AC_SUBST(ac_cv_have___uint16)
197AC_SUBST(ac_cv_have_libgflags)
198AC_SUBST(GFLAGS_CFLAGS)
199AC_SUBST(GTEST_CFLAGS)
200AC_SUBST(GMOCK_CFLAGS)
201AC_SUBST(GFLAGS_LIBS)
202AC_SUBST(GTEST_LIBS)
203AC_SUBST(GMOCK_LIBS)
204
205# Write generated configuration file
206AC_CONFIG_FILES([Makefile src/glog/logging.h src/glog/raw_logging.h src/glog/vlog_is_on.h src/glog/stl_logging.h])
207AC_OUTPUT(libglog.pc)