summaryrefslogtreecommitdiff
path: root/Drivers.macros
blob: d7168fa64cfe67e4f75c3861a8ec51875757fe81 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
dnl
dnl Some autoconf macros useful for device driver configuration
dnl
dnl Copyright 1997, 2006 Free Software Foundation, Inc.
dnl Permission to use, copy, modify and distribute this software and its
dnl documentation is hereby granted, provided that both the copyright
dnl notice and this permission notice appear in all copies of the
dnl software, derivative works or modified versions, and any portions
dnl thereof, and that both notices appear in supporting documentation.
dnl
dnl THE FREE SOFTWARE FOUNDATION ALLOWS FREE USE OF THIS SOFTWARE IN ITS
dnl "AS IS" CONDITION.  THE FREE SOFTWARE FOUNDATION DISCLAIMS ANY
dnl LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
dnl USE OF THIS SOFTWARE.

AC_SUBST([device_drivers])

dnl AC_DRIVER_CLASS(name,option,files) defines a class of drivers.  If
dnl any driver declared by AC_DRIVER to be in that class is selected
dnl by the user, then set the specified option with AC_DEFINE and add
dnl the specified files to the output variable `device_drivers'.  This
dnl macro must precede the use of any corresponding AC_DRIVER macros.

AC_DEFUN([AC_DRIVER_CLASS], [
AH_TEMPLATE([$2], [Driver Class $1])
driver_class_$1_option=$2
driver_class_$1_files="$3"
])

dnl AC_DRIVER(name,description,option,files[,class]).  Process configuration
dnl option --enable-`name' (with description dnl `description').  If
dnl it's set, then `option' is defined with AC_DEFINE, and files is
dnl added to the output variable `device_drivers'.  The driver is of class
dnl `class'; see the comments on AC_DRIVER_CLASS for more information.
dnl By default, the value from $enable_default_device_drivers is considered
dnl when deciding whether to activate the device driver or not.

AC_DEFUN([AC_DRIVER], [
AC_ARG_ENABLE([$1],
  AS_HELP_STRING([--disable-$1], [disable driver $2]))
[enable_$1=${enable_$1-$enable_default_device_drivers}
if test x"$enable_$1" = xyes; then]
  AC_DEFINE([$3], [1], [$1])
  [device_drivers="$device_drivers $4"
  if test "${driver_class_$5_selected+set}" != set; then
    driver_class_$5_selected=yes]
    AC_DEFINE_UNQUOTED([$driver_class_$5_option], [1])
    [device_drivers="$device_drivers $driver_class_$5_files"
  fi
fi]])

dnl AC_DEFUN_nodef() is like AC_DRIVER(), but doesn't consider
dnl $enable_default_device_drivers.

AC_DEFUN([AC_DRIVER_nodef], [
AC_ARG_ENABLE([$1],
  AS_HELP_STRING([--enable-$1], [enable driver $2]), [
if test x"$enableval" = xyes; then
  AC_DEFINE([$3], [1], [$1])
  device_drivers="$device_drivers $4"
  if test "${driver_class_$5_selected+set}" != set; then
    driver_class_$5_selected=yes
    AC_DEFINE_UNQUOTED([$driver_class_$5_option], [1])
    device_drivers="$device_drivers $driver_class_$5_files"
  fi
fi])])