diff options
author | Tom Rini <trini@kernel.crashing.org> | 2004-08-29 13:31:53 +0200 |
---|---|---|
committer | Tom Rini <trini@kernel.crashing.org> | 2004-08-29 13:31:53 +0200 |
commit | b7622cab3096d5d58709fbd3189fde2e1b7d3bab (patch) | |
tree | 08681a21e0ef9e8b8bb497cbfbf07c9da9d98e41 /scripts | |
parent | dca377a6ac0514f8dbc03b42799a6b422828b87e (diff) | |
download | history-b7622cab3096d5d58709fbd3189fde2e1b7d3bab.tar.gz |
kbuild: Use getopt_long in genksyms only when available
Use getopt_long() or getopt(), depending on the host
From: Jean-Christophe Dubois <jdubois@mc.com>.
We do not always have GNU getopt_long(), so when we don't, just use
getopt() and the short options. We do this based on __GNU_LIBRARY__
being set, or not. Originally from Jean-Christophe Dubois <jdubois@mc.com>.
Signed-off-by: Tom Rini <trini@kernel.crashing.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/genksyms/genksyms.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/genksyms/genksyms.c b/scripts/genksyms/genksyms.c index 9cf074bc378492..416a694b099843 100644 --- a/scripts/genksyms/genksyms.c +++ b/scripts/genksyms/genksyms.c @@ -27,7 +27,9 @@ #include <unistd.h> #include <assert.h> #include <stdarg.h> +#ifdef __GNU_LIBRARY__ #include <getopt.h> +#endif /* __GNU_LIBRARY__ */ #include "genksyms.h" @@ -502,12 +504,21 @@ void genksyms_usage(void) fputs("Usage:\n" "genksyms [-dDwqhV] > /path/to/.tmp_obj.ver\n" "\n" +#ifdef __GNU_LIBRARY__ " -d, --debug Increment the debug level (repeatable)\n" " -D, --dump Dump expanded symbol defs (for debugging only)\n" " -w, --warnings Enable warnings\n" " -q, --quiet Disable warnings (default)\n" " -h, --help Print this message\n" " -V, --version Print the release version\n" +#else /* __GNU_LIBRARY__ */ + " -d Increment the debug level (repeatable)\n" + " -D Dump expanded symbol defs (for debugging only)\n" + " -w Enable warnings\n" + " -q Disable warnings (default)\n" + " -h Print this message\n" + " -V Print the release version\n" +#endif /* __GNU_LIBRARY__ */ , stderr); } @@ -516,6 +527,7 @@ main(int argc, char **argv) { int o; +#ifdef __GNU_LIBRARY__ struct option long_opts[] = { {"debug", 0, 0, 'd'}, {"warnings", 0, 0, 'w'}, @@ -528,6 +540,9 @@ main(int argc, char **argv) while ((o = getopt_long(argc, argv, "dwqVDk:p:", &long_opts[0], NULL)) != EOF) +#else /* __GNU_LIBRARY__ */ + while ((o = getopt(argc, argv, "dwqVDk:p:")) != EOF) +#endif /* __GNU_LIBRARY__ */ switch (o) { case 'd': |