configure.ac 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. dnl Process this file with autoconf to produce a configure script.
  2. AC_PREREQ(2.59)
  3. AC_INIT(Open62541, 1.0)
  4. AC_CANONICAL_SYSTEM
  5. AM_INIT_AUTOMAKE([subdir-objects])
  6. AC_PROG_MAKE_SET
  7. #default CFLAGS is -g -02
  8. #reset it just to -g and make optimization dependend on --enable-debug
  9. if test -z $CFLAGS; then
  10. CFLAGS='-g'
  11. fi
  12. AM_PATH_PYTHON
  13. AC_PROG_CC
  14. AC_PROG_LN_S
  15. AM_PROG_CC_C_O
  16. AC_CHECK_LIB([m],[exp],,AC_MSG_ERROR([Libm missing]))
  17. AC_CHECK_LIB([expat],[XML_Parse],,AC_MSG_ERROR([Libexpat missing]))
  18. PKG_CHECK_MODULES([CHECK], [check >= 0.9.12],[have_check="yes"],AC_MSG_WARN([Check not found or check version lower than 0.9.12; cannot run unit tests!])
  19. [have_check="no"])
  20. AM_CONDITIONAL([HAVE_CHECK], [test x"$have_check" = "xyes"])
  21. AM_CONDITIONAL([TARGET_WIN],[test "${host_os}" = "mingw32"])
  22. AM_CONDITIONAL([TARGET_LINUX],[test "${host_os}" = "linux-gnu" || test "${host_os}" = "linux"])
  23. #adding platform-dependent information to compile flags
  24. AM_COND_IF([TARGET_WIN],
  25. AC_DEFINE([WINDOWS])) #define WINDOWS is accessible from pre-processor
  26. AM_COND_IF([TARGET_LINUX],
  27. AC_DEFINE([LINUX]))
  28. AC_ARG_ENABLE(debug,
  29. AS_HELP_STRING([--enable-debug],
  30. [enable debugging, default: no]),
  31. [case "${enableval}" in
  32. yes) debug=true; verbose=false ;;
  33. no) debug=false; verbose=false ;;
  34. verbose) debug=true; verbose=true ;;
  35. *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
  36. esac],[debug=false])
  37. AM_CONDITIONAL(DEBUG, test x"$debug" = x"true")
  38. AM_COND_IF([DEBUG],
  39. AC_DEFINE([DEBUG])) #define DEBUG is accessible from pre-processor
  40. AM_CONDITIONAL(VERBOSE, test x"$verbose" = x"true")
  41. AM_COND_IF([VERBOSE],
  42. AC_DEFINE([VERBOSE])) #define VERBOSE is accessible from pre-processor
  43. AC_ARG_ENABLE(multithreading,
  44. AS_HELP_STRING([--enable-multithreading],
  45. [enable multithreading, default: yes]),
  46. [case "${enableval}" in
  47. yes) multithreading=true ;;
  48. no) multithreading=false ;;
  49. *) AC_MSG_ERROR([bad value ${enableval} for --enable-multithreading]) ;;
  50. esac],[multithreading=false])
  51. AM_CONDITIONAL(MULTITHREADING, test x"$multithreading" = x"true")
  52. AM_COND_IF([MULTITHREADING],
  53. AC_DEFINE([MULTITHREADING])) #define MULTITHREADING is accessible from pre-processor
  54. AC_ARG_ENABLE(coverage,
  55. AS_HELP_STRING([--enable-coverage],
  56. [enable coverage, default: no]),
  57. [case "${enableval}" in
  58. yes) coverage=true ;;
  59. no) coverag=false ;;
  60. *) AC_MSG_ERROR([bad value ${enableval} for --enable-coverage]) ;;
  61. esac],[coverage=false])
  62. AM_CONDITIONAL(COVERAGE, test x"$coverage" = x"true")
  63. AM_COND_IF([COVERAGE],
  64. AC_DEFINE([COVERAGE])) #define MULTITHREADING is accessible from pre-processor
  65. #doxygen start
  66. AC_ARG_ENABLE(doxygen,
  67. AS_HELP_STRING([--enable-doxygen],
  68. [enable doxygen, default: no]),
  69. [case "${enableval}" in
  70. yes) enabledoxygen=true ;;
  71. no) enabledoxygen=false ;;
  72. *) AC_MSG_ERROR([bad value ${enableval} for --enable-doxygen]) ;;
  73. esac],[enabledoxygen=false])
  74. AM_CONDITIONAL(ENABLE_DOXYGEN, test x"$enabledoxygen" = x"true")
  75. AC_CHECK_PROGS([DOXYGEN], [doxygen])
  76. AC_CHECK_PROGS([DOT], [dot])
  77. #break if doxygen enabled but not present
  78. if test x"$enabledoxygen" = x"true"; then
  79. if test -z "$DOXYGEN"; then
  80. AC_MSG_ERROR([Doxygen not found])
  81. fi
  82. if test -z "$DOT"; then
  83. AC_MSG_ERROR([Graphviz not found])
  84. fi
  85. fi
  86. AM_COND_IF([ENABLE_DOXYGEN], [AC_CONFIG_FILES([doc/Doxyfile])])
  87. #doxygen end
  88. AC_LIBTOOL_WIN32_DLL
  89. AC_PROG_LIBTOOL
  90. AC_CONFIG_MACRO_DIR([m4])
  91. AC_CONFIG_FILES(Makefile include/Makefile src/Makefile tools/Makefile tests/Makefile examples/src/Makefile doc/Makefile)
  92. AC_OUTPUT