summaryrefslogtreecommitdiff
path: root/m4/gtest.m4
blob: 6c3fc287641ce877bff15f7ba73e7aa07d3dc66c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Checks whether the gtest library is available on the system
# Allows for adjusting the include and library path.
# Sets have_gtest=yes if the library is present and
# reports the compiler and linker flags in 
# GTEST_CXXFLAGS AND GTEST_LDFLAGS, respectively.
AC_DEFUN([AC_CHECK_GTEST],
[
  AC_ARG_WITH([gtest-include-path],
  [AS_HELP_STRING([--with-gtest-include-path],
    [location of the Google test headers, defaults to /usr/include])],
  [GTEST_CXXFLAGS="-I$withval"],
  [GTEST_CXXFLAGS='-I/usr/include'])

  AC_ARG_WITH([gtest-lib-path],
  [AS_HELP_STRING([--with-gtest-lib-path], [location of the Google test libraries])],
  [GTEST_LDFLAGS="-L$withval -lpthread"],
  [GTEST_LDFLAGS='-lgtest -lpthread'])

  AC_LANG_PUSH(C++)

  AC_CHECK_LIB([gtest], [main], [:], [:], [-lpthread])

  AC_LANG_POP
]) # AC_CHECK_GTEST