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.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)
13 AM_CONFIG_HEADER(src/config.h)
15 # Checks for programs.
19 AM_CONDITIONAL(GCC, test "$GCC" = yes) # let the Makefile know if we're gcc
22 AC_SUBST(LIBTOOL_DEPS)
24 # Check whether some low-level functions/files are available
27 # These are tested for by AC_HEADER_STDC, but I check again to set the var
28 AC_CHECK_HEADER(stdint.h, ac_cv_have_stdint_h=1, ac_cv_have_stdint_h=0)
29 AC_CHECK_HEADER(sys/types.h, ac_cv_have_systypes_h=1, ac_cv_have_systypes_h=0)
30 AC_CHECK_HEADER(inttypes.h, ac_cv_have_inttypes_h=1, ac_cv_have_inttypes_h=0)
31 AC_CHECK_HEADERS(syscall.h)
32 AC_CHECK_HEADERS(sys/syscall.h)
33 # For backtrace with glibc.
34 # TODO(hamaji): Support other platforms using libgcc.
35 AC_CHECK_HEADERS(execinfo.h)
37 AC_CHECK_SIZEOF(void *)
39 # These are the types I need. We look for them in either stdint.h,
40 # sys/types.h, or inttypes.h, all of which are part of the default-includes.
41 AC_CHECK_TYPE(uint16_t, ac_cv_have_uint16_t=1, ac_cv_have_uint16_t=0)
42 AC_CHECK_TYPE(u_int16_t, ac_cv_have_u_int16_t=1, ac_cv_have_u_int16_t=0)
43 AC_CHECK_TYPE(__uint16, ac_cv_have___uint16=1, ac_cv_have___uint16=0)
45 AC_CHECK_FUNC(sigaltstack,
46 AC_DEFINE(HAVE_SIGALTSTACK, 1,
47 [Define if you have the `sigaltstack' function]))
50 # We only care about these two attributes.
51 if test x"$ac_cv___attribute__" = x"yes"; then
52 ac_cv___attribute___noreturn="__attribute__ ((noreturn))"
53 ac_cv___attribute___printf_4_5="__attribute__((__format__ (__printf__, 4, 5)))"
55 ac_cv___attribute___noreturn=
56 ac_cv___attribute___printf_4_5=
60 if test x"$ac_cv___builtin_expect" = x"yes"; then
61 ac_cv_have___builtin_expect=1
63 ac_cv_have___builtin_expect=0
66 # On x86_64, instead of libunwind, we can choose to compile with frame-pointers
67 # (This isn't needed on i386, where -fno-omit-frame-pointer is the default).
68 AC_ARG_ENABLE(frame_pointers,
69 AS_HELP_STRING([--enable-frame-pointers],
70 [On x86_64 systems, compile with -fno-omit-frame-pointer (see INSTALL)]),
71 enable_frame_pointers=no)
72 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [return __x86_64__ == 1 ? 0 : 1])],
73 [is_x86_64=yes], [is_x86_64=no])
74 AM_CONDITIONAL(ENABLE_FRAME_POINTERS, test "$enable_frame_pointers" = yes)
75 AM_CONDITIONAL(X86_64, test "$is_x86_64" = yes)
77 # Some of the code in this directory depends on pthreads
80 # Check if there is google-gflags library installed.
81 AC_CHECK_LIB(gflags, main, ac_cv_have_libgflags=1, ac_cv_have_libgflags=0)
82 if test x"$ac_cv_have_libgflags" = x"1"; then
84 AC_DEFINE(HAVE_LIB_GFLAGS, 1, [define if you have google gflags library])
89 # We'd like to use read/write locks in several places in the code.
90 # See if our pthreads support extends to that. Note: for linux, it
91 # does as long as you define _XOPEN_SOURCE appropriately.
94 # Find out what namespace 'normal' STL code lives in, and also what namespace
95 # the user wants our classes to be defined in
97 AC_DEFINE_GOOGLE_NAMESPACE(google)
101 # These are what's needed by logging.h.in and raw_logging.h.in
102 AC_SUBST(ac_google_start_namespace)
103 AC_SUBST(ac_google_end_namespace)
104 AC_SUBST(ac_google_namespace)
105 AC_SUBST(ac_cv_cxx_using_operator)
106 AC_SUBST(ac_cv___attribute___noreturn)
107 AC_SUBST(ac_cv___attribute___printf_4_5)
108 AC_SUBST(ac_cv_have___builtin_expect)
109 AC_SUBST(ac_cv_have_stdint_h)
110 AC_SUBST(ac_cv_have_systypes_h)
111 AC_SUBST(ac_cv_have_inttypes_h)
112 AC_SUBST(ac_cv_have_uint16_t)
113 AC_SUBST(ac_cv_have_u_int16_t)
114 AC_SUBST(ac_cv_have___uint16)
115 AC_SUBST(ac_cv_have_libgflags)
116 AC_SUBST(GFLAGS_LIBS)
118 # Write generated configuration file
119 AC_CONFIG_FILES([Makefile src/glog/logging.h src/glog/raw_logging.h src/glog/vlog_is_on.h src/glog/stl_logging.h])