summaryrefslogtreecommitdiff
path: root/modules/config5.m4
blob: caa40eaf70603ca25c2ddb673d9cbc497bb5cb81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
AC_MSG_CHECKING(for extra modules)
AC_ARG_WITH(module,
  [  --with-module=location  Include the specified module.  location is the
                          path to the new module.],
  [
    modtype=`echo $withval | sed -e's/\(.*\):.*/\1/'`
    pkg=`echo $withval | sed -e's/.*:\(.*\)/\1/'`
    modfilec=`echo $pkg | sed -e 's;^.*/;;'`
    modfileo=`echo $pkg | sed -e 's;^.*/;;' -e 's;\.c$;.o;'`

    if test "x$withval" != "xmodules/$modtype/$modfilec"; then
        cp $pkg modules/$modtype/$modfilec
    fi
    module=`echo $pkg | sed -e 's;.*/mod_\(.*\).c;\1;'`
    objects="mod_$module.lo"
    libname="mod_$module.la"
    modpath_current="modules/$modtype"
    BUILTIN_LIBS="$BUILTIN_LIBS $modpath_current/$libname"
    if test ! -s "$modpath_current/modules.mk"; then
      cat >>$modpath_current/modules.mk<<EOF
$libname: $objects
	\$(MOD_LINK) $objects
DISTCLEAN_TARGETS = modules.mk
static = $libname
shared =
EOF
    else
      cat >>$modpath_current/modules.mk.tmp<<EOF
$libname: $objects
	\$(MOD_LINK) $objects
EOF
      cat $modpath_current/modules.mk >> $modpath_current/modules.mk.tmp
      rm $modpath_current/modules.mk
      mv $modpath_current/modules.mk.tmp $modpath_current/modules.mk
      sed -e "s/\(static =.*\)/\1 $libname/" $modpath_current/modules.mk > $modpath_current/modules.mk.tmp
      rm $modpath_current/modules.mk
      mv $modpath_current/modules.mk.tmp $modpath_current/modules.mk
    fi
    MODLIST="$MODLIST $module"
  AC_MSG_RESULT(added $withval)
  ],
  [ AC_MSG_RESULT(no extra modules) 
  ])