From 7cc812f5c1b64832a0324a293cc8968ba044e0a4 Mon Sep 17 00:00:00 2001 From: Erwin Janssen Date: Sun, 18 Sep 2016 03:37:04 +0200 Subject: [PATCH] Remove checks for getopt.h Removed the checks that define `HAVE_GETOPT_H` and `HAVE_GETOPT_DECL`. Because getopt can be used by the Windows build, these checks are no longer needed. --- config.iffe | 14 -------- configure.ac | 16 +-------- lib/gvpr/gvpr.c | 2 -- lib/ingraphs/ingraphs.c | 71 ---------------------------------------- windows/include/config.h | 6 ---- 5 files changed, 1 insertion(+), 108 deletions(-) diff --git a/config.iffe b/config.iffe index 81fcd8575..665b38c4d 100644 --- a/config.iffe +++ b/config.iffe @@ -103,20 +103,6 @@ link{ #define HAVE_INTPTR_T 1 }end -link{ - #include - #include - #if HAVE_UNISTD_H - #include - #endif - int main () { - if ( optopt ) exit(0); else exit(1); - } -}end yes{ -/* Define if getopt externs are declared */ -#define HAVE_GETOPT_DECL 1 -}end - link{ #if HAVE_NETDB_H #include diff --git a/configure.ac b/configure.ac index 48b5564d1..3777adebb 100644 --- a/configure.ac +++ b/configure.ac @@ -426,7 +426,7 @@ dnl Checks for header files # AC_HEADER_STDC AC_CHECK_HEADERS(stdarg.h stddef.h stddef.h stdlib.h stdint.h malloc.h \ - fcntl.h search.h getopt.h pthread.h values.h float.h limits.h termios.h \ + fcntl.h search.h pthread.h values.h float.h limits.h termios.h \ errno.h time.h unistd.h fenv.h string.h strings.h inttypes.h setjmp.h \ sys/time.h sys/times.h sys/types.h sys/select.h fpu_control.h \ sys/fpu.h sys/socket.h sys/stat.h sys/mman.h \ @@ -3083,20 +3083,6 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include # ----------------------------------- -AC_MSG_CHECKING(if getopt externs are declared) -AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include - #include - #if HAVE_UNISTD_H - #include - #endif - ]], [[if ( optopt ) exit(0); else exit(1); - ]])],[AC_MSG_RESULT(yes) - AC_DEFINE_UNQUOTED(HAVE_GETOPT_DECL,1,Define if getopt externs are declared) - ],[AC_MSG_RESULT(no) - ]) - -# ----------------------------------- - AC_MSG_CHECKING(if intptr_t is declared) AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include #if HAVE_STDINT_H diff --git a/lib/gvpr/gvpr.c b/lib/gvpr/gvpr.c index 806d12617..00c721c96 100644 --- a/lib/gvpr/gvpr.c +++ b/lib/gvpr/gvpr.c @@ -39,9 +39,7 @@ #include #include #include -#ifdef HAVE_GETOPT_H #include -#endif #ifndef DFLT_GVPRPATH #define DFLT_GVPRPATH "." diff --git a/lib/ingraphs/ingraphs.c b/lib/ingraphs/ingraphs.c index e62a0df28..7f0c6fb11 100644 --- a/lib/ingraphs/ingraphs.c +++ b/lib/ingraphs/ingraphs.c @@ -216,74 +216,3 @@ char *fileName(ingraph_state * sp) } #include "config.h" - -#ifndef HAVE_GETOPT_DECL -/* -public domain AT&T getopt source -*/ -#include - -/*LINTLIBRARY*/ - -#if 0 -#define EOF (-1) -#define ERR(s, c) if(opterr){\ - char errbuf[2];\ - errbuf[0] = c; errbuf[1] = '\n';\ - (void) write(2, argv[0], (unsigned)strlen(argv[0]));\ - (void) write(2, s, (unsigned)strlen(s));\ - (void) write(2, errbuf, 2);} -#endif -#define ERR(s, c) if(opterr) fprintf (stderr, "%s%s'%c'\n", argv[0], s, c) - -int opterr = 1; -int optind = 1; -int optopt; -char *optarg; - -int -getopt(int argc, char** argv, char* opts) -{ - static int sp = 1; - register int c; - register char *cp; - - if(sp == 1) { - if(optind >= argc || - argv[optind][0] != '-' || argv[optind][1] == '\0') - return(EOF); - else if(strcmp(argv[optind], "--") == 0) { - optind++; - return(EOF); - } - } - - optopt = c = argv[optind][sp]; - if(c == ':' || (cp=strchr(opts, c)) == 0) { - ERR(": illegal option -- ", c); - if(argv[optind][++sp] == '\0') { - optind++; - sp = 1; - } - return('?'); - } - if(*++cp == ':') { - if(argv[optind][sp+1] != '\0') - optarg = &argv[optind++][sp+1]; - else if(++optind >= argc) { - ERR(": option requires an argument -- ", c); - sp = 1; - return('?'); - } else - optarg = argv[optind++]; - sp = 1; - } else { - if(argv[optind][++sp] == '\0') { - sp = 1; - optind++; - } - optarg = 0; - } - return(c); -} -#endif diff --git a/windows/include/config.h b/windows/include/config.h index 92aa6bf1e..4485bc4db 100644 --- a/windows/include/config.h +++ b/windows/include/config.h @@ -147,12 +147,6 @@ /* Define to 1 if you have the `getenv' function. */ #define HAVE_GETENV 1 -/* Define if getopt externs are declared */ -#define HAVE_GETOPT_DECL 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_GETOPT_H 1 - /* Define to 1 if you have the `getrusage' function. */ /* #undef HAVE_GETRUSAGE */ -- 2.40.0