1#!/bin/sh 2# 3# Figure out (i) the type of dev_t (ii) the defines for loop stuff 4# 5# Output of this script is normally redirected to "loop.h". 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 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 18if [ -f /usr/include/linux/posix_types.h ]; then 19 echo '#include <linux/posix_types.h>' 20 echo '#undef dev_t' 21 echo '#define dev_t __kernel_dev_t' 22else 23 echo '#undef dev_t' 24 echo '#define dev_t unsigned short' 25fi 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 31 echo '#include <linux/loop.h>' 32else 33 echo '#include "real_loop.h"' 34fi 35 36echo '#undef dev_t' 37 38