Collection of DPF-based plugins for packaging
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

113 lines
4.6KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_open62541_path.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_OPEN62541_PATH()
  8. #
  9. # DESCRIPTION
  10. #
  11. # Sets pre-processor and linker search paths for the open62541 library
  12. # [1].
  13. #
  14. # The open62541 library is a cmake-based project, that is not always
  15. # installed to the system: it does not even provide an install target by
  16. # default. In that case, the location of several directories need to be
  17. # added to the pre-processor and linker search paths:
  18. #
  19. # * -I<src>/deps
  20. # * -I<src>/include
  21. # * -I<src>/plugins
  22. # * -I<build>/src_generated
  23. # * -I<build>
  24. # * -L<build>
  25. #
  26. # Here "src" indicates the location of the library source directory and
  27. # "build" the location of the out-of-source build.
  28. #
  29. # This macro provides the configure options --with-open62541=dir and
  30. # --with-open62541-build=dir to set the two directories. This macro will
  31. # append to CPPFLAGS and LDFLAGS if a dir is supplied. It will also export
  32. # LD_LIBRARY_PATH with the absolute path of the build dir for the rest of
  33. # the configure script to use and define a Makefile variable
  34. # OPEN62541_LDPATH, which contains
  35. # LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<abs_path_to_build> : this is intended
  36. # to be used for all commands that need to execute a program using the
  37. # library (e.g. make check). If paths are set, they are forwarded to
  38. # distcheck.
  39. #
  40. # For --with-open62541, the dir is optional: if either the values "no"
  41. # (from --without-open62541) or "yes" (for no argument) are specified,
  42. # this macro does nothing but these values may be used by other code. If
  43. # --with-open62541 is not specified, the variable with_open62541 is not
  44. # set.
  45. #
  46. # For --with-open62541-build, the dir is compulsory.
  47. # --with-open62541-build must not be given without also specifying
  48. # --with-open62541. If --with-open62541 is given but
  49. # --with-open62541-build is not, the default value is "<src>/build".
  50. #
  51. # [1]: <http://open62541.org/>
  52. #
  53. # LICENSE
  54. #
  55. # Copyright (c) 2016,2017 Olaf Mandel <olaf@mandel.name>
  56. #
  57. # Copying and distribution of this file, with or without modification, are
  58. # permitted in any medium without royalty provided the copyright notice
  59. # and this notice are preserved. This file is offered as-is, without any
  60. # warranty.
  61. #serial 5
  62. # AX_OPEN62541_PATH()
  63. # -------------------
  64. AC_DEFUN([AX_OPEN62541_PATH],
  65. [AC_ARG_WITH([open62541],
  66. [AS_HELP_STRING([--with-open62541@<:@=dir@:>@],
  67. [set the open62541 library source location])],
  68. [], [])dnl
  69. AC_ARG_WITH([open62541-build],
  70. [AS_HELP_STRING([--with-open62541-build=dir],
  71. [set the open62541 build dir location]dnl
  72. [ (@<:@default=$src/build@:>@)])],
  73. [], [])dnl
  74. [with_open62541=${with_open62541%/}]
  75. AS_IF([test x${with_open62541_build:+set} != xset],
  76. [AS_IF([test x${with_open62541:+set} == xset]dnl
  77. [ -a "x$with_open62541" != xno -a "x$with_open62541" != xyes],
  78. [with_open62541_build=$with_open62541/build])],
  79. [test "x$with_open62541_build" == xno]dnl
  80. [ -o "x$with_open62541_build" == xyes],
  81. [AC_MSG_FAILURE([--with-open62541-build needs its argument])],
  82. [test x${with_open62541:+set} != xset -o "x$with_open62541" == xyes],
  83. [AC_MSG_FAILURE([--with-open62541-build also requires]dnl
  84. [ --with-open62541 to set a directory])],
  85. [with_open62541_build=${with_open62541_build%/}])
  86. dnl
  87. AS_IF([test x${with_open62541:+set} == xset -a "x$with_open62541" != xno]dnl
  88. [ -a "x$with_open62541" != xyes],
  89. [CPPFLAGS="$CPPFLAGS${CPPFLAGS:+ }-I$with_open62541/deps]dnl
  90. [ -I$with_open62541/include -I$with_open62541/plugins]dnl
  91. [ -I$with_open62541_build/src_generated -I$with_open62541_build"
  92. LDFLAGS="$LDFLAGS${LDFLAGS:+ }-L$with_open62541_build"
  93. with_open62541_abs=`(
  94. cd "$with_open62541"
  95. pwd)`
  96. with_open62541_build_abs=`(
  97. cd "$with_open62541_build"
  98. pwd)`
  99. export LD_LIBRARY_PATH="$LD_LIBRARY_PATH${LD_LIBRARY_PATH:+:}]dnl
  100. [$with_open62541_build_abs"
  101. AC_SUBST([OPEN62541_LDPATH], ["LD_LIBRARY_PATH=\$\$LD_LIBRARY_PATH]dnl
  102. [\$\${LD_LIBRARY_PATH:+:}$with_open62541_build_abs"])
  103. AC_SUBST([AM_DISTCHECK_CONFIGURE_FLAGS], ["$AM_DISTCHECK_CONFIGURE_FLAGS]dnl
  104. [${AM_DISTCHECK_CONFIGURE_FLAGS:+ }--with-open62541=$with_open62541_abs"])
  105. AS_IF([test x$with_open62541/build != xwith_open62541_build],
  106. [AC_SUBST([AM_DISTCHECK_CONFIGURE_FLAGS],
  107. ["$AM_DISTCHECK_CONFIGURE_FLAGS]dnl
  108. [ --with-open62541-build=$with_open62541_build_abs"])])
  109. ])
  110. ])# AX_OPEN62541_PATH