synced ASCII version
[platform/upstream/cryptsetup.git] / acinclude.m4
1 dnl MODULE_HELPER(NAME, HELP, DEFAULT, COMMANDS)
2 AC_DEFUN([MODULE_HELPER],[
3         unset have_module
4         AC_ARG_ENABLE([$1], [$2],,[
5                 if test "x${enable_all}" = "xdefault"; then
6                         enable_[$1]=[$3]
7                 else
8                         enable_[$1]="${enable_all}"
9                 fi
10         ])
11         if test "x${enable_[$1]}" != "xno"; then
12                 $4
13                 AC_MSG_CHECKING([whether to build $1 module])
14                 if test -n "${have_module+set}"; then
15                         if test "x${enable_[$1]}" = "xauto"; then
16                                 if test "x${enable_plugins}" != "xno"; then
17                                         AC_MSG_RESULT([yes, as plugin]) 
18                                         build_static=no
19                                         build_shared=yes
20                                 else
21                                         AC_MSG_RESULT([yes]) 
22                                         build_static=yes
23                                         build_shared=no
24                                 fi
25                         elif test "x${enable_[$1]}" = "xshared"; then
26                                 if test "x${enable_plugins}" != "xno"; then
27                                         AC_MSG_RESULT([yes, as plugin]) 
28                                         build_static=no
29                                         build_shared=yes
30                                 else
31                                         AC_MSG_RESULT([no]) 
32                                         AC_MSG_ERROR([Can't build [$1] module, plugins are disabled])
33                                 fi
34                         else
35                                 AC_MSG_RESULT([yes]) 
36                                 build_static=yes
37                                 build_shared=no
38                         fi
39                 elif test "x${enable_[$1]}" != "xauto"; then
40                         AC_MSG_RESULT([no]) 
41                         AC_MSG_ERROR([Unable to build $1 plugin, see messages above])
42                 else    
43                         AC_MSG_RESULT([no]) 
44                         build_static=no
45                         build_shared=no
46                 fi
47         else
48                 AC_MSG_CHECKING([whether to build $1 module])
49                 AC_MSG_RESULT([no]) 
50                 build_static=no
51                 build_shared=no
52         fi
53 ])