github.com/jlmucb/cloudproxy@v0.0.0-20170830161738-b5aa0b619bc4/src/third_party/google-glog/configure.ac (about) 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 6 AC_PREREQ(2.57) 7 8 AC_INIT(glog, 0.3.3, 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]) 13 AM_INIT_AUTOMAKE 14 AM_CONFIG_HEADER(src/config.h) 15 16 AC_LANG(C++) 17 18 # Checks for programs. 19 AC_PROG_CC 20 AC_PROG_CPP 21 AC_PROG_CXX 22 AM_CONDITIONAL(GCC, test "$GCC" = yes) # let the Makefile know if we're gcc 23 24 AC_PROG_LIBTOOL 25 AC_SUBST(LIBTOOL_DEPS) 26 27 # Check whether some low-level functions/files are available 28 AC_HEADER_STDC 29 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) 47 # For backtrace with gcc. 48 AC_CHECK_HEADERS(unwind.h) 49 50 AC_CHECK_HEADER(windows.h, ac_cv_have_windows_h=1, ac_cv_have_windows_h=0) 51 if test x"$ac_cv_have_windows_h" = x"1"; then 52 MINGW_CFLAGS=-Isrc/windows 53 fi 54 55 AC_CHECK_SIZEOF(void *) 56 57 # These are the types I need. We look for them in either stdint.h, 58 # sys/types.h, or inttypes.h, all of which are part of the default-includes. 59 AC_CHECK_TYPE(uint16_t, ac_cv_have_uint16_t=1, ac_cv_have_uint16_t=0) 60 AC_CHECK_TYPE(u_int16_t, ac_cv_have_u_int16_t=1, ac_cv_have_u_int16_t=0) 61 AC_CHECK_TYPE(__uint16, ac_cv_have___uint16=1, ac_cv_have___uint16=0) 62 63 AC_CHECK_FUNC(sigaltstack, 64 AC_DEFINE(HAVE_SIGALTSTACK, 1, 65 [Define if you have the `sigaltstack' function])) 66 AC_CHECK_FUNC(sigaction, 67 AC_DEFINE(HAVE_SIGACTION, 1, 68 [Define if you have the 'sigaction' function])) 69 AC_CHECK_FUNC(dladdr, 70 AC_DEFINE(HAVE_DLADDR, 1, 71 [Define if you have the `dladdr' function])) 72 AC_CHECK_FUNC(fcntl, 73 AC_DEFINE(HAVE_FCNTL, 1, 74 [Define if you have the `fcntl' function])) 75 AC_CHECK_FUNC(pread, 76 AC_DEFINE(HAVE_PREAD, 1, 77 [Define if you have the 'pread' function])) 78 AC_CHECK_FUNC(pwrite, 79 AC_DEFINE(HAVE_PWRITE, 1, 80 [Define if you have the 'pwrite' function])) 81 82 AX_C___ATTRIBUTE__ 83 # We only care about these two attributes. 84 if test x"$ac_cv___attribute__" = x"yes"; then 85 ac_cv___attribute___noreturn="__attribute__ ((noreturn))" 86 ac_cv___attribute___noinline="__attribute__ ((noinline))" 87 ac_cv___attribute___printf_4_5="__attribute__((__format__ (__printf__, 4, 5)))" 88 else 89 ac_cv___attribute___noreturn= 90 ac_cv___attribute___noinline= 91 ac_cv___attribute___printf_4_5= 92 fi 93 94 AX_C___BUILTIN_EXPECT 95 if test x"$ac_cv___builtin_expect" = x"yes"; then 96 ac_cv_have___builtin_expect=1 97 else 98 ac_cv_have___builtin_expect=0 99 fi 100 101 AX_C___SYNC_VAL_COMPARE_AND_SWAP 102 103 # On x86_64, instead of libunwind, we can choose to compile with frame-pointers 104 # (This isn't needed on i386, where -fno-omit-frame-pointer is the default). 105 AC_ARG_ENABLE(frame_pointers, 106 AS_HELP_STRING([--enable-frame-pointers], 107 [On x86_64 systems, compile with -fno-omit-frame-pointer (see INSTALL)]),, 108 enable_frame_pointers=no) 109 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [return __x86_64__ == 1 ? 0 : 1])], 110 [is_x86_64=yes], [is_x86_64=no]) 111 AM_CONDITIONAL(ENABLE_FRAME_POINTERS, test "$enable_frame_pointers" = yes) 112 AM_CONDITIONAL(X86_64, test "$is_x86_64" = yes) 113 114 AC_ARG_ENABLE(rtti, 115 AS_HELP_STRING([--disable-rtti], 116 [Disable RTTI in glog])) 117 AM_CONDITIONAL(DISABLE_RTTI, test x"$enable_rtti" = x"no") 118 if test x"$enable_rtti" = x"no"; then 119 AC_DEFINE(DISABLE_RTTI, 1, [define if glog doesn't use RTTI]) 120 fi 121 122 # Some of the code in this directory depends on pthreads 123 ACX_PTHREAD 124 if test x"$acx_pthread_ok" = x"yes"; then 125 # To make libglog depend on libpthread on Linux, we need to add 126 # -lpthread in addition to -pthread. 127 AC_CHECK_LIB(pthread, pthread_self) 128 fi 129 130 # Check if there is google-gflags library installed. 131 SAVE_CFLAGS="$CFLAGS" 132 SAVE_LIBS="$LIBS" 133 AC_ARG_WITH(gflags, AS_HELP_STRING[--with-gflags=GFLAGS_DIR], 134 GFLAGS_CFLAGS="-I${with_gflags}/include" 135 GFLAGS_LIBS="-L${with_gflags}/lib -lgflags" 136 CFLAGS="$CFLAGS $GFLAGS_CFLAGS" 137 LIBS="$LIBS $GFLAGS_LIBS" 138 ) 139 AC_CHECK_LIB(gflags, main, ac_cv_have_libgflags=1, ac_cv_have_libgflags=0) 140 if test x"$ac_cv_have_libgflags" = x"1"; then 141 AC_DEFINE(HAVE_LIB_GFLAGS, 1, [define if you have google gflags library]) 142 if test x"$GFLAGS_LIBS" = x""; then 143 GFLAGS_LIBS="-lgflags" 144 fi 145 else 146 GFLAGS_CFLAGS= 147 GFLAGS_LIBS= 148 fi 149 CFLAGS="$SAVE_CFLAGS" 150 LIBS="$SAVE_LIBS" 151 152 # TODO(hamaji): Use official m4 macros provided by testing libraries 153 # once the m4 macro of Google Mocking becomes ready. 154 # Check if there is Google Test library installed. 155 AC_CHECK_PROG(GTEST_CONFIG, gtest-config, "yes") 156 AC_CHECK_LIB(gtest, main, have_gtest_lib="yes") 157 if test x"$GTEST_CONFIG" = "xyes" -a x"$have_gtest_lib" = "xyes"; then 158 GTEST_CFLAGS=`gtest-config --cppflags --cxxflags` 159 GTEST_LIBS=`gtest-config --ldflags --libs` 160 AC_DEFINE(HAVE_LIB_GTEST, 1, [define if you have google gtest library]) 161 162 # Check if there is Google Mocking library installed. 163 AC_CHECK_PROG(GMOCK_CONFIG, gmock-config, "yes") 164 if test x"$GMOCK_CONFIG" = "xyes"; then 165 GMOCK_CFLAGS=`gmock-config --cppflags --cxxflags` 166 GMOCK_LIBS=`gmock-config --ldflags --libs` 167 AC_DEFINE(HAVE_LIB_GMOCK, 1, [define if you have google gmock library]) 168 else 169 # We don't run test cases which use Google Mocking framework. 170 GMOCK_CFLAGS= 171 GMOCK_LIBS= 172 fi 173 else 174 # We'll use src/googletest.h for our unittests. 175 GTEST_CFLAGS= 176 GTEST_LIBS= 177 fi 178 AM_CONDITIONAL(HAVE_GMOCK, test x"$GMOCK_CONFIG" = "xyes") 179 180 # We want to link in libunwind if it exists 181 UNWIND_LIBS= 182 # Unfortunately, we need to check the header file in addition to the 183 # lib file to check if libunwind is available since libunwind-0.98 184 # doesn't install all necessary header files. 185 if test x"$ac_cv_have_libunwind_h" = x"1"; then 186 AC_CHECK_LIB(unwind, backtrace, UNWIND_LIBS=-lunwind) 187 fi 188 AC_SUBST(UNWIND_LIBS) 189 if test x"$UNWIND_LIBS" != x""; then 190 AC_DEFINE(HAVE_LIB_UNWIND, 1, [define if you have libunwind]) 191 fi 192 193 # We'd like to use read/write locks in several places in the code. 194 # See if our pthreads support extends to that. Note: for linux, it 195 # does as long as you define _XOPEN_SOURCE appropriately. 196 AC_RWLOCK 197 198 # Find out what namespace 'normal' STL code lives in, and also what namespace 199 # the user wants our classes to be defined in 200 AC_CXX_STL_NAMESPACE 201 AC_DEFINE_GOOGLE_NAMESPACE(google) 202 203 AC_CXX_USING_OPERATOR 204 205 AC_PC_FROM_UCONTEXT(AC_MSG_WARN(Could not find the PC. Will not output failed addresses...)) 206 207 AC_DEFINE_UNQUOTED(TEST_SRC_DIR, "$srcdir", [location of source code]) 208 209 # These are what's needed by logging.h.in and raw_logging.h.in 210 AC_SUBST(ac_google_start_namespace) 211 AC_SUBST(ac_google_end_namespace) 212 AC_SUBST(ac_google_namespace) 213 AC_SUBST(ac_cv_cxx_using_operator) 214 AC_SUBST(ac_cv___attribute___noreturn) 215 AC_SUBST(ac_cv___attribute___noinline) 216 AC_SUBST(ac_cv___attribute___printf_4_5) 217 AC_SUBST(ac_cv_have___builtin_expect) 218 AC_SUBST(ac_cv_have_stdint_h) 219 AC_SUBST(ac_cv_have_systypes_h) 220 AC_SUBST(ac_cv_have_inttypes_h) 221 AC_SUBST(ac_cv_have_unistd_h) 222 AC_SUBST(ac_cv_have_uint16_t) 223 AC_SUBST(ac_cv_have_u_int16_t) 224 AC_SUBST(ac_cv_have___uint16) 225 AC_SUBST(ac_cv_have_libgflags) 226 AC_SUBST(GFLAGS_CFLAGS) 227 AC_SUBST(GTEST_CFLAGS) 228 AC_SUBST(GMOCK_CFLAGS) 229 AC_SUBST(MINGW_CFLAGS) 230 AC_SUBST(GFLAGS_LIBS) 231 AC_SUBST(GTEST_LIBS) 232 AC_SUBST(GMOCK_LIBS) 233 234 # Write generated configuration file 235 AC_CONFIG_FILES([Makefile src/glog/logging.h src/glog/raw_logging.h src/glog/vlog_is_on.h src/glog/stl_logging.h]) 236 AC_OUTPUT(libglog.pc)