knot-module.m4 1.38 KB
Newer Older
1 2 3 4 5 6 7 8 9
# KNOT_MODULE([module-name], [default], [non-shareable])
# ------------------------------------------------------
# Set Knot DNS module building

AC_DEFUN([KNOT_MODULE],
[
  AC_ARG_WITH([module-$1],
    AS_HELP_STRING([--with-module-$1=yes|shared|no], [Build '$1' module [default=$2]]),
    [module=$withval],
10 11 12 13
    AS_IF([test "$enable_modules" = "no"],
      [module=no],
      [module=$2]
    )
14 15
  )

16
  doc_modules="${doc_modules}.. include:: modules/$1/$1.rst\n"
17

18 19 20 21 22 23
  STATIC_MODULE_$1=no
  SHARED_MODULE_$1=no
  AS_CASE([$module],
   [yes],    [STATIC_MODULE_$1=yes
              static_modules="${static_modules}$1 "
              static_modules_declars="${static_modules_declars}extern const knotd_mod_api_t knotd_mod_api_$1;\n"
24
              static_modules_init="${static_modules_init}\\\\\n\t{ &knotd_mod_api_$1 },"],
25 26 27
   [shared], [SHARED_MODULE_$1=yes
              shared_modules="${shared_modules}$1 "
              AS_IF([test "$3" = "non-shareable"],
28 29 30
                    [AC_MSG_ERROR([Module $1 cannot be shared])])
              AS_IF([test "$enable_shared" != "yes"],
                    [AC_MSG_ERROR([Shared module $1 requires shared libraries])])],
31 32 33 34 35 36
   [no],     [],
   [*],      [AC_MSG_ERROR([Invalid value '$module' for --with-module-$1])]
  )
  AM_CONDITIONAL([STATIC_MODULE_$1], [test "$STATIC_MODULE_$1" = "yes"])
  AM_CONDITIONAL([SHARED_MODULE_$1], [test "$SHARED_MODULE_$1" = "yes"])
])