File: configure.in

package info (click to toggle)
alsadriver 0.4.1i-5
  • links: PTS
  • area: main
  • in suites: potato
  • size: 5,256 kB
  • ctags: 15,024
  • sloc: ansic: 96,846; makefile: 1,232; sh: 1,051; perl: 54
file content (387 lines) | stat: -rw-r--r-- 9,916 bytes parent folder | download | duplicates (2)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
dnl Process this file with autoconf to produce a configure script.
dnl
dnl Copyright (c) by Jaroslav Kysela <perex@suse.cz>

AC_INIT(kernel/sound.c)
AM_CONDITIONAL(INSTALL_M4, test "x${ACLOCAL}" = "xaclocal")
AC_PREFIX_DEFAULT(/usr)

dnl Checks for programs.
AC_PROG_CC
AC_PROG_RANLIB
AC_PROG_INSTALL

dnl Checks for header files.
AC_HEADER_STDC
AC_CONFIG_HEADER(include/config.h include/config1.h include/version.h)
AC_CHECK_HEADERS(linux/fs.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_HEADER_TIME

dnl Checks for library functions.
AC_PROG_GCC_TRADITIONAL

dnl Check for directory with kernel source...
AC_MSG_CHECKING(for directory with kernel source)
AC_ARG_WITH(kernel,
  [  --with-kernel=dir       give the directory with kernel sources]
  [                        [/usr/src/linux]],
  kerneldir="$withval", kerneldir="/usr/src/linux")
AC_DEFINE_UNQUOTED(CONFIG_SND_KERNELDIR, "$kerneldir")
CONFIG_SND_KERNELDIR="$kerneldir"
AC_SUBST(CONFIG_SND_KERNELDIR)
AC_MSG_RESULT($kerneldir)

dnl Check for kernel version...
AC_MSG_CHECKING(for kernel version)
AC_CACHE_VAL(kaversion,
[AC_TRY_RUN([
#include <stdio.h>
#include "$CONFIG_SND_KERNELDIR/include/linux/version.h"
int main()
{
 FILE *f;
#ifdef UTS_RELEASE
 f=fopen("./conftestdata","w");
 if (f) {
   fprintf(f,"%s\n",UTS_RELEASE);
   fclose(f);
   }
 exit(0);
#else
 exit(1);
#endif
}],kaversion=`cat conftestdata`,
kaversion="",
kaversion="")])
kversion=`echo $kaversion | cut -d . -f 1`
kpatchlevel=`echo $kaversion | cut -d . -f 2`
ksublevel=`echo $kaversion | sed -e 's/.*\.//' -e 's/\([[0-9]][[0-9]]*\).*/\1/'`
kextraversion=`echo $kaversion | sed -e 's/.*\.//' -e 's/.*\.//' -e 's/^[[0-9]][[0-9]]*//'`
if test "$kextraversion" = "$ksublevel"; then
  kextraversion=""
fi
kversion=`expr $kversion + 0`
kpatchlevel=`expr $kpatchlevel + 0`
ksublevel=`expr $ksublevel + 0`
if test -z "$kversion" || test -z "$kpatchlevel" || test -z "$ksublevel"; then
  echo "failed (probably missing $CONFIG_SND_KERNELDIR/include/linux/version.h)"
  exit 1
fi
kaversion="$kversion.$kpatchlevel.$ksublevel$kextraversion"
newkernel="0"
if test $kversion -gt 2; then
  newkernel="1"
else
  if test $kversion -eq 2 && test $kpatchlevel -gt 0; then
    newkernel="1"
  fi
fi
AC_SUBST(kaversion)
AC_SUBST(kversion)
AC_SUBST(kpatchlevel)
AC_SUBST(ksublevel)
AC_SUBST(kextraversion)
AC_SUBST(newkernel)
AC_MSG_RESULT($kaversion)

dnl Check for modversions...
AC_MSG_CHECKING(for kernel module symbol versions)
modversion="0"
AC_TRY_RUN([
#include "$CONFIG_SND_KERNELDIR/include/linux/autoconf.h"
int main( void ) {
#ifndef CONFIG_MODVERSIONS
  exit(1);
#else
  exit(0);
#endif
}
],
  AC_MSG_RESULT("yes");mversion="1",
  AC_MSG_RESULT("no");mversion="0",
  AC_MSG_RESULT("uknown");mversion="0"
)
CONFIG_SND_MVERSION=$mversion
AC_SUBST(CONFIG_SND_MVERSION)
GENKSYMS="/sbin/genksyms"
if test "$newkernel" = "1"; then
  GENKSYMS="$GENKSYMS -k $kversion.$kpatchlevel.$ksublevel"
fi

dnl Check for PCI support...
AC_MSG_CHECKING(for PCI support in kernel)
pcisup="0"
AC_TRY_RUN([
#include "$CONFIG_SND_KERNELDIR/include/linux/autoconf.h"
int main( void ) {
#ifndef CONFIG_PCI
  exit(1);
#else
  exit(0);
#endif
}
],
  AC_MSG_RESULT("yes");pcisup="1",
  AC_MSG_RESULT("no");pcisup="0",
  AC_MSG_RESULT("uknown");pcisup="0"
)
CONFIG_SND_PCI=$pcisup
AC_SUBST(CONFIG_SND_PCI)

dnl Check for SGI/MIPS (HAL2) support...
AC_MSG_CHECKING(for SGI/MIPS (HAL2) architecture)
CONFIG_SND_SGI=0
if test -r $CONFIG_SND_KERNELDIR/include/asm/sgihpc.h; then
  CONFIG_SND_SGI=1
fi
AC_SUBST(CONFIG_SND_SGI)
if test $CONFIG_SND_SGI -eq 1; then
  AC_MSG_RESULT("yes")
else
  AC_MSG_RESULT("no")
fi


dnl Directory for modules
AC_MSG_CHECKING(for directory to store kernel modules)
AC_ARG_WITH(moddir,
  [  --with-moddir=/path     give the path for the alsa driver kernel modules]
  [                        [/lib/modules/<KVER>/misc]],
  moddir="$withval", 
# Special test for RH 5.1
  if test -d /lib/modules/preferred; then
    moddir="/lib/modules/preferred/misc"
  else
    moddir="/lib/modules/$kaversion/misc"
  fi
)
AC_SUBST(moddir)
AC_MSG_RESULT($moddir)

dnl Debug level
AC_MSG_CHECKING(for debug level)
AC_ARG_WITH(debug,
  [  --with-debug=level      give the debug level (none,basic,memory,full)],
  debug="$withval", debug="none")
case "$debug" in
  basic)
    AC_MSG_RESULT(basic)
    AC_DEFINE(CONFIG_SND_DEBUG)
    ;;
  memory)
    AC_MSG_RESULT(memory)
    AC_DEFINE(CONFIG_SND_DEBUG)
    AC_DEFINE(CONFIG_SND_DEBUG_MEMORY)
    ;;
  full)
    AC_MSG_RESULT(full)
    AC_DEFINE(CONFIG_SND_DEBUG)
    AC_DEFINE(CONFIG_SND_DEBUG_MEMORY)
    AC_DEFINE(CONFIG_SND_DEBUG_FULL)
    ;;    
  detect)
    AC_MSG_RESULT(detect)
    AC_DEFINE(CONFIG_SND_DEBUG)
    AC_DEFINE(CONFIG_SND_DEBUG_MEMORY)
    AC_DEFINE(CONFIG_SND_DEBUG_FULL)
    AC_DEFINE(CONFIG_SND_DEBUG_DETECT)
    ;;
  *)
    AC_MSG_RESULT(none)
    ;;
