Next: , Up: Basic Usage   [Contents][Index]


1.4.1 Autoconf Macros

Common autoconf macros can be used to find the library, such as:

AC_SEARCH_LIBS([micro_benchmark_init], [mbenchmark], [...])

MicroBenchmark comes with some (experimental) macros too:

This could be a basic example of their usage:

configure.ac:
---
@dots{}
AS_IF([@dots{}],
 [dnl To substitute CFLAGS/LIBS/LTLIBS
  MICRO_BENCHMARK_CHECK_C
  @dots{}
  dnl To substitute CXXFLAGS/CXXLIBS/CXXLTLIBS
  MICRO_BENCHMARK_CHECK_CXX
  @dots{}
  dnl For Guile, only checks are performed
  MICRO_BENCHMARK_CHECK_GUILE
 ])
@dots{}
---

Makefile.am:
---
@dots{}
ctest_CFLAGS += $(MICRO_BENCHMARK_CFLAGS)
ctest_LIBS += $(MICRO_BENCHMARK_LIBS)
@dots{}
# For the C++ library
cpptest_CXXFLAGS += $(MICRO_BENCHMARK_CXXFLAGS)
cpptest_LIBS += $(MICRO_BENCHMARK_CXXLIBS)
@dots{}
# Or with libtool
ltctest_LDADD += $(MICRO_BENCHMARK_LTLIBS)
ltcxxlttest_LDADD += $(MICRO_BENCHMARK_CXXLTLIBS)
@dots{}
---

Next: Other Build Systems, Up: Basic Usage   [Contents][Index]