4e3819cf |
1 | dnl -*-fundamental-*- |
2 | dnl |
7a80a79a |
3 | dnl $Id: configure.in,v 1.2 2001/02/03 18:39:37 mdw Exp $ |
4e3819cf |
4 | dnl |
5 | dnl Configuration script for usernet |
6 | dnl |
7 | dnl (c) 1998 Mark Wooding |
8 | dnl |
9 | |
10 | dnl----- Licensing notice --------------------------------------------------- |
11 | dnl |
12 | dnl This program is free software; you can redistribute it and/or modify |
13 | dnl it under the terms of the GNU General Public License as published by |
14 | dnl the Free Software Foundation; either version 2 of the License, or |
15 | dnl (at your option) any later version. |
16 | dnl |
17 | dnl This program is distributed in the hope that it will be useful, |
18 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of |
19 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
20 | dnl GNU General Public License for more details. |
21 | dnl |
22 | dnl You should have received a copy of the GNU General Public License |
23 | dnl along with this program; if not, write to the Free Software Foundation, |
24 | dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
25 | |
26 | dnl --- Boring header things --- |
27 | |
28 | AC_INIT(unet.c) |
29 | AM_INIT_AUTOMAKE(usernet, 1.1) |
30 | AM_CONFIG_HEADER(unetconf.h) |
31 | AC_PROG_CC |
32 | AC_CANONICAL_HOST |
33 | |
34 | dnl --- Make sure we recognise the environment --- |
35 | |
36 | case $host in |
37 | *-linux*) ;; |
38 | *) |
39 | AC_MSG_ERROR([It would help a lot if you compiled under Linux.]) |
40 | ;; |
41 | esac |
42 | |
43 | kernelversion=`uname -r` |
44 | |
45 | dnl --- Find the Linux kernel sources --- |
46 | |
47 | AC_ARG_WITH([linux-source], |
48 | [ --with-linux-source=DIR directory containing Linux kernel source], |
49 | [linuxdir="$withval"], |
50 | [AC_CACHE_CHECK([where the Linux kernel source is], |
51 | [mdw_cv_linux_source], |
52 | [for i in /usr/src/linux /usr/src/linux-$kernelversion; do |
53 | if test -f $i/kernel/ksyms.c; then |
54 | mdw_cv_linux_source=$i |
55 | break |
56 | fi |
57 | done |
58 | if test -z "$mdw_cv_linux_source"; then |
59 | AC_MSG_ERROR([Failed to find the Linux source. Where is it?]) |
60 | fi]) |
61 | linuxdir="$mdw_cv_linux_source"]) |
62 | AC_SUBST(linuxdir) |
63 | |
64 | dnl --- Find Perl --- |
65 | |
66 | mdw_PROG_PERL(5.003) |
67 | mdw_CHECK_PERL(5.003) |
68 | |
69 | dnl --- Play with GCC command line arguments --- |
70 | |
71 | mdw_GCC_FLAGS([-Wall -fomit-frame-pointer -fno-strength-reduce]) |
72 | |
73 | NCFLAGS="" |
74 | for i in $CFLAGS; do |
75 | case $i in |
76 | -g) ;; |
77 | *) NCFLAGS="$NCFLAGS $i" |
78 | esac |
79 | done |
80 | CFLAGS="$NCFLAGS" |
81 | |
82 | dnl --- Decide where to put the module --- |
83 | |
84 | AC_ARG_WITH([module-dir], |
85 | [ --with-module-dir=DIR directory to install the module in], |
86 | [moduledir="$withval"], |
87 | [AC_CACHE_CHECK([for a good place to store kernel modules], |
88 | [mdw_cv_module_dir], |
7a80a79a |
89 | [for i in /lib/modules/misc /lib/modules/$kernelversion/misc; do |
4e3819cf |
90 | if test -d $i; then |
91 | mdw_cv_module_dir=$i |
92 | break |
93 | fi |
94 | done]) |
95 | if test -z "$mdw_cv_module_dir"; then |
7a80a79a |
96 | mdw_cv_module_dir="/lib/modules/$kernelversion/misc" |
4e3819cf |
97 | fi |
98 | moduledir=$mdw_cv_module_dir]) |
99 | AC_SUBST(moduledir) |
100 | |
101 | dnl --- Tweakable parameters --- |
102 | |
103 | AC_ARG_WITH([major-device], |
104 | [ --with-major-device=NUM set major device number for Usernet], |
105 | [MAJORDEV="$WITHVAL"], |
106 | [MAJORDEV=63]) |
107 | AC_SUBST(MAJORDEV) |
108 | AC_DEFINE_UNQUOTED(UNET_MAJOR, $MAJORDEV) |
109 | |
110 | AC_ARG_WITH([persistent-devices], |
111 | [ --with-persistent-devices=NUM |
112 | create NUM persistent devices], |
113 | [NPERSIST="$withval"], |
114 | [NPERSIST=1]) |
115 | AC_SUBST(NPERSIST) |
116 | AC_DEFINE_UNQUOTED(UNET_NPERSIST, $NPERSIST) |
117 | |
118 | AC_ARG_WITH([transient-minor], |
119 | [ --with-transient-minor=NUM |
120 | set minor device number of /dev/unet], |
121 | [TRANSMINOR="$withval"], |
122 | [TRANSMINOR=255]) |
123 | AC_SUBST(TRANSMINOR) |
124 | AC_DEFINE_UNQUOTED(UNET_TRANSMINOR, $TRANSMINOR) |
125 | |
126 | AC_ARG_WITH([max-queue-length], |
127 | [ --with-max-queue-length=NUM |
128 | queue at most NUM packets], |
129 | [QMAXLEN="$withval"], |
130 | [QMAXLEN=128]) |
131 | AC_SUBST(QMAXLEN) |
132 | AC_DEFINE_UNQUOTED(UNET_QMAXLEN, $QMAXLEN) |
133 | |
134 | AC_ARG_WITH([max-interfaces], |
135 | [ --with-max-interfaces=NUM |
136 | maximum number of interfaces allowed], |
137 | [MAXIF="$withval"], |
138 | [MAXIF=64]) |
139 | AC_SUBST(MAXIF) |
140 | AC_DEFINE_UNQUOTED(UNET_MAXIF, $MAXIF) |
141 | |
142 | AC_ARG_WITH([debugging], |
143 | [ --with-debugging=OPT enable debugging output from the module |
144 | (options are "yes", "no" and "runtime")], |
145 | [case "$withval" in |
146 | yes) AC_DEFINE(UNET_DEBUG, 1) ;; |
147 | no) AC_DEFINE(UNET_DEBUG, -1) ;; |
148 | runtime) AC_DEFINE(UNET_DEBUG, 0) ;; |
149 | *) AC_MSG_ERROR([bad argument to --with-debugging]) ;; |
150 | esac], |
151 | [AC_DEFINE(UNET_DEBUG, 0)]) |
152 | |
153 | dnl --- Should be enough for today --- |
154 | |
155 | AC_OUTPUT(Makefile makedev.unet) |