esac
AC_SUBST(moddir)

dnl Check processor type...
AC_MSG_CHECKING(for processor type)
AC_ARG_WITH(processor,
  [  --with-processor=cpu    give the processor type]
  [                        (i386,i486,i586,i686,alpha,ppc,mips,auto)],
  processor="$withval", processor="auto")
if test "$processor" = "auto"; then
  CPUID=`cat /proc/cpuinfo | grep cpu | grep -v "cpu family" | grep -v cpuid | grep -v "cpu MHz" | grep -v "cpu model" | cut -d : -f 2 | colrm 1 1 | head -n 1`
  if test "$CPUID""x" = "x"; then
    CPUID=`cat /proc/cpuinfo | grep "cpu family" | cut -d : -f 2 | colrm 1 1 | head -n 1`
    if test "$CPUID" != "alpha" && test "$CPUID" != "Alpha"; then
      CPUID="i""$CPUID""86"
    fi
  else
    if test "$CPUID" != "alpha" && test "$CPUID" != "Alpha" && test "$CPUID" != "MIPS" ; then
      CPUID="i""$CPUID"
    fi
  fi
  processor="$CPUID"
fi
c_opts=""
case "$processor" in
  i386)
    c_opts="-m386 -DCPU=386"
    AC_MSG_RESULT(i386)    
    ;;
  i486)
    c_opts="-m486 -DCPU=486"
    AC_MSG_RESULT(i486)    
    ;;
  i586)
    c_opts="-m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=586"
    AC_MSG_RESULT(i586)    
    ;;
  i686)
    c_opts="-m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=686"
    AC_MSG_RESULT(i686)    
    ;;
  alpha|Alpha)
    c_opts="-fno-strength-reduce -mno-fp-regs"
    if test "$newkernel" = "1"; then
      c_opts="$c_opts -ffixed-8"
    fi
    AC_MSG_RESULT(alpha)
    processor="alpha"
    ;;
  ppc)
    AC_MSG_RESULT(ppc)
    ;;
  mips|MIPS)
    c_opts="-mcpu=r4600 -mips2 -fno-pic -mno-abicalls -mlong-calls"
    AC_MSG_RESULT(mips)
    processor="mips"
    ;;
  *)
    AC_MSG_RESULT(unknown)
    processor="unknown"
    ;;
esac
c_opts="-O2 $c_opts"
AC_SUBST(processor)

