1dnl AC_CHECK_PLUGINS
2dnl Copyright (c) David Walluck 1999-2000
3dnl All rights reserved.
4
5AC_DEFUN(AC_CHECK_PLUGINS,
6[ if test x"$addl_plugins" != x"none"; then
7  if test x"`echo $addl_plugins | grep all`" != x""; then
8    one_plugins="`sed -n -e '/^#PLUGINS = /s///p' -e '/^#PLUGINS/q' < $srcdir/dll/Makefile.in`"
9    two_plugins="`echo "$addl_plugins" | sed 's/all//g'`"
10    addl_plugins="$one_plugins $two_plugins"
11  fi
12  for plugin in $addl_plugins; do
13    if test ! -d "$srcdir/dll/$plugin" -o -f "$srcdir/dll/$plugin.c"; then
14      AC_MSG_ERROR(plugin directory "$srcdir/dll/$plugin" or file "$srcdir/dll/$plugin.c" not found)
15    fi
16    # start of sound plugin stuff
17    if test x"$checked_sound_plugins" != x"1"; then
18      if test x"$plugin" = x"amp" -o x"$plugin" = x"wavplay"; then
19        checked_sound_plugins=1
20        AC_CHECK_HEADERS(machine/soundcard.h linux/soundcard.h sys/soundcard.h)
21        if test x"$ac_cv_header_machine_soundcard_h" = x"no" -a x"$ac_cv_header_linux_soundcard_h" = x"no" -a x"$ac_cv_header_sys_soundcard_h" = x"no"; then
22          noamp=1
23          nowavplay=1
24        fi
25        AC_CHECK_FUNC(mlock, , noamp=1)
26      fi
27      if test x"$noamp" = x"1"; then
28        addl_plugins="`echo "$addl_plugins" | sed 's/amp//g'`"
29      fi
30      if test x"$nowavplay" = x"1"; then
31        addl_plugins="`echo "$addl_plugins" | sed 's/wavplay//g'`"
32      fi
33    fi
34    # end of sound plugin stuff
35    if test x"$plugin" = x"xmms"; then
36      if test x"$checked_xmms_plugin" != x"1"; then
37        checked_xmms_plugin=1
38        AM_PATH_XMMS(0.9.5.1, AC_CHECK_LIB(c_r, pthread_attr_init, LIBS="$LIBS -lc_r",), addl_plugins="`echo "$addl_plugins" | sed 's/xmms//g'`")
39      fi
40    fi
41    if test x"$plugin" = x"europa"; then
42      if test x"$checked_europa_plugin" != x"1"; then
43        checked_europa_plugin=1
44        AC_CHECK_HEADER(mysql/mysql.h)
45        AC_CHECK_LIB(mysqlclient, mysql_query, MYSQL_LIBS="-lmysqlclient", addl_plugins="`echo "$addl_plugins" | sed 's/europa//g'`")
46        if test x"$ac_cv_header_mysql_mysql_h" = x"no"; then
47          addl_plugins="`echo "$addl_plugins" | sed 's/europa//g'`"
48        fi
49        AC_SUBST(MYSQL_LIBS)
50      fi
51    fi
52  done
53  fi
54  PLUGINS="`echo "$addl_plugins" | sed 's/  / /g'`"
55  AC_MSG_CHECKING(which plugins to build)
56  AC_MSG_RESULT($PLUGINS)
57  if test x"$PLUGINS" = x"none"; then
58    PLUGINS=""
59  fi
60  AC_SUBST(PLUGINS)
61  AC_DEFINE(HAVE_DLLIB, 1, Define this if you want loadable module support.)
62  AH_VERBATIM([WANT_DLL],
63  [/*
64 * Define this if you have shlib support and want plugin support in BitchX
65 * Note: Not all systems support this.
66 */
67#ifdef HAVE_DLLIB
68#define WANT_DLL
69#endif])
70])
71