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.

101 lines
4.4KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_open62541_check_lib.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_OPEN62541_CHECK_LIB([STATIC-FIRST = `no'], [ACTION-IF-FOUND],
  8. # [ACTION-IF-NOT-FOUND])
  9. #
  10. # DESCRIPTION
  11. #
  12. # Searches for the library file of the open62541 library [1].
  13. #
  14. # The open62541 library is a cmake-based project, that supplies both a
  15. # shared and a static library (with different names). The
  16. # AX_OPEN62541_CHECK_LIB macro can search for both and adds the first one
  17. # found to the LIBS Makefile variable. The search can be in either order
  18. # (shared first or static first), which is selectable on macro invocation
  19. # with the STATIC-FIRST parameter. The user can change this default by
  20. # invoking configure with either the --with-open62541-shared or
  21. # --with-open62541-static option (the named one is checked first).
  22. #
  23. # Either shared or static library can be excluded from checking completely
  24. # with the options --without-open62541-shared and
  25. # --without-open62541-static.
  26. #
  27. # If the with_open62541 shell variable is set to "no" (e.g. from running
  28. # the AX_OPEN62541_PATH macro and the user giving configure the option
  29. # "--without-open62541"), then expands ACTION-IF-NOT-FOUND without any
  30. # checks. The same is true if both --without-open62541-shared and
  31. # --without-open62541-static are given.
  32. #
  33. # [1]: <http://open62541.org/>
  34. #
  35. # LICENSE
  36. #
  37. # Copyright (c) 2016 Olaf Mandel <olaf@mandel.name>
  38. #
  39. # Copying and distribution of this file, with or without modification, are
  40. # permitted in any medium without royalty provided the copyright notice
  41. # and this notice are preserved. This file is offered as-is, without any
  42. # warranty.
  43. #serial 2
  44. # _AX_OPEN62541_CHECK_LIB_arg(THIS, OTHER)
  45. # ----------------------------------------
  46. # Define the option --with-open62541-THIS, including checking that no
  47. # unknown argument is given or that both --with-open62541-THIS and
  48. # --with-open62541-OTHER are called.
  49. m4_define([_AX_OPEN62541_CHECK_LIB_arg],
  50. [AC_ARG_WITH([open62541-$1],
  51. [AS_HELP_STRING([--with-open62541-$1],
  52. [search for the $1 open62541 library first])],
  53. [], [])dnl
  54. AS_IF([test x${with_open62541_$1:+set} == xset]dnl
  55. [ -a "x$with_open62541_$1" != xno -a "x$with_open62541_$1" != xyes],
  56. [AC_MSG_FAILURE([--with-open62541-$1 does not take an argument])],
  57. [test x${with_open62541_$1:+set} == xset]dnl
  58. [ -a "x$with_open62541_$1" == xyes -a x${with_open62541_$2:+set} == xset]dnl
  59. [ -a "x$with_open62541_$2" == xyes],
  60. [AC_MSG_FAILURE([--with-open62541-$1 and --with-open62541-$2 are]dnl
  61. [ mutually exclusive])])
  62. ])# _AX_OPEN62541_CHECK_LIB_arg
  63. # _AX_OPEN62541_CHECK_LIB_1(SHARED-STATIC, ACTION-IF-FOUND,
  64. # ACTION-IF-NOT-FOUND)
  65. # ---------------------------------------------------------
  66. # Checks for the desired library if not forbidden by
  67. # with_open62541_(shared|static) shell variables.
  68. m4_define([_AX_OPEN62541_CHECK_LIB_1],
  69. [m4_pushdef([lib], m4_if([$1], [shared], [open62541],
  70. [$1], [static], [open62541-static]))dnl
  71. AS_IF([test "x$with_open62541_$1" != xno],
  72. [AC_CHECK_LIB(m4_defn([lib]), [UA_Server_new], [$2], [$3])],
  73. [$3])
  74. m4_popdef([lib])dnl
  75. ])# _AX_OPEN62541_CHECK_LIB_1
  76. # AX_OPEN62541_CHECK_LIB([STATIC-FIRST], [ACTION-IF-FOUND],
  77. # [ACTION-IF-NOT-FOUND])
  78. # ---------------------------------------------------------
  79. AC_DEFUN([AX_OPEN62541_CHECK_LIB],
  80. [m4_pushdef([staticfirst], m4_normalize([$1]))dnl
  81. m4_bmatch(m4_defn([staticfirst]),
  82. [^\([Nn][Oo]?\|0\)$], [m4_define([staticfirst], [])])dnl
  83. m4_pushdef([first], m4_ifblank(m4_defn([staticfirst]), [shared], [static]))dnl
  84. m4_pushdef([secnd], m4_ifblank(m4_defn([staticfirst]), [static], [shared]))dnl
  85. dnl
  86. _AX_OPEN62541_CHECK_LIB_arg([shared], [static])dnl
  87. _AX_OPEN62541_CHECK_LIB_arg([static], [shared])dnl
  88. AS_IF([test x${with_open62541:+set} == xset -a "x$with_open62541" == xno],
  89. [$3],
  90. [test "x$with_open62541_]m4_defn([secnd])[" != xyes],
  91. [_AX_OPEN62541_CHECK_LIB_1(m4_defn([first]), [$2],
  92. [_AX_OPEN62541_CHECK_LIB_1(m4_defn([secnd]), [$2], [$3])])],
  93. [_AX_OPEN62541_CHECK_LIB_1(m4_defn([secnd]), [$2],
  94. [_AX_OPEN62541_CHECK_LIB_1(m4_defn([first]), [$2], [$3])])])dnl
  95. m4_popdef([staticfirst], [first], [secnd])dnl
  96. ])# AX_OPEN62541_CHECK_LIB