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