dnl Check for SMP...
AC_MSG_CHECKING(for SMP)
AC_ARG_WITH(smp,
  [  --with-smp=yes,no,auto  driver will (not) be compiled with SMP support],
  smp="$withval", smp="auto")
msmp=""
if test "$smp" = "auto"; then
  if test $kversion -ge 2 && test $kpatchlevel -ge 2; then
    msmp=`grep -E "^#define[ |\t]+CONFIG_SMP[ |\t]+1" $CONFIG_SND_KERNELDIR/include/linux/autoconf.h | wc -l`
    msmp=`expr $msmp + 0`
  else
    CPUNUM=`grep -E "^SMP.+=.+1" $CONFIG_SND_KERNELDIR/Makefile`
    if test "$CPUNUM""x" = "x"; then
      CPUNUM=`cat /proc/cpuinfo | grep ^processor | wc -l`
      CPUNUM=`expr $CPUNUM + 0`
      if test $CPUNUM -gt 1; then
        msmp="1"
      fi
    else
      msmp="1"
    fi
  fi
fi
if test "$smp" = "yes"; then
  msmp="1"
fi
if test "$msmp" = "1"; then
  if test "$newkernel" = "1"; then
    GENKSYMS="$GENKSYMS -p smp_"
  fi
  c_opts="$c_opts -D__SMP__ -DCONFIG_SMP"
  AC_MSG_RESULT(yes)
else
  AC_MSG_RESULT(no)
fi
AC_SUBST(msmp)

dnl Check for ISA PnP driver in kernel...
AC_MSG_CHECKING(for ISA PnP driver in kernel)
CONFIG_ISAPNP_KERNEL="0"
if test -r $CONFIG_SND_KERNELDIR/include/linux/isapnp.h; then
  AC_MSG_RESULT(yes)
  AC_DEFINE(CONFIG_ISAPNP_KERNEL)
  CONFIG_ISAPNP_KERNEL="1"
else
  AC_MSG_RESULT(no)  
fi
AC_SUBST(CONFIG_ISAPNP_KERNEL)

dnl Check for ISA PnP support...
AC_MSG_CHECKING(for ISA PnP support)
AC_ARG_WITH(isapnp,
  [  --with-isapnp=yes,no,auto  driver will (not) be compiled with ISA PnP support],
  pnp="$withval", pnp="auto")
CONFIG_ISAPNP="0"
if test "$pnp" = "auto"; then
  if test -f /proc/isapnp; then
    CONFIG_ISAPNP="1"
  fi
else
  if test "$pnp" = "yes"; then
    CONFIG_ISAPNP="1"
  fi
fi
AC_SUBST(CONFIG_ISAPNP)
if test "$CONFIG_ISAPNP" = "1"; then
  AC_DEFINE(CONFIG_ISAPNP)
  AC_MSG_RESULT(yes)
else
  AC_MSG_RESULT(no)
fi

dnl Check for version...
AC_MSG_CHECKING(for driver version)
CONFIG_SND_VERSION=`cat $srcdir/version`
AC_DEFINE_UNQUOTED(CONFIG_SND_VERSION, "$CONFIG_SND_VERSION")
AC_SUBST(CONFIG_SND_VERSION)
AC_MSG_RESULT($CONFIG_SND_VERSION)

dnl Check for sequencer support...
AC_MSG_CHECKING(for sequencer support)
AC_ARG_WITH(sequencer,
  [  --with-sequencer=yes,no  driver will (not) be compiled with sequencer support],
  sequencer="$withval", sequencer="no")
CONFIG_SND_SEQUENCER="0"
if test "$sequencer" = "yes"; then
  CONFIG_SND_SEQUENCER="1"
fi
AC_SUBST(CONFIG_SND_SEQUENCER)
if test "$CONFIG_SND_SEQUENCER" = "1"; then
  AC_DEFINE(CONFIG_SND_SEQUENCER)
  AC_MSG_RESULT(yes)
else
  AC_MSG_RESULT(no)
fi

dnl Check for OSS/Free emulation...
AC_MSG_CHECKING(for OSS/Free emulation)
AC_ARG_WITH(oss,
  [  --with-oss=no,yes       driver will (not) be compiled with OSS/Free emulation],
  ossemul="$withval", ossemul="yes")
CONFIG_SND_OSSEMUL="0"
if test "$ossemul" = "yes"; then
  CONFIG_SND_OSSEMUL="1"
fi
AC_SUBST(CONFIG_SND_OSSEMUL)
if test "$CONFIG_SND_OSSEMUL" = "1"; then
  AC_DEFINE(CONFIG_SND_OSSEMUL)
  AC_MSG_RESULT(yes)
else
  AC_MSG_RESULT(no)
fi

dnl Check for which cards to compile driver for...
ALSA_CARDS_INIT
ALSA_CARDS_SELECT

dnl Some late substitutes...
c_opts="$c_opts -DLINUX"
AC_SUBST(c_opts)
AC_SUBST(GENKSYMS)

dnl Output files...
AC_OUTPUT(Makefile.conf snddevices utils/alsa-driver.spec cards.config)

dnl Make right rights for scripts
chmod 755 $srcdir/snddevices