configure.ac 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. AC_INIT(Lhasa, 0.3.1, [email protected], lhasa)
  2. AC_CONFIG_AUX_DIR(autotools)
  3. AM_INIT_AUTOMAKE([no-define])
  4. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  5. AM_PROG_CC_C_O
  6. AC_PROG_CXX
  7. AC_PROG_RANLIB
  8. AC_PROG_LIBTOOL
  9. AC_PROG_INSTALL
  10. AC_PROG_MAKE_SET
  11. if [[ "$GCC" = "yes" ]]; then
  12. is_gcc=true
  13. else
  14. is_gcc=false
  15. fi
  16. TEST_CFLAGS="-DTEST_BUILD"
  17. # Turn on all warnings for gcc. Turn off optimisation for the test build.
  18. if $is_gcc; then
  19. WARNINGS="-Wall -Wsign-compare"
  20. CFLAGS="$CFLAGS $WARNINGS"
  21. TEST_CFLAGS="$TEST_CFLAGS $WARNINGS -O0"
  22. fi
  23. # Support for coverage analysis via gcov:
  24. coverage=false
  25. AC_ARG_ENABLE(coverage,
  26. [ --enable-coverage Enable coverage testing. ],
  27. [ coverage=true ])
  28. if $coverage; then
  29. if $is_gcc; then
  30. TEST_CFLAGS="$TEST_CFLAGS -fprofile-arcs -ftest-coverage"
  31. else
  32. AC_MSG_ERROR([Can only enable coverage when using gcc.])
  33. fi
  34. fi
  35. AM_CONDITIONAL(BUILD_COVERAGE, $coverage)
  36. # Support for running test cases using valgrind:
  37. use_valgrind=false
  38. AC_ARG_ENABLE(valgrind,
  39. [ --enable-valgrind Use valgrind when running unit tests. ],
  40. [ use_valgrind=true ])
  41. if [[ "$use_valgrind" = "true" ]]; then
  42. AC_CHECK_PROG(HAVE_VALGRIND, valgrind, yes, no)
  43. if [[ "$HAVE_VALGRIND" = "no" ]]; then
  44. AC_MSG_ERROR([Valgrind not found in PATH. ])
  45. fi
  46. fi
  47. AM_CONDITIONAL(USE_VALGRIND, $use_valgrind)
  48. # Save the default CFLAGS and clear them, so that the test build
  49. # of the library doesn't get the optimisation flags.
  50. MAIN_CFLAGS="$CFLAGS"
  51. CFLAGS=""
  52. AC_SUBST(MAIN_CFLAGS)
  53. AC_SUBST(TEST_CFLAGS)
  54. AC_SUBST(ac_aux_dir)
  55. AC_CONFIG_HEADERS([config.h:config.hin])
  56. AC_OUTPUT([
  57. liblhasa.pc
  58. rpm.spec
  59. Makefile
  60. doc/Makefile
  61. lib/Makefile
  62. lib/public/Makefile
  63. pkg/Makefile
  64. pkg/config.make
  65. src/Makefile
  66. test/Makefile
  67. ])