diff options
author | Rob Landley <rob@landley.net> | 2014-04-15 21:59:42 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2014-04-15 21:59:42 -0500 |
commit | 15027d6de049fa139a193abc5a86e6578faf630d (patch) | |
tree | 04f956c68b136f2968d80f78640d3db8ab1253a8 | |
parent | dd61393cba9d4dd7152960274aff1d25dd239c93 (diff) | |
download | toybox-15027d6de049fa139a193abc5a86e6578faf630d.tar.gz |
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.
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | lib/portability.h | 7 | ||||
-rwxr-xr-x | scripts/genconfig.sh | 28 |
3 files changed, 7 insertions, 33 deletions
@@ -44,9 +44,8 @@ clean:: rm -rf toybox toybox_unstripped generated/config.h generated/Config.in \ generated/newtoys.h generated/globals.h testdir \ generated/Config.probed generated/oldtoys.h generated/flags.h \ - generated/portability.h .singleconfig .singleconfig.old \ - generated/instlist generated/mkflags generated/config2help \ - generated/help.h + .singleconfig .singleconfig.old generated/help.h \ + generated/instlist generated/mkflags generated/config2help distclean: clean rm -f toybox_old .config* diff --git a/lib/portability.h b/lib/portability.h index 3b1cdf70..099f3215 100644 --- a/lib/portability.h +++ b/lib/portability.h @@ -158,5 +158,8 @@ ssize_t getline(char **lineptr, size_t *n, FILE *stream); #include <sys/mount.h> #include <sys/swap.h> -// compile time probes for stuff libc didn't provide -#include "generated/portability.h" +// Some systems don't define O_NOFOLLOW, and it varies by architecture, so... +#include <fcntl.h> +#ifndef O_NOFOLLOW +#define O_NOFOLLOW 0 +#endif diff --git a/scripts/genconfig.sh b/scripts/genconfig.sh index 71bc609a..8ab26dcc 100755 --- a/scripts/genconfig.sh +++ b/scripts/genconfig.sh @@ -49,33 +49,5 @@ genconfig() done } -headerprobes() -{ - ${CROSS_COMPILE}${CC} $CFLAGS -xc -o /dev/null - 2>/dev/null << EOF - #include <fcntl.h> - #ifndef O_NOFOLLOW - #error posix 2008 was a while ago now - #endif -EOF - if [ $? -ne 0 ] - then - rm -f a.out - ${CROSS_COMPILE}${CC} $CFLAGS -xc - 2>/dev/null << EOF - #include <stdio.h> - #include <sys/types.h> - #include <asm/fcntl.h> - - int main(int argc, char *argv[]) - { - printf("0x%x\n", O_NOFOLLOW); - } -EOF - X=$(./a.out) 2>/dev/null - rm -f a.out - echo "#define O_NOFOLLOW ${X:-0}" - fi -} - probeconfig > generated/Config.probed || rm generated/Config.probed genconfig > generated/Config.in || rm generated/Config.in -headerprobes > generated/portability.h || rm generated/portability.h |