blob: 71c987376a26a78dbfc4cd613246be927bb7031a [file] [log] [blame]
Eric Andersen624cc772000-09-21 02:04:51 +00001#!/bin/sh
2#
3# Figure out (i) the type of dev_t (ii) the defines for loop stuff
4#
Eric Andersen19f86202001-02-17 00:42:47 +00005# Output of this script is normally redirected to "loop.h".
Eric Andersen624cc772000-09-21 02:04:51 +00006
7# Since 1.3.79 there is an include file <asm/posix_types.h>
8# that defines __kernel_dev_t.
9# (The file itself appeared in 1.3.78, but there it defined __dev_t.)
10# If it exists, we use it, or, rather, <linux/posix_types.h> which
11# avoids namespace pollution. Otherwise we guess that __kernel_dev_t
12# is an unsigned short (which is true on i386, but false on alpha).
13
Eric Andersen19f86202001-02-17 00:42:47 +000014# BUG: This test is actually broken if your gcc is not configured to
15# search /usr/include, as may well happen with cross-compilers.
16# It would be better to ask $(CC) if these files can be found.
17
Eric Andersen624cc772000-09-21 02:04:51 +000018if [ -f /usr/include/linux/posix_types.h ]; then
Eric Andersen19f86202001-02-17 00:42:47 +000019 echo '#include <linux/posix_types.h>'
20 echo '#undef dev_t'
21 echo '#define dev_t __kernel_dev_t'
Eric Andersen624cc772000-09-21 02:04:51 +000022else
Eric Andersen19f86202001-02-17 00:42:47 +000023 echo '#undef dev_t'
24 echo '#define dev_t unsigned short'
Eric Andersen624cc772000-09-21 02:04:51 +000025fi
26
27# Next we have to find the loop stuff itself.
28# First try kernel source, then a private version.
29
30if [ -f /usr/include/linux/loop.h ]; then
Eric Andersen19f86202001-02-17 00:42:47 +000031 echo '#include <linux/loop.h>'
Eric Andersen624cc772000-09-21 02:04:51 +000032else
Eric Andersen19f86202001-02-17 00:42:47 +000033 echo '#include "real_loop.h"'
Eric Andersen624cc772000-09-21 02:04:51 +000034fi
35
Eric Andersen19f86202001-02-17 00:42:47 +000036echo '#undef dev_t'
Eric Andersen624cc772000-09-21 02:04:51 +000037