Eric Andersen | 624cc77 | 2000-09-21 02:04:51 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # Figure out (i) the type of dev_t (ii) the defines for loop stuff |
| 4 | # |
Eric Andersen | 19f8620 | 2001-02-17 00:42:47 +0000 | [diff] [blame] | 5 | # Output of this script is normally redirected to "loop.h". |
Eric Andersen | 624cc77 | 2000-09-21 02:04:51 +0000 | [diff] [blame] | 6 | |
| 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 Andersen | 19f8620 | 2001-02-17 00:42:47 +0000 | [diff] [blame] | 14 | # 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 Andersen | 624cc77 | 2000-09-21 02:04:51 +0000 | [diff] [blame] | 18 | if [ -f /usr/include/linux/posix_types.h ]; then |
Eric Andersen | 19f8620 | 2001-02-17 00:42:47 +0000 | [diff] [blame] | 19 | echo '#include <linux/posix_types.h>' |
| 20 | echo '#undef dev_t' |
| 21 | echo '#define dev_t __kernel_dev_t' |
Eric Andersen | 624cc77 | 2000-09-21 02:04:51 +0000 | [diff] [blame] | 22 | else |
Eric Andersen | 19f8620 | 2001-02-17 00:42:47 +0000 | [diff] [blame] | 23 | echo '#undef dev_t' |
| 24 | echo '#define dev_t unsigned short' |
Eric Andersen | 624cc77 | 2000-09-21 02:04:51 +0000 | [diff] [blame] | 25 | fi |
| 26 | |
| 27 | # Next we have to find the loop stuff itself. |
| 28 | # First try kernel source, then a private version. |
| 29 | |
| 30 | if [ -f /usr/include/linux/loop.h ]; then |
Eric Andersen | 19f8620 | 2001-02-17 00:42:47 +0000 | [diff] [blame] | 31 | echo '#include <linux/loop.h>' |
Eric Andersen | 624cc77 | 2000-09-21 02:04:51 +0000 | [diff] [blame] | 32 | else |
Eric Andersen | 19f8620 | 2001-02-17 00:42:47 +0000 | [diff] [blame] | 33 | echo '#include "real_loop.h"' |
Eric Andersen | 624cc77 | 2000-09-21 02:04:51 +0000 | [diff] [blame] | 34 | fi |
| 35 | |
Eric Andersen | 19f8620 | 2001-02-17 00:42:47 +0000 | [diff] [blame] | 36 | echo '#undef dev_t' |
Eric Andersen | 624cc77 | 2000-09-21 02:04:51 +0000 | [diff] [blame] | 37 | |