comparison scripts/genconfig.sh @ 1259:565980862743 draft

Probes for O_NOFOLLOW that compile and run something aren't compatible with cross compiling, so just #define it to 0 if it's not in fcntl.h where posix-2008 says.
author Rob Landley <rob@landley.net>
date Tue, 15 Apr 2014 21:59:42 -0500
parents a612857eb52d
children 0ce03bb85ebd
comparison
equal deleted inserted replaced
1258:fd0a595f5486 1259:565980862743
47 47
48 echo endmenu 48 echo endmenu
49 done 49 done
50 } 50 }
51 51
52 headerprobes()
53 {
54 ${CROSS_COMPILE}${CC} $CFLAGS -xc -o /dev/null - 2>/dev/null << EOF
55 #include <fcntl.h>
56 #ifndef O_NOFOLLOW
57 #error posix 2008 was a while ago now
58 #endif
59 EOF
60 if [ $? -ne 0 ]
61 then
62 rm -f a.out
63 ${CROSS_COMPILE}${CC} $CFLAGS -xc - 2>/dev/null << EOF
64 #include <stdio.h>
65 #include <sys/types.h>
66 #include <asm/fcntl.h>
67
68 int main(int argc, char *argv[])
69 {
70 printf("0x%x\n", O_NOFOLLOW);
71 }
72 EOF
73 X=$(./a.out) 2>/dev/null
74 rm -f a.out
75 echo "#define O_NOFOLLOW ${X:-0}"
76 fi
77 }
78
79 probeconfig > generated/Config.probed || rm generated/Config.probed 52 probeconfig > generated/Config.probed || rm generated/Config.probed
80 genconfig > generated/Config.in || rm generated/Config.in 53 genconfig > generated/Config.in || rm generated/Config.in
81 headerprobes > generated/portability.h || rm generated/portability.h