This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: fastjar/jargrep.c fails to compile under cygwin
- To: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Subject: Re: fastjar/jargrep.c fails to compile under cygwin
- From: Tom Tromey <tromey at redhat dot com>
- Date: 15 Dec 2000 11:57:16 -0700
- References: <20001215162555.DYVE4970.mail.rdc2.mi.home.com@C265292-A>
- Reply-To: tromey at redhat dot com
>>>>> "Kelley" == R Kelley Cook <Kelley.Cook@home.com> writes:
Kelley> In the current CVS fastjar/jargrep.c fails to compile under Cygwin.
Kelley> Simply adding '#include "getopt.h"' to this file seems to fix the
Kelley> problem.
That isn't quite sufficient. Not all OSs have getopt.h.
I changed it to check for getopt.h and include if it is available.
In any case we just declare optind.
Here's the patch. I'm checking it in.
2000-12-15 Tom Tromey <tromey@redhat.com>
Kelley Cook <kelleycook@home.com>
* jargrep.c: Include getopt.h if it exists.
(optind): Declare.
* configure, config.h: Rebuilt.
* configure.in: Check for getopt.h.
Tom
Index: configure.in
===================================================================
RCS file: /cvs/gcc/egcs/fastjar/configure.in,v
retrieving revision 1.2
diff -u -r1.2 configure.in
--- configure.in 2000/12/14 18:49:11 1.2
+++ configure.in 2000/12/15 18:42:46
@@ -21,7 +21,7 @@
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_STRUCT_TM
-AC_CHECK_HEADERS(fcntl.h unistd.h sys/param.h)
+AC_CHECK_HEADERS(fcntl.h unistd.h sys/param.h getopt.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_OFF_T
Index: jargrep.c
===================================================================
RCS file: /cvs/gcc/egcs/fastjar/jargrep.c,v
retrieving revision 1.3
diff -u -r1.3 jargrep.c
--- jargrep.c 2000/12/14 18:45:35 1.3
+++ jargrep.c 2000/12/15 18:42:47
@@ -1,6 +1,6 @@
/*
jargrep.c - main functions for jargrep utility
- Copyright (C) 1999 Bryan Burns
+ Copyright (C) 1999, 2000 Bryan Burns
Copyright (C) 2000 Cory Hollingsworth
Parts of this program are base on Bryan Burns work with fastjar
@@ -99,10 +99,14 @@
#include "zipfile.h"
#include "zlib.h"
#include "compress.h"
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif
#define Usage "Usage: %s [-bcinsw] <-e regexp | regexp> file(s)\n"
extern char *optarg;
+extern int optind;
/*
Function name: opt_valid