# make sure we're interpreted by some minimal autoconf
AC_PREREQ(2.57)
-AC_INIT(glog, 0.2, opensource@google.com)
+AC_INIT(glog, 0.2.1, opensource@google.com)
# The argument here is just something that should be in the current directory
# (for sanity checking)
AC_CONFIG_SRCDIR(README)
fi
# Check if there is google-gflags library installed.
+SAVE_CFLAGS="$CFLAGS"
+SAVE_LIBS="$LIBS"
+AC_ARG_WITH(gflags, AS_HELP_STRING[--with-gflags=GFLAGS_DIR],
+ GFLAGS_CFLAGS="-I${with_gflags}/include"
+ GFLAGS_LIBS="-L${with_gflags}/lib -lgflags"
+ CFLAGS="$CFLAGS $GFLAGS_CFLAGS"
+ LIBS="$LIBS $GFLAGS_LIBS"
+)
AC_CHECK_LIB(gflags, main, ac_cv_have_libgflags=1, ac_cv_have_libgflags=0)
if test x"$ac_cv_have_libgflags" = x"1"; then
- GFLAGS_LIBS=-lgflags
AC_DEFINE(HAVE_LIB_GFLAGS, 1, [define if you have google gflags library])
+ if test x"$GFLAGS_LIBS" = x""; then
+ GFLAGS_LIBS="-lgflags"
+ fi
else
+ GFLAGS_CFLAGS=
GFLAGS_LIBS=
fi
+CFLAGS="$SAVE_CFLAGS"
+LIBS="$SAVE_LIBS"
# TODO(hamaji): Use official m4 macros provided by testing libraries
# once the m4 macro of Google Mocking becomes ready.
AC_CXX_USING_OPERATOR
-# We want to access the "PC" (Program Counter) register from a struct
-# ucontext. Every system has its own way of doing that. We try all the
-# possibilities we know about. Note REG_PC should come first (REG_RIP
-# is also defined on solaris, but does the wrong thing).
-AC_MSG_CHECKING([how to access the program counter from a struct ucontext])
-pc_fields=" uc_mcontext.gregs[[REG_PC]]" # Solaris x86 (32 + 64 bit)
-pc_fields="$pc_fields uc_mcontext.gregs[[REG_EIP]]" # Linux (i386)
-pc_fields="$pc_fields uc_mcontext.gregs[[REG_RIP]]" # Linux (x86_64)
-pc_fields="$pc_fields uc_mcontext.sc_ip" # Linux (ia64)
-pc_fields="$pc_fields uc_mcontext.uc_regs->gregs[[PT_NIP]]" # Linux (ppc)
-pc_fields="$pc_fields uc_mcontext.gregs[[R15]]" # Linux (arm old [untested])
-pc_fields="$pc_fields uc_mcontext.arm_pc" # Linux (arm new [untested])
-pc_fields="$pc_fields uc_mcontext.mc_eip" # FreeBSD (i386)
-pc_fields="$pc_fields uc_mcontext.mc_rip" # FreeBSD (x86_64 [untested])
-pc_fields="$pc_fields uc_mcontext->ss.eip" # OS X (i386, <=10.4)
-pc_fields="$pc_fields uc_mcontext->__ss.__eip" # OS X (i386, >=10.5)
-pc_fields="$pc_fields uc_mcontext->ss.rip" # OS X (x86_64)
-pc_fields="$pc_fields uc_mcontext->__ss.__rip" # OS X (>=10.5 [untested])
-pc_fields="$pc_fields uc_mcontext->ss.srr0" # OS X (ppc, ppc64 [untested])
-pc_fields="$pc_fields uc_mcontext->__ss.__srr0" # OS X (>=10.5 [untested])
-pc_field_found=false
-for pc_field in $pc_fields; do
- if ! $pc_field_found; then
- AC_TRY_COMPILE([#define _GNU_SOURCE 1
- #include <ucontext.h>],
- [ucontext_t u; return u.$pc_field == 0;],
- AC_DEFINE_UNQUOTED(PC_FROM_UCONTEXT, $pc_field,
- How to access the PC from a struct ucontext)
- AC_MSG_RESULT([$pc_field])
- pc_field_found=true)
- fi
-done
-if ! $pc_field_found; then
- AC_MSG_WARN(Could not find the PC. Will not output failed addresses...)
-fi
+AC_PC_FROM_UCONTEXT(AC_MSG_WARN(Could not find the PC. Will not output failed addresses...))
# These are what's needed by logging.h.in and raw_logging.h.in
AC_SUBST(ac_google_start_namespace)
AC_SUBST(ac_cv_have_u_int16_t)
AC_SUBST(ac_cv_have___uint16)
AC_SUBST(ac_cv_have_libgflags)
-AC_SUBST(GFLAGS_LIBS)
+AC_SUBST(GFLAGS_CFLAGS)
AC_SUBST(GTEST_CFLAGS)
AC_SUBST(GMOCK_CFLAGS)
+AC_SUBST(GFLAGS_LIBS)
AC_SUBST(GTEST_LIBS)
AC_SUBST(GMOCK_LIBS)
# Write generated configuration file
AC_CONFIG_FILES([Makefile src/glog/logging.h src/glog/raw_logging.h src/glog/vlog_is_on.h src/glog/stl_logging.h])
-AC_OUTPUT
+AC_OUTPUT(libglog.pc)