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