Commit 7a93476d by Tom Tromey Committed by Tom Tromey

For PR libgcj/5303:

	* jargrep.h: Removed RCS keywords.
	(GVERSION): Removed.
	* configure, Makefile.in, config.h.in: Rebuilt.
	* configure.in: Added AM_MAINTAINER_MODE.
	Don't look for getopt.h.  Use `fastjar' as package name.
	* Makefile.am (INCLUDES): Look in ../include.
	(LIBIBERTY): New macro.
	(jar_LDADD): Use it.
	(jar_DEPENDENCIES): Likewise.
	(grepjar_LDADD): Likewise.
	(grepjar_DEPENDENCIES): Likewise.
	* jargrep.c: Removed RCS keywords.  Always include getopt.h.
	(LONG_OPT): New macro.
	(OPT_HELP): Likewise.
	(main): Use getopt_long.  Let getopt print invalid argument
	message.  Handle --help.  Use version().
	(version): New function.
	(optarg, optind): Don't declare.
	(option_vec): New global.
	(help): New function.
	(Usage): Updated to GNU standards.
	* jartool.c: Removed RCS keywords.  Include getopt.h.
	(LONG_OPT): New macro.
	(OPT_HELP): Likewise.
	(options): New global.
	(help): New function.
	(usage): Print a single line.
	(version): New function.
	(expand_options): New function.
	(main): Use getopt_long and expand_options.  Fail if `-u'
	specified.  Changed handling of -f, -m, -V options.
	(OPTION_STRING): New macro.
	(version_string): Removed.

From-SVN: r48697
parent 1d969638
2002-01-09 Tom Tromey <tromey@redhat.com>
For PR libgcj/5303:
* jargrep.h: Removed RCS keywords.
(GVERSION): Removed.
* configure, Makefile.in, config.h.in: Rebuilt.
* configure.in: Added AM_MAINTAINER_MODE.
Don't look for getopt.h. Use `fastjar' as package name.
* Makefile.am (INCLUDES): Look in ../include.
(LIBIBERTY): New macro.
(jar_LDADD): Use it.
(jar_DEPENDENCIES): Likewise.
(grepjar_LDADD): Likewise.
(grepjar_DEPENDENCIES): Likewise.
* jargrep.c: Removed RCS keywords. Always include getopt.h.
(LONG_OPT): New macro.
(OPT_HELP): Likewise.
(main): Use getopt_long. Let getopt print invalid argument
message. Handle --help. Use version().
(version): New function.
(optarg, optind): Don't declare.
(option_vec): New global.
(help): New function.
(Usage): Updated to GNU standards.
* jartool.c: Removed RCS keywords. Include getopt.h.
(LONG_OPT): New macro.
(OPT_HELP): Likewise.
(options): New global.
(help): New function.
(usage): Print a single line.
(version): New function.
(expand_options): New function.
(main): Use getopt_long and expand_options. Fail if `-u'
specified. Changed handling of -f, -m, -V options.
(OPTION_STRING): New macro.
(version_string): Removed.
2001-01-02 Craig Rodrigues <rodrigc@gcc.gnu.org> 2001-01-02 Craig Rodrigues <rodrigc@gcc.gnu.org>
PR bootstrap/5117 PR bootstrap/5117
......
...@@ -38,14 +38,19 @@ AM_MAKEFLAGS = \ ...@@ -38,14 +38,19 @@ AM_MAKEFLAGS = \
"RANLIB=$(RANLIB)" \ "RANLIB=$(RANLIB)" \
"DESTDIR=$(DESTDIR)" "DESTDIR=$(DESTDIR)"
INCLUDES = -I. -I$(top_srcdir) $(ZINCS) INCLUDES = -I. -I$(top_srcdir) $(ZINCS) -I$(top_srcdir)/../include
LIBIBERTY = ../libiberty/libiberty.a
bin_PROGRAMS = jar grepjar bin_PROGRAMS = jar grepjar
jar_SOURCES = jartool.c dostime.c compress.c pushback.c jartool.h zipfile.h dostime.h compress.h pushback.h jar_SOURCES = jartool.c dostime.c compress.c pushback.c jartool.h \
jar_LDADD = $(ZLIBS) zipfile.h dostime.h compress.h pushback.h
jar_DEPENDENCIES = $(ZDEPS) jar_LDADD = $(ZLIBS) $(LIBIBERTY)
grepjar_SOURCES = jargrep.c dostime.c compress.c pushback.c jartool.h zipfile.h dostime.h compress.h pushback.h jar_DEPENDENCIES = $(ZDEPS) $(LIBIBERTY)
grepjar_LDADD = $(ZLIBS)
grepjar_DEPENDENCIES = $(ZDEPS) grepjar_SOURCES = jargrep.c dostime.c compress.c pushback.c jartool.h \
zipfile.h dostime.h compress.h pushback.h
grepjar_LDADD = $(ZLIBS) $(LIBIBERTY)
grepjar_DEPENDENCIES = $(ZDEPS) $(LIBIBERTY)
AM_CFLAGS = @fastjar_warn_cflags@ AM_CFLAGS = @fastjar_warn_cflags@
...@@ -67,6 +67,7 @@ CC = @CC@ ...@@ -67,6 +67,7 @@ CC = @CC@
CHMOD = @CHMOD@ CHMOD = @CHMOD@
CP = @CP@ CP = @CP@
EXEEXT = @EXEEXT@ EXEEXT = @EXEEXT@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@ MAKEINFO = @MAKEINFO@
PACKAGE = @PACKAGE@ PACKAGE = @PACKAGE@
RM = @RM@ RM = @RM@
...@@ -77,18 +78,58 @@ ZINCS = @ZINCS@ ...@@ -77,18 +78,58 @@ ZINCS = @ZINCS@
ZLIBS = @ZLIBS@ ZLIBS = @ZLIBS@
fastjar_warn_cflags = @fastjar_warn_cflags@ fastjar_warn_cflags = @fastjar_warn_cflags@
AM_MAKEFLAGS = "AR_FLAGS=$(AR_FLAGS)" "CC_FOR_BUILD=$(CC_FOR_BUILD)" "CFLAGS=$(CFLAGS)" "CXXFLAGS=$(CXXFLAGS)" "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" "INSTALL=$(INSTALL)" "INSTALL_DATA=$(INSTALL_DATA)" "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" "JC1FLAGS=$(JC1FLAGS)" "LDFLAGS=$(LDFLAGS)" "LIBCFLAGS=$(LIBCFLAGS)" "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" "MAKE=$(MAKE)" "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" "PICFLAG=$(PICFLAG)" "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" "SHELL=$(SHELL)" "exec_prefix=$(exec_prefix)" "infodir=$(infodir)" "libdir=$(libdir)" "prefix=$(prefix)" "AR=$(AR)" "AS=$(AS)" "CC=$(CC)" "CXX=$(CXX)" "LD=$(LD)" "LIBCFLAGS=$(LIBCFLAGS)" "NM=$(NM)" "PICFLAG=$(PICFLAG)" "RANLIB=$(RANLIB)" "DESTDIR=$(DESTDIR)" AM_MAKEFLAGS = \
"AR_FLAGS=$(AR_FLAGS)" \
"CC_FOR_BUILD=$(CC_FOR_BUILD)" \
"CFLAGS=$(CFLAGS)" \
"CXXFLAGS=$(CXXFLAGS)" \
"CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
"CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
"INSTALL=$(INSTALL)" \
"INSTALL_DATA=$(INSTALL_DATA)" \
"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
"INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
"JC1FLAGS=$(JC1FLAGS)" \
"LDFLAGS=$(LDFLAGS)" \
"LIBCFLAGS=$(LIBCFLAGS)" \
"LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
"MAKE=$(MAKE)" \
"MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
"PICFLAG=$(PICFLAG)" \
"PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
"SHELL=$(SHELL)" \
"exec_prefix=$(exec_prefix)" \
"infodir=$(infodir)" \
"libdir=$(libdir)" \
"prefix=$(prefix)" \
"AR=$(AR)" \
"AS=$(AS)" \
"CC=$(CC)" \
"CXX=$(CXX)" \
"LD=$(LD)" \
"LIBCFLAGS=$(LIBCFLAGS)" \
"NM=$(NM)" \
"PICFLAG=$(PICFLAG)" \
"RANLIB=$(RANLIB)" \
"DESTDIR=$(DESTDIR)"
INCLUDES = -I. -I$(top_srcdir) $(ZINCS) -I$(top_srcdir)/../include
LIBIBERTY = ../libiberty/libiberty.a
bin_PROGRAMS = jar grepjar
jar_SOURCES = jartool.c dostime.c compress.c pushback.c jartool.h \
zipfile.h dostime.h compress.h pushback.h
INCLUDES = -I. -I$(top_srcdir) $(ZINCS) jar_LDADD = $(ZLIBS) $(LIBIBERTY)
jar_DEPENDENCIES = $(ZDEPS) $(LIBIBERTY)
bin_PROGRAMS = jar grepjar grepjar_SOURCES = jargrep.c dostime.c compress.c pushback.c jartool.h \
jar_SOURCES = jartool.c dostime.c compress.c pushback.c jartool.h zipfile.h dostime.h compress.h pushback.h zipfile.h dostime.h compress.h pushback.h
jar_LDADD = $(ZLIBS)
jar_DEPENDENCIES = $(ZDEPS) grepjar_LDADD = $(ZLIBS) $(LIBIBERTY)
grepjar_SOURCES = jargrep.c dostime.c compress.c pushback.c jartool.h zipfile.h dostime.h compress.h pushback.h grepjar_DEPENDENCIES = $(ZDEPS) $(LIBIBERTY)
grepjar_LDADD = $(ZLIBS)
grepjar_DEPENDENCIES = $(ZDEPS)
AM_CFLAGS = @fastjar_warn_cflags@ AM_CFLAGS = @fastjar_warn_cflags@
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
...@@ -118,27 +159,29 @@ configure.in install-defs.sh.in install-sh missing mkinstalldirs ...@@ -118,27 +159,29 @@ configure.in install-defs.sh.in install-sh missing mkinstalldirs
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = gtar TAR = tar
GZIP_ENV = --best GZIP_ENV = --best
DEP_FILES = .deps/compress.P .deps/dostime.P .deps/jargrep.P \
.deps/jartool.P .deps/pushback.P
SOURCES = $(jar_SOURCES) $(grepjar_SOURCES) SOURCES = $(jar_SOURCES) $(grepjar_SOURCES)
OBJECTS = $(jar_OBJECTS) $(grepjar_OBJECTS) OBJECTS = $(jar_OBJECTS) $(grepjar_OBJECTS)
all: all-redirect all: all-redirect
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .S .c .o .s .SUFFIXES: .S .c .o .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps Makefile cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
cd $(top_builddir) \ cd $(top_builddir) \
&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
$(ACLOCAL_M4): configure.in $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in
cd $(srcdir) && $(ACLOCAL) cd $(srcdir) && $(ACLOCAL)
config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck $(SHELL) ./config.status --recheck
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) $(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
cd $(srcdir) && $(AUTOCONF) cd $(srcdir) && $(AUTOCONF)
config.h: stamp-h config.h: stamp-h
...@@ -151,7 +194,7 @@ stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status ...@@ -151,7 +194,7 @@ stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status
&& CONFIG_FILES= CONFIG_HEADERS=config.h \ && CONFIG_FILES= CONFIG_HEADERS=config.h \
$(SHELL) ./config.status $(SHELL) ./config.status
@echo timestamp > stamp-h 2> /dev/null @echo timestamp > stamp-h 2> /dev/null
$(srcdir)/config.h.in: $(srcdir)/stamp-h.in $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@$(srcdir)/stamp-h.in
@if test ! -f $@; then \ @if test ! -f $@; then \
rm -f $(srcdir)/stamp-h.in; \ rm -f $(srcdir)/stamp-h.in; \
$(MAKE) $(srcdir)/stamp-h.in; \ $(MAKE) $(srcdir)/stamp-h.in; \
...@@ -196,9 +239,6 @@ uninstall-binPROGRAMS: ...@@ -196,9 +239,6 @@ uninstall-binPROGRAMS:
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
done done
.c.o:
$(COMPILE) -c $<
.s.o: .s.o:
$(COMPILE) -c $< $(COMPILE) -c $<
...@@ -290,16 +330,53 @@ distdir: $(DISTFILES) ...@@ -290,16 +330,53 @@ distdir: $(DISTFILES)
-rm -rf $(distdir) -rm -rf $(distdir)
mkdir $(distdir) mkdir $(distdir)
-chmod 777 $(distdir) -chmod 777 $(distdir)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(distdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
cd $(top_srcdir) \
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu Makefile
@for file in $(DISTFILES); do \ @for file in $(DISTFILES); do \
d=$(srcdir); \ d=$(srcdir); \
if test -d $$d/$$file; then \ if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \ cp -pr $$/$$file $(distdir)/$$file; \
else \ else \
test -f $(distdir)/$$file \ test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \ || cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \ fi; \
done done
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
-include $(DEP_FILES)
mostlyclean-depend:
clean-depend:
distclean-depend:
-rm -rf .deps
maintainer-clean-depend:
%.o: %.c
@echo '$(COMPILE) -c $<'; \
$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
%.lo: %.c
@echo '$(LTCOMPILE) -c $<'; \
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*F).pp > .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm -f .deps/$(*F).pp
info-am: info-am:
info: info-am info: info-am
dvi-am: dvi-am:
...@@ -340,25 +417,27 @@ distclean-generic: ...@@ -340,25 +417,27 @@ distclean-generic:
maintainer-clean-generic: maintainer-clean-generic:
mostlyclean-am: mostlyclean-hdr mostlyclean-binPROGRAMS \ mostlyclean-am: mostlyclean-hdr mostlyclean-binPROGRAMS \
mostlyclean-compile mostlyclean-tags \ mostlyclean-compile mostlyclean-tags mostlyclean-depend \
mostlyclean-generic mostlyclean-generic
mostlyclean: mostlyclean-am mostlyclean: mostlyclean-am
clean-am: clean-hdr clean-binPROGRAMS clean-compile clean-tags \ clean-am: clean-hdr clean-binPROGRAMS clean-compile clean-tags \
clean-generic mostlyclean-am clean-depend clean-generic mostlyclean-am
clean: clean-am clean: clean-am
distclean-am: distclean-hdr distclean-binPROGRAMS distclean-compile \ distclean-am: distclean-hdr distclean-binPROGRAMS distclean-compile \
distclean-tags distclean-generic clean-am distclean-tags distclean-depend distclean-generic \
clean-am
distclean: distclean-am distclean: distclean-am
-rm -f config.status -rm -f config.status
maintainer-clean-am: maintainer-clean-hdr maintainer-clean-binPROGRAMS \ maintainer-clean-am: maintainer-clean-hdr maintainer-clean-binPROGRAMS \
maintainer-clean-compile maintainer-clean-tags \ maintainer-clean-compile maintainer-clean-tags \
maintainer-clean-generic distclean-am maintainer-clean-depend maintainer-clean-generic \
distclean-am
@echo "This command is intended for maintainers to use;" @echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild." @echo "it deletes files that may require special tools to rebuild."
...@@ -370,10 +449,11 @@ mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \ ...@@ -370,10 +449,11 @@ mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
mostlyclean-compile distclean-compile clean-compile \ mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile tags mostlyclean-tags distclean-tags \ maintainer-clean-compile tags mostlyclean-tags distclean-tags \
clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \ clean-tags maintainer-clean-tags distdir mostlyclean-depend \
check-am installcheck-am installcheck all-recursive-am install-exec-am \ distclean-depend clean-depend maintainer-clean-depend info-am info \
install-exec install-data-am install-data install-am install \ dvi-am dvi check check-am installcheck-am installcheck all-recursive-am \
uninstall-am uninstall all-redirect all-am all installdirs \ install-exec-am install-exec install-data-am install-data install-am \
install uninstall-am uninstall all-redirect all-am all installdirs \
mostlyclean-generic distclean-generic clean-generic \ mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean maintainer-clean-generic clean mostlyclean distclean maintainer-clean
......
...@@ -125,3 +125,36 @@ for am_file in <<$1>>; do ...@@ -125,3 +125,36 @@ for am_file in <<$1>>; do
done<<>>dnl>>) done<<>>dnl>>)
changequote([,]))]) changequote([,]))])
# Add --enable-maintainer-mode option to configure.
# From Jim Meyering
# serial 1
AC_DEFUN(AM_MAINTAINER_MODE,
[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
dnl maintainer-mode is disabled by default
AC_ARG_ENABLE(maintainer-mode,
[ --enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer],
USE_MAINTAINER_MODE=$enableval,
USE_MAINTAINER_MODE=no)
AC_MSG_RESULT($USE_MAINTAINER_MODE)
AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
MAINT=$MAINTAINER_MODE_TRUE
AC_SUBST(MAINT)dnl
]
)
# Define a conditional.
AC_DEFUN(AM_CONDITIONAL,
[AC_SUBST($1_TRUE)
AC_SUBST($1_FALSE)
if $2; then
$1_TRUE=
$1_FALSE='#'
else
$1_TRUE='#'
$1_FALSE=
fi])
...@@ -34,9 +34,6 @@ ...@@ -34,9 +34,6 @@
/* Define if you have the <fcntl.h> header file. */ /* Define if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H #undef HAVE_FCNTL_H
/* Define if you have the <getopt.h> header file. */
#undef HAVE_GETOPT_H
/* Define if you have the <ndir.h> header file. */ /* Define if you have the <ndir.h> header file. */
#undef HAVE_NDIR_H #undef HAVE_NDIR_H
......
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
AC_INIT(jartool.h) AC_INIT(jartool.h)
AM_INIT_AUTOMAKE(fastar, 0.92-gcc) AM_INIT_AUTOMAKE(fastjar, 0.92-gcc)
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
dnl Checks for programs. dnl Checks for programs.
...@@ -12,6 +12,8 @@ AC_PATH_PROG(STRIP, strip, /usr/bin/strip, $PATH:/bin:/usr/bin:/usr/local/bin) ...@@ -12,6 +12,8 @@ AC_PATH_PROG(STRIP, strip, /usr/bin/strip, $PATH:/bin:/usr/bin:/usr/local/bin)
AC_PATH_PROG(CHMOD, chmod, /bin/chmod, $PATH:/bin:/usr/bin:/usr/local/bin) AC_PATH_PROG(CHMOD, chmod, /bin/chmod, $PATH:/bin:/usr/bin:/usr/local/bin)
AC_EXEEXT AC_EXEEXT
AM_MAINTAINER_MODE
dnl Add warning flags if we are using gcc. dnl Add warning flags if we are using gcc.
if test "$GCC" = yes; then if test "$GCC" = yes; then
fastjar_warn_cflags='-W -Wall -pedantic -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings' fastjar_warn_cflags='-W -Wall -pedantic -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings'
...@@ -22,7 +24,7 @@ dnl Checks for header files. ...@@ -22,7 +24,7 @@ dnl Checks for header files.
AC_HEADER_DIRENT AC_HEADER_DIRENT
AC_HEADER_STDC AC_HEADER_STDC
AC_STRUCT_TM AC_STRUCT_TM
AC_CHECK_HEADERS(fcntl.h unistd.h sys/param.h getopt.h stdlib.h) AC_CHECK_HEADERS(fcntl.h unistd.h sys/param.h stdlib.h)
dnl Checks for typedefs, structures, and compiler characteristics. dnl Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_OFF_T AC_TYPE_OFF_T
......
/* /*
jargrep.c - main functions for jargrep utility jargrep.c - main functions for jargrep utility
Copyright (C) 2002 Free Software Foundation
Copyright (C) 1999, 2000 Bryan Burns Copyright (C) 1999, 2000 Bryan Burns
Copyright (C) 2000 Cory Hollingsworth Copyright (C) 2000 Cory Hollingsworth
...@@ -21,9 +22,24 @@ ...@@ -21,9 +22,24 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
/* $Id: jargrep.c,v 1.4 2000/12/15 18:45:09 tromey Exp $ /* Id: jargrep.c,v 1.5 2002/01/03 04:57:56 rodrigc Exp
Log: jargrep.c,v
Revision 1.5 2002/01/03 04:57:56 rodrigc
2001-01-02 Craig Rodrigues <rodrigc@gcc.gnu.org>
PR bootstrap/5117
* configure.in (AC_CHECK_HEADERS): Check for stdlib.h.
* Makefile.am: Move grepjar to bin_PROGRAMS.
* config.h.in: Regenerated.
* Makefile.in: Regenerated.
* aclocal.m4: Regenerated.
* jargrep.c: Eliminate some signed/unsigned and default
uninitialized warnings. Use HAVE_STDLIB_H instead of
STDC_HEADERS macro.
* jartool.c: Likewise.
* compress.c: Likewise.
$Log: jargrep.c,v $
Revision 1.4 2000/12/15 18:45:09 tromey Revision 1.4 2000/12/15 18:45:09 tromey
* jargrep.c: Include getopt.h if it exists. * jargrep.c: Include getopt.h if it exists.
(optind): Declare. (optind): Declare.
...@@ -105,14 +121,12 @@ will test some other platforms later. ...@@ -105,14 +121,12 @@ will test some other platforms later.
#include "zipfile.h" #include "zipfile.h"
#include "zlib.h" #include "zlib.h"
#include "compress.h" #include "compress.h"
#ifdef HAVE_GETOPT_H
#include <getopt.h> #include <getopt.h>
#endif
#define Usage "Usage: %s [-bcinsw] <-e regexp | regexp> file(s)\n" void version(void);
void help(const char *name);
extern char *optarg; #define Usage "Usage: %s [-bcinsw] <-e PATTERN | PATTERN> FILE ...\n"
extern int optind;
/* /*
Function name: opt_valid Function name: opt_valid
...@@ -632,6 +646,18 @@ static void jargrep(regex_t *exp, regex_t *nl_exp, const char *jarfile, int opti ...@@ -632,6 +646,18 @@ static void jargrep(regex_t *exp, regex_t *nl_exp, const char *jarfile, int opti
} }
} }
/* This is used to mark options with no short value. */
#define LONG_OPT(Num) ((Num) + 128)
#define OPT_HELP LONG_OPT (0)
static const struct option option_vec[] =
{
{ "help", no_argument, NULL, OPT_HELP },
{ "version", no_argument, NULL, 'V' },
{ NULL, no_argument, NULL, 0 }
};
/* /*
Funtion Name: main Funtion Name: main
args: argc number of in coming args. args: argc number of in coming args.
...@@ -650,7 +676,8 @@ int main(int argc, char **argv) { ...@@ -650,7 +676,8 @@ int main(int argc, char **argv) {
regex_t *nl_exp = NULL; regex_t *nl_exp = NULL;
char *regexpstr = NULL; char *regexpstr = NULL;
while((c = getopt(argc, argv, "bce:insVw")) != -1) { while((c = getopt_long(argc, argv, "bce:insVw",
option_vec, NULL)) != -1) {
switch(c) { switch(c) {
case 'b': case 'b':
options |= JG_PRINT_BYTEOFFSET; options |= JG_PRINT_BYTEOFFSET;
...@@ -679,13 +706,15 @@ int main(int argc, char **argv) { ...@@ -679,13 +706,15 @@ int main(int argc, char **argv) {
options |= JG_INVERT; options |= JG_INVERT;
break; break;
case 'V': case 'V':
printf("%s\n", GVERSION); version ();
exit(0); break;
case 'w': case 'w':
options |= JG_WORD_EXPRESSIONS; options |= JG_WORD_EXPRESSIONS;
break; break;
case OPT_HELP:
help(argv[0]);
break;
default: default:
fprintf(stderr, "Unknown option -%c\n", c);
fprintf(stderr, Usage, argv[0]); fprintf(stderr, Usage, argv[0]);
exit(1); exit(1);
} }
...@@ -726,3 +755,34 @@ int main(int argc, char **argv) { ...@@ -726,3 +755,34 @@ int main(int argc, char **argv) {
return retval; return retval;
} }
void help(const char *filename)
{
printf (Usage, filename);
printf ("\
\n\
Search files in a jar file for a pattern.\n\
\n\
-b print byte offset of match\n\
-c print number of matches\n\
-i compare case-insensitively\n\
-n print line number of each match\n\
-s suppress error messages\n\
-w force PATTERN to match only whole words\n\
-e PATTERN use PATTERN as regular exprssion\n\
");
exit (0);
}
void version ()
{
printf("grepjar (%s) %s\n\n", PACKAGE, VERSION);
printf("Copyright 1999, 2000, 2001 Bryan Burns\n");
printf("Copyright 2000 Cory Hollingsworth\n");
printf("Copyright 2002 Free Software Foundation\n");
printf("\
This is free software; see the source for copying conditions. There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
exit (0);
}
/* /*
jargrep.h - header file for jargrep utility jargrep.h - header file for jargrep utility
Copyright (C) 2002 Free Software Foundation
Copyright (C) 2000 Cory Hollingsworth Copyright (C) 2000 Cory Hollingsworth
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
...@@ -17,9 +18,6 @@ ...@@ -17,9 +18,6 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
/*$Id: jargrep.h,v 1.3 2000/09/13 14:02:02 cory Exp $
*/
#define JG_PRINT_BYTEOFFSET 0x00000001 #define JG_PRINT_BYTEOFFSET 0x00000001
#define JG_PRINT_COUNT 0x00000002 #define JG_PRINT_COUNT 0x00000002
#define JG_IGNORE_CASE 0x00000004 #define JG_IGNORE_CASE 0x00000004
...@@ -27,5 +25,3 @@ ...@@ -27,5 +25,3 @@
#define JG_SUPRESS_ERROR 0x00000010 #define JG_SUPRESS_ERROR 0x00000010
#define JG_INVERT 0x00000020 #define JG_INVERT 0x00000020
#define JG_WORD_EXPRESSIONS 0x00000040 #define JG_WORD_EXPRESSIONS 0x00000040
#define GVERSION "jargrep version 0.1 (09/12/2000)"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment