1m4_include(gtest/m4/acx_pthread.m4) 2 3AC_INIT([Google C++ Mocking Framework], 4 [1.6.0], 5 [googlemock@googlegroups.com], 6 [gmock]) 7 8# Provide various options to initialize the Autoconf and configure processes. 9AC_PREREQ([2.59]) 10AC_CONFIG_SRCDIR([./COPYING]) 11AC_CONFIG_AUX_DIR([build-aux]) 12AC_CONFIG_HEADERS([build-aux/config.h]) 13AC_CONFIG_FILES([Makefile]) 14AC_CONFIG_FILES([scripts/gmock-config], [chmod +x scripts/gmock-config]) 15 16# Initialize Automake with various options. We require at least v1.9, prevent 17# pedantic complaints about package files, and enable various distribution 18# targets. 19AM_INIT_AUTOMAKE([1.9 dist-bzip2 dist-zip foreign subdir-objects]) 20 21# Check for programs used in building Google Test. 22AC_PROG_CC 23AC_PROG_CXX 24AC_LANG([C++]) 25AC_PROG_LIBTOOL 26 27# TODO(chandlerc@google.com): Currently we aren't running the Python tests 28# against the interpreter detected by AM_PATH_PYTHON, and so we condition 29# HAVE_PYTHON by requiring "python" to be in the PATH, and that interpreter's 30# version to be >= 2.3. This will allow the scripts to use a "/usr/bin/env" 31# hashbang. 32PYTHON= # We *do not* allow the user to specify a python interpreter 33AC_PATH_PROG([PYTHON],[python],[:]) 34AS_IF([test "$PYTHON" != ":"], 35 [AM_PYTHON_CHECK_VERSION([$PYTHON],[2.3],[:],[PYTHON=":"])]) 36AM_CONDITIONAL([HAVE_PYTHON],[test "$PYTHON" != ":"]) 37 38# TODO(chandlerc@google.com) Check for the necessary system headers. 39 40# Configure pthreads. 41AC_ARG_WITH([pthreads], 42 [AS_HELP_STRING([--with-pthreads], 43 [use pthreads (default is yes)])], 44 [with_pthreads=$withval], 45 [with_pthreads=check]) 46 47have_pthreads=no 48AS_IF([test "x$with_pthreads" != "xno"], 49 [ACX_PTHREAD( 50 [], 51 [AS_IF([test "x$with_pthreads" != "xcheck"], 52 [AC_MSG_FAILURE( 53 [--with-pthreads was specified, but unable to be used])])]) 54 have_pthreads="$acx_pthread_ok"]) 55AM_CONDITIONAL([HAVE_PTHREADS],[test "x$have_pthreads" == "xyes"]) 56AC_SUBST(PTHREAD_CFLAGS) 57AC_SUBST(PTHREAD_LIBS) 58 59# GoogleMock currently has hard dependencies upon GoogleTest above and beyond 60# running its own test suite, so we both provide our own version in 61# a subdirectory and provide some logic to use a custom version or a system 62# installed version. 63AC_ARG_WITH([gtest], 64 [AS_HELP_STRING([--with-gtest], 65 [Specifies how to find the gtest package. If no 66 arguments are given, the default behavior, a 67 system installed gtest will be used if present, 68 and an internal version built otherwise. If a 69 path is provided, the gtest built or installed at 70 that prefix will be used.])], 71 [], 72 [with_gtest=yes]) 73AC_ARG_ENABLE([external-gtest], 74 [AS_HELP_STRING([--disable-external-gtest], 75 [Disables any detection or use of a system 76 installed or user provided gtest. Any option to 77 '--with-gtest' is ignored. (Default is enabled.)]) 78 ], [], [enable_external_gtest=yes]) 79AS_IF([test "x$with_gtest" == "xno"], 80 [AC_MSG_ERROR([dnl 81Support for GoogleTest was explicitly disabled. Currently GoogleMock has a hard 82dependency upon GoogleTest to build, please provide a version, or allow 83GoogleMock to use any installed version and fall back upon its internal 84version.])]) 85 86# Setup various GTEST variables. TODO(chandlerc@google.com): When these are 87# used below, they should be used such that any pre-existing values always 88# trump values we set them to, so that they can be used to selectively override 89# details of the detection process. 90AC_ARG_VAR([GTEST_CONFIG], 91 [The exact path of Google Test's 'gtest-config' script.]) 92AC_ARG_VAR([GTEST_CPPFLAGS], 93 [C-like preprocessor flags for Google Test.]) 94AC_ARG_VAR([GTEST_CXXFLAGS], 95 [C++ compile flags for Google Test.]) 96AC_ARG_VAR([GTEST_LDFLAGS], 97 [Linker path and option flags for Google Test.]) 98AC_ARG_VAR([GTEST_LIBS], 99 [Library linking flags for Google Test.]) 100AC_ARG_VAR([GTEST_VERSION], 101 [The version of Google Test available.]) 102HAVE_BUILT_GTEST="no" 103 104GTEST_MIN_VERSION="1.6.0" 105 106AS_IF([test "x${enable_external_gtest}" = "xyes"], 107 [# Begin filling in variables as we are able. 108 AS_IF([test "x${with_gtest}" != "xyes"], 109 [AS_IF([test -x "${with_gtest}/scripts/gtest-config"], 110 [GTEST_CONFIG="${with_gtest}/scripts/gtest-config"], 111 [GTEST_CONFIG="${with_gtest}/bin/gtest-config"]) 112 AS_IF([test -x "${GTEST_CONFIG}"], [], 113 [AC_MSG_ERROR([dnl 114Unable to locate either a built or installed Google Test at '${with_gtest}'.]) 115 ])]) 116 117 AS_IF([test -x "${GTEST_CONFIG}"], [], 118 [AC_PATH_PROG([GTEST_CONFIG], [gtest-config])]) 119 AS_IF([test -x "${GTEST_CONFIG}"], 120 [AC_MSG_CHECKING([for Google Test version >= ${GTEST_MIN_VERSION}]) 121 AS_IF([${GTEST_CONFIG} --min-version=${GTEST_MIN_VERSION}], 122 [AC_MSG_RESULT([yes]) 123 HAVE_BUILT_GTEST="yes"], 124 [AC_MSG_RESULT([no])])])]) 125 126AS_IF([test "x${HAVE_BUILT_GTEST}" = "xyes"], 127 [GTEST_CPPFLAGS=`${GTEST_CONFIG} --cppflags` 128 GTEST_CXXFLAGS=`${GTEST_CONFIG} --cxxflags` 129 GTEST_LDFLAGS=`${GTEST_CONFIG} --ldflags` 130 GTEST_LIBS=`${GTEST_CONFIG} --libs` 131 GTEST_VERSION=`${GTEST_CONFIG} --version`], 132 [AC_CONFIG_SUBDIRS([gtest]) 133 # GTEST_CONFIG needs to be executable both in a Makefile environmont and 134 # in a shell script environment, so resolve an absolute path for it here. 135 GTEST_CONFIG="`pwd -P`/gtest/scripts/gtest-config" 136 GTEST_CPPFLAGS='-I$(top_srcdir)/gtest/include' 137 GTEST_CXXFLAGS='-g' 138 GTEST_LDFLAGS='' 139 GTEST_LIBS='$(top_builddir)/gtest/lib/libgtest.la' 140 GTEST_VERSION="${GTEST_MIN_VERSION}"]) 141 142# TODO(chandlerc@google.com) Check the types, structures, and other compiler 143# and architecture characteristics. 144 145# Output the generated files. No further autoconf macros may be used. 146AC_OUTPUT 147