From: Christos Zoulas Date: Sun, 14 Feb 1999 17:15:56 +0000 (+0000) Subject: Automake and file -s patches. X-Git-Tag: FILE3_27~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=91010531158bad6bc4c4ab322db4319ea29ec9a7;p=file Automake and file -s patches. --- diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 00000000..ae8af2b2 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,68 @@ +# don't enforce GNU packaging standards +AUTOMAKE_OPTIONS = foreign + +bin_PROGRAMS = file + +data_DATA = magic + +MAGIC = @datadir@/magic +CPPFLAGS = -DMAGIC='"$(MAGIC)"' + +man_MANS = file.1 magic.4 + +file_SOURCES = file.c apprentice.c fsmagic.c softmagic.c ascmagic.c \ + compress.c is_tar.c readelf.c internat.c print.c \ + file.h names.h patchlevel.h readelf.h tar.h + +EXTRA_DIST = LEGAL.NOTICE MAINT PORTING Makefile.std magic2mime \ + Localstuff Header $(magic_FRAGMENTS) file.man magic.man + +CLEANFILES = $(man_MANS) magic + +magic: Header Localstuff $(magic_FRAGMENTS) + cat $(srcdir)/Header $(srcdir)/Localstuff > $@ + for frag in $(magic_FRAGMENTS); do \ + if test -f $(srcdir)/$$frag; then \ + f=$(srcdir)/$$frag; \ + else \ + f=$$frag; \ + fi; \ + cat $$f; \ + done >> $@ + +file.1: Makefile file.man + @rm -f $@ + sed -e s@__CSECTION__@1@g \ + -e s@__FSECTION__@4@g \ + -e s@__VERSION__@${VERSION}@g \ + -e s@__MAGIC__@${MAGIC}@g $(srcdir)/file.man > $@ + +magic.4: Makefile magic.man + @rm -f $@ + sed -e s@__CSECTION__@1@g \ + -e s@__FSECTION__@4@g \ + -e s@__VERSION__@${VERSION}@g \ + -e s@__MAGIC__@${MAGIC}@g $(srcdir)/magic.man > $@ + +magic_FRAGMENTS = Magdir/adventure Magdir/alliant Magdir/alpha Magdir/amanda \ +Magdir/amigaos Magdir/animation Magdir/apl Magdir/apple Magdir/applix \ +Magdir/archive Magdir/asterix Magdir/att3b Magdir/audio Magdir/blit \ +Magdir/bsdi Magdir/c-lang Magdir/chi Magdir/cisco Magdir/clipper \ +Magdir/commands Magdir/compress Magdir/convex Magdir/database \ +Magdir/diamond Magdir/diff Magdir/digital Magdir/dump Magdir/elf \ +Magdir/encore Magdir/filesystems Magdir/flash Magdir/fonts Magdir/frame \ +Magdir/freebsd Magdir/gimp Magdir/gnu Magdir/hp Magdir/ibm370 \ +Magdir/ibm6000 Magdir/iff Magdir/images Magdir/intel Magdir/interleaf \ +Magdir/island Magdir/ispell Magdir/java Magdir/karma Magdir/lecter \ +Magdir/lex Magdir/lif Magdir/linux Magdir/lisp Magdir/mach Magdir/macintosh \ +Magdir/magic Magdir/mail.news Magdir/mime Magdir/mirage Magdir/mkid \ +Magdir/mmdf Magdir/modem Magdir/motorola Magdir/msdos Magdir/ncr \ +Magdir/netbsd Magdir/news Magdir/octave Magdir/olf Magdir/os2 Magdir/os9 \ +Magdir/osf1 Magdir/pbm Magdir/pdf Magdir/pdp Magdir/pgp Magdir/pkgadd \ +Magdir/plus5 Magdir/printer Magdir/psdbms Magdir/pyramid Magdir/riff \ +Magdir/rpm Magdir/rtf Magdir/sc Magdir/sccs Magdir/sendmail Magdir/sequent \ +Magdir/sgi Magdir/sgml Magdir/sniffer Magdir/softquad Magdir/sun \ +Magdir/teapot Magdir/terminfo Magdir/tex Magdir/ti-8x Magdir/timezone \ +Magdir/troff Magdir/typeset Magdir/unknown Magdir/uuencode \ +Magdir/varied.out Magdir/vax Magdir/vicar Magdir/visx Magdir/vms \ +Magdir/wordperfect Magdir/xenix Magdir/zilog Magdir/zyxel diff --git a/Makefile.in b/Makefile.in index 74e1e765..1ae2ac43 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,174 +1,542 @@ -# Makefile for file(1) cmd. -# Copyright (c) Ian F. Darwin 86/09/01 - see LEGAL.NOTICE. -# @(#)$Id: Makefile.in,v 1.5 1998/09/12 13:17:52 christos Exp $ -# -# This software is not subject to any license of the American Telephone -# and Telegraph Company or of the Regents of the University of California. -# -# Permission is granted to anyone to use this software for any purpose on -# any computer system, and to alter it and redistribute it freely, subject -# to the following restrictions: -# -# 1. The author is not responsible for the consequences of use of this -# software, no matter how awful, even if they arise from flaws in it. -# -# 2. The origin of this software must not be misrepresented, either by -# explicit claim or by omission. Since few users ever read sources, -# credits must appear in the documentation. -# -# 3. Altered versions must be plainly marked as such, and must not be -# misrepresented as being the original software. Since few users -# ever read sources, credits must appear in the documentation. -# -# 4. This notice may not be removed or altered. -VERSION = 3.26 -SHELL = /bin/sh -#MAGIC = /etc/magic +# Makefile.in generated automatically by automake 1.4a from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# don't enforce GNU packaging standards + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ prefix = @prefix@ -INSTALLCMD = @INSTALL@ -MAGICDIR = @datadir@ -MAGIC = $(MAGICDIR)/magic -DEFS = -DMAGIC='"$(MAGIC)"' -DBUILTIN_ELF -DELFCORE -DHAVE_CONFIG_H -CPPFLAGS = $(DEFS) -CC = @CC@ -#COPTS = -O -g # newer compilers allow both; else drop -O -# For truly antique environments, use this for (dummy) include files: -#COPTS = -O # -Ilocalinc -#CFLAGS = $(COPTS) $(DEFS) +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = . + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +CC = @CC@ +LN_S = @LN_S@ +MAKEINFO = @MAKEINFO@ +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ + +AUTOMAKE_OPTIONS = foreign + +bin_PROGRAMS = file + +data_DATA = magic + +MAGIC = @datadir@/magic +CPPFLAGS = -DMAGIC='"$(MAGIC)"' + +man_MANS = file.1 magic.4 + +file_SOURCES = file.c apprentice.c fsmagic.c softmagic.c ascmagic.c compress.c is_tar.c readelf.c internat.c print.c file.h names.h patchlevel.h readelf.h tar.h + + +EXTRA_DIST = LEGAL.NOTICE MAINT PORTING Makefile.std magic2mime Localstuff Header $(magic_FRAGMENTS) file.man magic.man + + +CLEANFILES = $(man_MANS) magic + +magic_FRAGMENTS = Magdir/adventure Magdir/alliant Magdir/alpha Magdir/amanda Magdir/amigaos Magdir/animation Magdir/apl Magdir/apple Magdir/applix Magdir/archive Magdir/asterix Magdir/att3b Magdir/audio Magdir/blit Magdir/bsdi Magdir/c-lang Magdir/chi Magdir/cisco Magdir/clipper Magdir/commands Magdir/compress Magdir/convex Magdir/database Magdir/diamond Magdir/diff Magdir/digital Magdir/dump Magdir/elf Magdir/encore Magdir/filesystems Magdir/flash Magdir/fonts Magdir/frame Magdir/freebsd Magdir/gimp Magdir/gnu Magdir/hp Magdir/ibm370 Magdir/ibm6000 Magdir/iff Magdir/images Magdir/intel Magdir/interleaf Magdir/island Magdir/ispell Magdir/java Magdir/karma Magdir/lecter Magdir/lex Magdir/lif Magdir/linux Magdir/lisp Magdir/mach Magdir/macintosh Magdir/magic Magdir/mail.news Magdir/mime Magdir/mirage Magdir/mkid Magdir/mmdf Magdir/modem Magdir/motorola Magdir/msdos Magdir/ncr Magdir/netbsd Magdir/news Magdir/octave Magdir/olf Magdir/os2 Magdir/os9 Magdir/osf1 Magdir/pbm Magdir/pdf Magdir/pdp Magdir/pgp Magdir/pkgadd Magdir/plus5 Magdir/printer Magdir/psdbms Magdir/pyramid Magdir/riff Magdir/rpm Magdir/rtf Magdir/sc Magdir/sccs Magdir/sendmail Magdir/sequent Magdir/sgi Magdir/sgml Magdir/sniffer Magdir/softquad Magdir/sun Magdir/teapot Magdir/terminfo Magdir/tex Magdir/ti-8x Magdir/timezone Magdir/troff Magdir/typeset Magdir/unknown Magdir/uuencode Magdir/varied.out Magdir/vax Magdir/vicar Magdir/visx Magdir/vms Magdir/wordperfect Magdir/xenix Magdir/zilog Magdir/zyxel + +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +PROGRAMS = $(bin_PROGRAMS) + + +DEFS = @DEFS@ -I. -I$(srcdir) -I. +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +file_OBJECTS = file.o apprentice.o fsmagic.o softmagic.o ascmagic.o \ +compress.o is_tar.o readelf.o internat.o print.o +file_LDADD = $(LDADD) +file_DEPENDENCIES = +file_LDFLAGS = CFLAGS = @CFLAGS@ -#LDFLAGS = $(COPTS) # -Bstatic # older gdb couldn't handle shared libs -SHAR = bundle -OFILE = /usr/bin/file # old or distributed version, for comparison -# Where new binary lives; typically /usr/local (BSD), /usr/lbin (USG). -BINDIR = @exec_prefix@/bin -# For installing our man pages; -# MANCxxx is manual section for Commands, MANFxxx is section for file formats. -# MANxDIR is directory names; MANxEXT is the filename extention. Usual values: -# Variable V7 4BSD Sys V -# MANCDIR /usr/man/man1 /usr/man/man1 /usr/man/u_man/man1 -# MANFDIR /usr/man/man5 /usr/man/man5 /usr/man/u_man/man4 -# MANCEXT 1 1 1 -# MANFEXT 5 5 4 -# --- possible alternative for 4BSD --- -# MANCDIR /usr/local/man/man1 -# MANCEXT 1 -# or -# MANCDIR /usr/man/manl -# MANCEXT l -# --- possible alternative for USG --- -# MANCDIR /usr/man/local/man1 -# MANCEXT 1 - -MANCDIR = @mandir@/man1 -MANCEXT = 1 -MANFDIR = @mandir@/man4 -MANFEXT = 4 - -# There are no system-dependant configuration options (except maybe CFLAGS). -# Uncomment any of these that is missing from your "standard" library. -LOCALSRCS = # localsrc/getopt.c localsrc/strtol.c \ -# localsrc/strtok.c localsrc/strchr.c -LOCALOBJS = # localsrc/getopt.o localsrc/strtol.o \ -# localsrc/strtok.o localsrc/strchr.o -# These are not compiled in unless you use -Ilocalinc, but -# are not commented out as "make dist" &c use them. -LOCALINC = # localinc/*.h localinc/sys/*.h - -SRCS = file.c apprentice.c fsmagic.c softmagic.c ascmagic.c \ - compress.c is_tar.c readelf.c internat.c \ - print.c $(LOCALSRCS) $(LOCALINC) -OBJS = file.o apprentice.o fsmagic.o softmagic.o ascmagic.o \ - compress.o is_tar.o readelf.o internat.o \ - print.o $(LOCALOBJS) -HDRS = file.h names.h patchlevel.h readelf.h tar.h - -AUTOSRC=configure configure.in install-sh config.h.in Makefile.in -ALLSRC = LEGAL.NOTICE README MAINT PORTING $(SRCS) $(HDRS) \ - Makefile.std file.man magic.man magic2mime $(AUTOSRC) \ - Localstuff Header -ALLMAGIC = Magdir/[a-z]* - -all: file magic file.${MANCEXT} magic.${MANFEXT} - -TESTFILES = * tst/* -try: all $(OFILE) - cd tst; $(MAKE) - time $(OFILE) $(TESTFILES) >/tmp/t1 # can't use ./magic - time ./file -m ./magic $(TESTFILES) >/tmp/t2 - -diff -b /tmp/t[12] - what ./file >lastnocore - -file: $(OBJS) - $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@ -lint: $(SRCS) - lint -ha $(DEFS) $(SRCS) | tee $@ -magic: Header Localstuff Magdir - cat Header Localstuff Magdir/[a-z]* > $@ - -ascmagic.o: names.h - -compress.o apprentice.o ascmagic.o file.o fsmagic.o print.o softmagic.o: file.h - -install: file magic - -mkdir $(BINDIR) $(MAGICDIR) $(MANCDIR) $(MANFDIR) - $(INSTALLCMD) file $(BINDIR)/file - $(INSTALLCMD) magic $(MAGIC) - $(INSTALLCMD) file.${MANCEXT} $(MANCDIR)/file.$(MANCEXT) - $(INSTALLCMD) magic.${MANFEXT} $(MANFDIR)/magic.$(MANFEXT) - -install.man: file.${MANCEXT} magic.${MANFEXT} - cp file.${MANCEXT} $(MANCDIR)/file.$(MANCEXT) - cp magic.${MANFEXT} $(MANFDIR)/magic.$(MANFEXT) - -clean: - rm -f *.o core file magic lint dist.* MANIFEST \ - magic.${MANFEXT} file.${MANCEXT} \ - config.h config.status config.cache config.log -clobber: - cd tst; $(MAKE) clean - - -magic.${MANFEXT} : Makefile magic.man - @rm -f $@ - sed -e s@__CSECTION__@${MANCEXT}@g \ - -e s@__FSECTION__@${MANFEXT}@g \ - -e s@__VERSION__@${VERSION}@g \ - -e s@__MAGIC__@${MAGIC}@g magic.man > $@ - -file.${MANCEXT} : Makefile file.man - @rm -f $@ - sed -e s@__CSECTION__@${MANCEXT}@g \ - -e s@__FSECTION__@${MANFEXT}@g \ - -e s@__VERSION__@${VERSION}@g \ - -e s@__MAGIC__@${MAGIC}@g file.man > $@ - -send: dist - ftp ftp.cs - -dist: dist.src dist.magic - @echo Now check this patchlevel! - ident patchlevel.h - -dist.src: $(ALLSRC) MANIFEST -# Some versions of shar can't handle a single file from -# a subdirectory, so we manually insert mkdir as needed. -# The point is to exclude all the generable targets in tst. - (echo mkdir localinc localinc/sys localsrc tst; \ - $(SHAR) $(ALLSRC) MANIFEST) > $@ - -rcsdiff: $(ALLSRC) - rcsdiff -q RCS/* - -MANIFEST: $(ALLSRC) - ident $(ALLSRC) > MANIFEST -dist.magic: Magdir -# As above, but to exclude Magdir/RCS from being shipped. - (echo mkdir Magdir; $(SHAR) $(ALLMAGIC)) >$@ - -tar: $(ALLSRC) $(ALLMAGIC) - -rm -fr file-${VERSION} - -mkdir file-${VERSION} file-${VERSION}/Magdir - ln $(ALLSRC) file-${VERSION} - ln ${ALLMAGIC} file-${VERSION}/Magdir - tar cvf file-${VERSION}.tar file-${VERSION} - -rm -fr file-${VERSION} +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +man1dir = $(mandir)/man1 +man4dir = $(mandir)/man4 +MANS = $(man_MANS) + +NROFF = nroff +DATA = $(data_DATA) + +DIST_COMMON = README ./stamp-h.in Makefile.am Makefile.in acconfig.h \ +acinclude.m4 aclocal.m4 config.h.in configure configure.in install-sh \ +missing mkinstalldirs + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = tar +GZIP_ENV = --best +DEP_FILES = .deps/apprentice.P .deps/ascmagic.P .deps/compress.P \ +.deps/file.P .deps/fsmagic.P .deps/internat.P .deps/is_tar.P \ +.deps/print.P .deps/readelf.P .deps/softmagic.P +SOURCES = $(file_SOURCES) +OBJECTS = $(file_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .S .c .o .s +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/$(altdir)configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +$(ACLOCAL_M4): configure.in acinclude.m4 + cd $(srcdir) && $(ACLOCAL) + +config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck +$(srcdir)/configure: $(srcdir)/$(altdir)configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) + +config.h: stamp-h + @if test ! -f $@; then \ + rm -f stamp-h; \ + $(MAKE) stamp-h; \ + else :; fi +stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES= CONFIG_HEADERS=config.h \ + $(SHELL) ./config.status + @echo timestamp > stamp-h 2> /dev/null +$(srcdir)/config.h.in: $(srcdir)/./stamp-h.in + @if test ! -f $@; then \ + rm -f $(srcdir)/./stamp-h.in; \ + $(MAKE) $(srcdir)/./stamp-h.in; \ + else :; fi +$(srcdir)/./stamp-h.in: $(top_srcdir)/$(altdir)configure.in $(ACLOCAL_M4) acconfig.h + cd $(top_srcdir) && $(AUTOHEADER) + @echo timestamp > $(srcdir)/./stamp-h.in 2> /dev/null + +mostlyclean-hdr: + +clean-hdr: + +distclean-hdr: + -rm -f config.h + +maintainer-clean-hdr: + +mostlyclean-binPROGRAMS: + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +distclean-binPROGRAMS: + +maintainer-clean-binPROGRAMS: + +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(bindir) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ + $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + list='$(bin_PROGRAMS)'; for p in $$list; do \ + rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + done + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +.c.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +file: $(file_OBJECTS) $(file_DEPENDENCIES) + @rm -f file + $(LINK) $(file_LDFLAGS) $(file_OBJECTS) $(file_LDADD) $(LIBS) + +install-man1: + $(mkinstalldirs) $(DESTDIR)$(man1dir) + @list='$(man1_MANS)'; \ + l2='$(man_MANS)'; for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ + else file=$$i; fi; \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \ + $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \ + done + +uninstall-man1: + @list='$(man1_MANS)'; \ + l2='$(man_MANS)'; for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \ + rm -f $(DESTDIR)$(man1dir)/$$inst; \ + done + +install-man4: + $(mkinstalldirs) $(DESTDIR)$(man4dir) + @list='$(man4_MANS)'; \ + l2='$(man_MANS)'; for i in $$l2; do \ + case "$$i" in \ + *.4*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ + else file=$$i; fi; \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man4dir)/$$inst"; \ + $(INSTALL_DATA) $$file $(DESTDIR)$(man4dir)/$$inst; \ + done + +uninstall-man4: + @list='$(man4_MANS)'; \ + l2='$(man_MANS)'; for i in $$l2; do \ + case "$$i" in \ + *.4*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " rm -f $(DESTDIR)$(man4dir)/$$inst"; \ + rm -f $(DESTDIR)$(man4dir)/$$inst; \ + done +install-man: $(MANS) + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-man1 install-man4 +uninstall-man: + @$(NORMAL_UNINSTALL) + $(MAKE) $(AM_MAKEFLAGS) uninstall-man1 uninstall-man4 + +install-dataDATA: $(data_DATA) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(datadir) + @list='$(data_DATA)'; for p in $$list; do \ + if test -f $(srcdir)/$$p; then \ + echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(datadir)/$$p"; \ + $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(datadir)/$$p; \ + else if test -f $$p; then \ + echo " $(INSTALL_DATA) $$p $(DESTDIR)$(datadir)/$$p"; \ + $(INSTALL_DATA) $$p $(DESTDIR)$(datadir)/$$p; \ + fi; fi; \ + done + +uninstall-dataDATA: + @$(NORMAL_UNINSTALL) + list='$(data_DATA)'; for p in $$list; do \ + rm -f $(DESTDIR)$(datadir)/$$p; \ + done + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + -rm -rf $(distdir) + GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz + mkdir $(distdir)/=build + mkdir $(distdir)/=inst + dc_install_base=`cd $(distdir)/=inst && pwd`; \ + cd $(distdir)/=build \ + && ../configure --srcdir=.. --prefix=$$dc_install_base \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) dist + -rm -rf $(distdir) + @banner="$(distdir).tar.gz is ready for distribution"; \ + dashes=`echo "$$banner" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + echo "$$dashes" +dist: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +dist-all: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +distdir: $(DISTFILES) + -rm -rf $(distdir) + mkdir $(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 --foreign Makefile + $(mkinstalldirs) $(distdir)/Magdir + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + 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: info-am +dvi-am: +dvi: dvi-am +check-am: all-am +check: check-am +installcheck-am: +installcheck: installcheck-am +all-recursive-am: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +install-exec-am: install-binPROGRAMS +install-exec: install-exec-am + +install-data-am: install-man install-dataDATA +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: uninstall-binPROGRAMS uninstall-man uninstall-dataDATA +uninstall: uninstall-am +all-am: Makefile $(PROGRAMS) $(MANS) $(DATA) config.h +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1 \ + $(DESTDIR)$(mandir)/man4 $(DESTDIR)$(datadir) + + +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-hdr mostlyclean-binPROGRAMS \ + mostlyclean-compile mostlyclean-tags mostlyclean-depend \ + mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-hdr clean-binPROGRAMS clean-compile clean-tags \ + clean-depend clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-hdr distclean-binPROGRAMS distclean-compile \ + distclean-tags distclean-depend distclean-generic \ + clean-am + +distclean: distclean-am + -rm -f config.status + +maintainer-clean-am: maintainer-clean-hdr maintainer-clean-binPROGRAMS \ + maintainer-clean-compile maintainer-clean-tags \ + maintainer-clean-depend maintainer-clean-generic \ + distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + -rm -f config.status + +.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \ +mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \ +maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ +mostlyclean-compile distclean-compile clean-compile \ +maintainer-clean-compile install-man1 uninstall-man1 install-man4 \ +uninstall-man4 install-man uninstall-man uninstall-dataDATA \ +install-dataDATA tags mostlyclean-tags distclean-tags clean-tags \ +maintainer-clean-tags distdir mostlyclean-depend distclean-depend \ +clean-depend maintainer-clean-depend info-am info dvi-am dvi check \ +check-am installcheck-am installcheck all-recursive-am 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 \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +magic: Header Localstuff $(magic_FRAGMENTS) + cat $(srcdir)/Header $(srcdir)/Localstuff > $@ + for frag in $(magic_FRAGMENTS); do \ + if test -f $(srcdir)/$$frag; then \ + f=$(srcdir)/$$frag; \ + else \ + f=$$frag; \ + fi; \ + cat $$f; \ + done >> $@ + +file.1: Makefile file.man + @rm -f $@ + sed -e s@__CSECTION__@1@g \ + -e s@__FSECTION__@4@g \ + -e s@__VERSION__@${VERSION}@g \ + -e s@__MAGIC__@${MAGIC}@g $(srcdir)/file.man > $@ + +magic.4: Makefile magic.man + @rm -f $@ + sed -e s@__CSECTION__@1@g \ + -e s@__FSECTION__@4@g \ + -e s@__VERSION__@${VERSION}@g \ + -e s@__MAGIC__@${MAGIC}@g $(srcdir)/magic.man > $@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 00000000..3da5afb7 --- /dev/null +++ b/acinclude.m4 @@ -0,0 +1,79 @@ +dnl cloned from autoconf 2.13 acspecific.m4 +AC_DEFUN(AC_C_LONG_LONG, +[AC_CACHE_CHECK(for long long, ac_cv_c_long_long, +[if test "$GCC" = yes; then + ac_cv_c_long_long=yes +else +AC_TRY_RUN([int main() { +long long foo = 0; +exit(sizeof(long long) < sizeof(long)); }], +ac_cv_c_long_long=yes, ac_cv_c_long_long=no) +fi]) +if test $ac_cv_c_long_long = yes; then + AC_DEFINE(HAVE_LONG_LONG) +fi +]) + +dnl from autoconf 2.13 acgeneral.m4, with patch: +dnl Date: Fri, 15 Jan 1999 05:52:41 -0800 +dnl Message-ID: <199901151352.FAA18237@shade.twinsun.com> +dnl From: eggert@twinsun.com (Paul Eggert) +dnl Subject: autoconf 2.13 AC_CHECK_TYPE doesn't allow shell vars +dnl Newsgroups: gnu.utils.bug + +dnl AC_CHECK_TYPE2(TYPE, DEFAULT) +AC_DEFUN(AC_CHECK_TYPE2, +[AC_REQUIRE([AC_HEADER_STDC])dnl +AC_MSG_CHECKING(for $1) +AC_CACHE_VAL(ac_cv_type_$1, +[AC_EGREP_CPP(dnl +changequote(<<,>>)dnl +<<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl +changequote([,]), [#include +#if STDC_HEADERS +#include +#include +#endif], eval "ac_cv_type_$1=yes", eval "ac_cv_type_$1=no")])dnl +if eval "test \"`echo '$ac_cv_type_'$1`\" = yes"; then + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) + AC_DEFINE_UNQUOTED($1, $2) +fi +]) + +dnl from autoconf 2.13 acgeneral.m4, with additional third argument +dnl AC_CHECK_SIZEOF_INCLUDES(TYPE [, CROSS-SIZE, [INCLUDES]]) +AC_DEFUN(AC_CHECK_SIZEOF_INCLUDES, +[changequote(<<, >>)dnl +dnl The name to #define. +define(<>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl +dnl The cache variable name. +define(<>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl +changequote([, ])dnl +AC_MSG_CHECKING(size of $1) +AC_CACHE_VAL(AC_CV_NAME, +[AC_TRY_RUN([$3 +#include +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof($1)); + exit(0); +}], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$2], , , AC_CV_NAME=$2))])dnl +AC_MSG_RESULT($AC_CV_NAME) +AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME) +undefine([AC_TYPE_NAME])dnl +undefine([AC_CV_NAME])dnl +]) + +dnl AC_CHECK_SIZEOF_STDC_HEADERS(TYPE [, CROSS_SIZE]) +AC_DEFUN(AC_CHECK_SIZEOF_STDC_HEADERS, +[AC_CHECK_SIZEOF_INCLUDES($1, $2, +[#include +#ifdef STDC_HEADERS +#include +#endif +]) +]) diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 00000000..11d280df --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,207 @@ +dnl aclocal.m4 generated automatically by aclocal 1.4a + +dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. + +dnl cloned from autoconf 2.13 acspecific.m4 +AC_DEFUN(AC_C_LONG_LONG, +[AC_CACHE_CHECK(for long long, ac_cv_c_long_long, +[if test "$GCC" = yes; then + ac_cv_c_long_long=yes +else +AC_TRY_RUN([int main() { +long long foo = 0; +exit(sizeof(long long) < sizeof(long)); }], +ac_cv_c_long_long=yes, ac_cv_c_long_long=no) +fi]) +if test $ac_cv_c_long_long = yes; then + AC_DEFINE(HAVE_LONG_LONG) +fi +]) + +dnl from autoconf 2.13 acgeneral.m4, with patch: +dnl Date: Fri, 15 Jan 1999 05:52:41 -0800 +dnl Message-ID: <199901151352.FAA18237@shade.twinsun.com> +dnl From: eggert@twinsun.com (Paul Eggert) +dnl Subject: autoconf 2.13 AC_CHECK_TYPE doesn't allow shell vars +dnl Newsgroups: gnu.utils.bug + +dnl AC_CHECK_TYPE2(TYPE, DEFAULT) +AC_DEFUN(AC_CHECK_TYPE2, +[AC_REQUIRE([AC_HEADER_STDC])dnl +AC_MSG_CHECKING(for $1) +AC_CACHE_VAL(ac_cv_type_$1, +[AC_EGREP_CPP(dnl +changequote(<<,>>)dnl +<<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl +changequote([,]), [#include +#if STDC_HEADERS +#include +#include +#endif], eval "ac_cv_type_$1=yes", eval "ac_cv_type_$1=no")])dnl +if eval "test \"`echo '$ac_cv_type_'$1`\" = yes"; then + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) + AC_DEFINE_UNQUOTED($1, $2) +fi +]) + +dnl from autoconf 2.13 acgeneral.m4, with additional third argument +dnl AC_CHECK_SIZEOF_INCLUDES(TYPE [, CROSS-SIZE, [INCLUDES]]) +AC_DEFUN(AC_CHECK_SIZEOF_INCLUDES, +[changequote(<<, >>)dnl +dnl The name to #define. +define(<>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl +dnl The cache variable name. +define(<>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl +changequote([, ])dnl +AC_MSG_CHECKING(size of $1) +AC_CACHE_VAL(AC_CV_NAME, +[AC_TRY_RUN([$3 +#include +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof($1)); + exit(0); +}], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$2], , , AC_CV_NAME=$2))])dnl +AC_MSG_RESULT($AC_CV_NAME) +AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME) +undefine([AC_TYPE_NAME])dnl +undefine([AC_CV_NAME])dnl +]) + +dnl AC_CHECK_SIZEOF_STDC_HEADERS(TYPE [, CROSS_SIZE]) +AC_DEFUN(AC_CHECK_SIZEOF_STDC_HEADERS, +[AC_CHECK_SIZEOF_INCLUDES($1, $2, +[#include +#ifdef STDC_HEADERS +#include +#endif +]) +]) + +# Do all the work for Automake. This macro actually does too much -- +# some checks are only needed if your package does certain things. +# But this isn't really a big deal. + +# serial 1 + +dnl Usage: +dnl AM_INIT_AUTOMAKE(package,version, [no-define]) + +AC_DEFUN(AM_INIT_AUTOMAKE, +[AC_REQUIRE([AC_PROG_INSTALL]) +PACKAGE=[$1] +AC_SUBST(PACKAGE) +VERSION=[$2] +AC_SUBST(VERSION) +dnl test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi +ifelse([$3],, +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) +AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) +AC_REQUIRE([AM_SANITY_CHECK]) +AC_REQUIRE([AC_ARG_PROGRAM]) +dnl FIXME This is truly gross. +missing_dir=`cd $ac_aux_dir && pwd` +AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) +AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) +AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) +AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) +AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) +AC_REQUIRE([AC_PROG_MAKE_SET])]) + +# +# Check to make sure that the build environment is sane. +# + +AC_DEFUN(AM_SANITY_CHECK, +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "[$]*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "[$]*" != "X $srcdir/configure conftestfile" \ + && test "[$]*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "[$]2" = conftestfile + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +rm -f conftest* +AC_MSG_RESULT(yes)]) + +dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) +dnl The program must properly implement --version. +AC_DEFUN(AM_MISSING_PROG, +[AC_MSG_CHECKING(for working $2) +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if ($2 --version) < /dev/null > /dev/null 2>&1; then + $1=$2 + AC_MSG_RESULT(found) +else + $1="$3/missing $2" + AC_MSG_RESULT(missing) +fi +AC_SUBST($1)]) + +# Like AC_CONFIG_HEADER, but automatically create stamp file. + +AC_DEFUN(AM_CONFIG_HEADER, +[AC_PREREQ([2.12]) +AC_CONFIG_HEADER([$1]) +dnl When config.status generates a header, we must update the stamp-h file. +dnl This file resides in the same directory as the config header +dnl that is generated. We must strip everything past the first ":", +dnl and everything past the last "/". +AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl +ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, +<>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, +<>; do + case " <<$>>CONFIG_HEADERS " in + *" <<$>>am_file "*<<)>> + echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx + ;; + esac + am_indx=`expr "<<$>>am_indx" + 1` +done<<>>dnl>>) +changequote([,]))]) + diff --git a/config.h.in b/config.h.in index efd00d4e..cccf98c8 100644 --- a/config.h.in +++ b/config.h.in @@ -9,6 +9,12 @@ /* Define if you have that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H +/* Define if major, minor, and makedev are declared in . */ +#undef MAJOR_IN_MKDEV + +/* Define if major, minor, and makedev are declared in . */ +#undef MAJOR_IN_SYSMACROS + /* Define to `long' if doesn't define. */ #undef off_t @@ -17,3 +23,53 @@ /* Define if you have the ANSI C header files. */ #undef STDC_HEADERS + +/* Define if builtin ELF support is enabled. */ +#undef BUILTIN_ELF + +/* Define if ELF core file support is enabled. */ +#undef ELFCORE + +/* Define if the `long long' type works. */ +#undef HAVE_LONG_LONG + +/* Define to `unsigned char' if standard headers don't define. */ +#undef uint8_t + +/* Define to `unsigned short' if standard headers don't define. */ +#undef uint16_t + +/* Define to `unsigned int' if standard headers don't define. */ +#undef uint32_t + +/* Define to `unsigned long long', if available, or `unsigned long', if + standard headers don't define. */ +#undef uint64_t + +/* The number of bytes in a uint8_t. */ +#define SIZEOF_UINT8_T 0 + +/* The number of bytes in a uint16_t. */ +#define SIZEOF_UINT16_T 0 + +/* The number of bytes in a uint32_t. */ +#define SIZEOF_UINT32_T 0 + +/* The number of bytes in a uint64_t. */ +#define SIZEOF_UINT64_T 0 + +/* Define if you have the strerror function. */ +#undef HAVE_STRERROR + +/* Define if you have the strtoul function. */ +#undef HAVE_STRTOUL + +/* Define if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Name of package */ +#undef PACKAGE + +/* Version number of package */ +#undef VERSION + diff --git a/configure b/configure index d6193388..ab95282f 100755 --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.12 +# Generated automatically using autoconf version 2.14.1 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation @@ -11,6 +11,10 @@ ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: +ac_help="$ac_help + --disable-elf disable builtin ELF support" +ac_help="$ac_help + --disable-elf-core disable ELF core file support" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -49,6 +53,7 @@ mandir='${prefix}/man' # Initialize some other variables. subdirs= MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. ac_max_here_lines=12 @@ -332,7 +337,7 @@ EOF verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.12" + echo "configure generated by autoconf version 2.14.1" exit 0 ;; -with-* | --with-*) @@ -502,9 +507,11 @@ ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross +ac_exeext= +ac_objext=o if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then @@ -518,20 +525,327 @@ else fi +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:560: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 +echo "configure:613: checking whether build environment is sane" >&5 +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "$*" != "X $srcdir/configure conftestfile" \ + && test "$*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { echo "configure: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" 1>&2; exit 1; } + fi + + test "$2" = conftestfile + ) +then + # Ok. + : +else + { echo "configure: error: newly created file is older than distributed files! +Check your system clock" 1>&2; exit 1; } +fi +rm -f conftest* +echo "$ac_t""yes" 1>&6 +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:670: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + + +PACKAGE=file + +VERSION=3.26 + +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } +fi +cat >> confdefs.h <> confdefs.h <&6 +echo "configure:716: checking for working aclocal" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (aclocal --version) < /dev/null > /dev/null 2>&1; then + ACLOCAL=aclocal + echo "$ac_t""found" 1>&6 +else + ACLOCAL="$missing_dir/missing aclocal" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 +echo "configure:729: checking for working autoconf" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoconf --version) < /dev/null > /dev/null 2>&1; then + AUTOCONF=autoconf + echo "$ac_t""found" 1>&6 +else + AUTOCONF="$missing_dir/missing autoconf" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working automake""... $ac_c" 1>&6 +echo "configure:742: checking for working automake" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (automake --version) < /dev/null > /dev/null 2>&1; then + AUTOMAKE=automake + echo "$ac_t""found" 1>&6 +else + AUTOMAKE="$missing_dir/missing automake" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 +echo "configure:755: checking for working autoheader" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoheader --version) < /dev/null > /dev/null 2>&1; then + AUTOHEADER=autoheader + echo "$ac_t""found" 1>&6 +else + AUTOHEADER="$missing_dir/missing autoheader" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 +echo "configure:768: checking for working makeinfo" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (makeinfo --version) < /dev/null > /dev/null 2>&1; then + MAKEINFO=makeinfo + echo "$ac_t""found" 1>&6 +else + MAKEINFO="$missing_dir/missing makeinfo" + echo "$ac_t""missing" 1>&6 +fi + + + + + + +echo $ac_n "checking for builtin ELF support""... $ac_c" 1>&6 +echo "configure:786: checking for builtin ELF support" >&5 +# Check whether --enable-elf or --disable-elf was given. +if test "${enable_elf+set}" = set; then + enableval="$enable_elf" + if test "${enableval}" = yes; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define BUILTIN_ELF 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +else + + # enable by default + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define BUILTIN_ELF 1 +EOF + + +fi + + +echo $ac_n "checking for ELF core file support""... $ac_c" 1>&6 +echo "configure:812: checking for ELF core file support" >&5 +# Check whether --enable-elf-core or --disable-elf-core was given. +if test "${enable_elf_core+set}" = set; then + enableval="$enable_elf_core" + if test "${enableval}" = yes; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define ELFCORE 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +else + + # enable by default + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define ELFCORE 1 +EOF + + +fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:527: checking for $ac_word" >&5 +echo "configure:840: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="gcc" @@ -552,16 +866,17 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:556: checking for $ac_word" >&5 +echo "configure:870: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_prog_rejected=no - for ac_dir in $PATH; do + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then @@ -596,25 +911,61 @@ else echo "$ac_t""no" 1>&6 fi + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:921: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:604: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:953: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross -cat > conftest.$ac_ext < conftest.$ac_ext << EOF + +#line 964 "configure" #include "confdefs.h" + main(){return(0);} EOF -if { (eval echo configure:618: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:969: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -628,18 +979,24 @@ else ac_cv_prog_cc_works=no fi rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:638: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:995: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:643: checking whether we are using GNU C" >&5 +echo "configure:1000: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -648,7 +1005,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:652: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1009: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -659,11 +1016,15 @@ echo "$ac_t""$ac_cv_prog_gcc" 1>&6 if test $ac_cv_prog_gcc = yes; then GCC=yes - ac_test_CFLAGS="${CFLAGS+set}" - ac_save_CFLAGS="$CFLAGS" - CFLAGS= - echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:667: checking whether ${CC-cc} accepts -g" >&5 +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:1028: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -678,36 +1039,21 @@ rm -f conftest* fi echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 - if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" - elif test $ac_cv_prog_cc_g = yes; then +if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then CFLAGS="-g -O2" else - CFLAGS="-O2" + CFLAGS="-g" fi else - GCC= - test "${CFLAGS+set}" = set || CFLAGS="-g" -fi - -ac_aux_dir= -for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do - if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= fi -done -if test -z "$ac_aux_dir"; then - { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } fi -ac_config_guess=$ac_aux_dir/config.guess -ac_config_sub=$ac_aux_dir/config.sub -ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or @@ -716,28 +1062,30 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:724: checking for a BSD compatible install" >&5 +echo "configure:1071: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" for ac_dir in $PATH; do # Account for people who put trailing slashes in PATH elements. case "$ac_dir/" in /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. - for ac_prog in ginstall installbsd scoinst install; do + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do if test -f $ac_dir/$ac_prog; then if test $ac_prog = install && grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. - # OSF/1 installbsd also uses dspmsg, but is usable. : else ac_cv_path_install="$ac_dir/$ac_prog -c" @@ -767,10 +1115,12 @@ echo "$ac_t""$INSTALL" 1>&6 # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:774: checking whether ln -s works" >&5 +echo "configure:1124: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -791,43 +1141,416 @@ else fi -echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:796: checking for working const" >&5 -if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:1146: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1167: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1184: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -nologo -E" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1201: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + +echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +echo "configure:1226: checking for ANSI C header files" >&5 +if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +#include +#include +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1239: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + ac_cv_header_stdc=yes +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. +cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. +cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. +if test "$cross_compiling" = yes; then + : +else + cat > conftest.$ac_ext < +#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int main () { int i; for (i = 0; i < 256; i++) +if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); +exit (0); } + +EOF +if { (eval echo configure:1306: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_header_stdc=no +fi +rm -fr conftest* +fi + +fi +fi + +echo "$ac_t""$ac_cv_header_stdc" 1>&6 +if test $ac_cv_header_stdc = yes; then + cat >> confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + +echo $ac_n "checking whether sys/types.h defines makedev""... $ac_c" 1>&6 +echo "configure:1330: checking whether sys/types.h defines makedev" >&5 +if eval "test \"`echo '$''{'ac_cv_header_sys_types_h_makedev'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int main() { +return makedev(0, 0); +; return 0; } +EOF +if { (eval echo configure:1342: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_header_sys_types_h_makedev=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_sys_types_h_makedev=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_header_sys_types_h_makedev" 1>&6 + +if test $ac_cv_header_sys_types_h_makedev = no; then +ac_safe=`echo "sys/mkdev.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for sys/mkdev.h""... $ac_c" 1>&6 +echo "configure:1360: checking for sys/mkdev.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1370: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define MAJOR_IN_MKDEV 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + + + if test $ac_cv_header_sys_mkdev_h = no; then +ac_safe=`echo "sys/sysmacros.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for sys/sysmacros.h""... $ac_c" 1>&6 +echo "configure:1398: checking for sys/sysmacros.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1408: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define MAJOR_IN_SYSMACROS 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + + fi +fi + +echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 +echo "configure:1436: checking for sys/wait.h that is POSIX.1 compatible" >&5 +if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +#ifndef WEXITSTATUS +#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) +#endif +#ifndef WIFEXITED +#define WIFEXITED(stat_val) (((stat_val) & 255) == 0) +#endif +int main() { +int s; +wait (&s); +s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; +; return 0; } +EOF +if { (eval echo configure:1457: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_header_sys_wait_h=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_sys_wait_h=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6 +if test $ac_cv_header_sys_wait_h = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_SYS_WAIT_H 1 +EOF + +fi + +for ac_hdr in unistd.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1481: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1491: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + + +echo $ac_n "checking for working const""... $ac_c" 1>&6 +echo "configure:1519: checking for working const" >&5 +if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1573: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -866,156 +1589,233 @@ EOF fi -echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:871: checking how to run the C preprocessor" >&5 -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= +echo $ac_n "checking for off_t""... $ac_c" 1>&6 +echo "configure:1594: checking for off_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_off_t=yes +else + rm -rf conftest* + ac_cv_type_off_t=no fi -if test -z "$CPP"; then -if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_off_t" 1>&6 +if test $ac_cv_type_off_t = no; then + cat >> confdefs.h <<\EOF +#define off_t long +EOF + +fi + +echo $ac_n "checking for size_t""... $ac_c" 1>&6 +echo "configure:1627: checking for size_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - # This must be in double quotes, not single quotes, because CPP may get - # substituted into the Makefile and "${CC-cc}" will confuse make. - CPP="${CC-cc} -E" - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. cat > conftest.$ac_ext < -Syntax Error +#include +#if STDC_HEADERS +#include +#include +#endif EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:892: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - : +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_size_t=yes else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" + ac_cv_type_size_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_size_t" 1>&6 +if test $ac_cv_type_size_t = no; then + cat >> confdefs.h <<\EOF +#define size_t unsigned +EOF + +fi + +echo $ac_n "checking for st_rdev in struct stat""... $ac_c" 1>&6 +echo "configure:1660: checking for st_rdev in struct stat" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_st_rdev'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else cat > conftest.$ac_ext < -Syntax Error +#include +#include +int main() { +struct stat s; s.st_rdev; +; return 0; } EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:909: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - : +if { (eval echo configure:1673: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_st_rdev=yes else - echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - CPP=/lib/cpp -fi -rm -f conftest* + ac_cv_struct_st_rdev=no fi rm -f conftest* - ac_cv_prog_CPP="$CPP" fi - CPP="$ac_cv_prog_CPP" -else - ac_cv_prog_CPP="$CPP" + +echo "$ac_t""$ac_cv_struct_st_rdev" 1>&6 +if test $ac_cv_struct_st_rdev = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ST_RDEV 1 +EOF + fi -echo "$ac_t""$CPP" 1>&6 -echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:932: checking for ANSI C header files" >&5 -if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then + +echo $ac_n "checking for uint8_t""... $ac_c" 1>&6 +echo "configure:1695: checking for uint8_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_uint8_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < +#if STDC_HEADERS #include -#include -#include -#include +#include +#endif EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:945: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])uint8_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then rm -rf conftest* - ac_cv_header_stdc=yes + ac_cv_type_uint8_t=yes else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 rm -rf conftest* - ac_cv_header_stdc=no + ac_cv_type_uint8_t=no fi rm -f conftest* -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. -cat > conftest.$ac_ext <&6 +if test $ac_cv_type_uint8_t = no; then + cat >> confdefs.h <<\EOF +#define uint8_t unsigned char +EOF + +fi + +echo $ac_n "checking for uint16_t""... $ac_c" 1>&6 +echo "configure:1728: checking for uint16_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_uint16_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +#if STDC_HEADERS +#include +#include +#endif EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "memchr" >/dev/null 2>&1; then - : + egrep "(^|[^a-zA-Z_0-9])uint16_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_uint16_t=yes else rm -rf conftest* - ac_cv_header_stdc=no + ac_cv_type_uint16_t=no fi rm -f conftest* +fi +echo "$ac_t""$ac_cv_type_uint16_t" 1>&6 +if test $ac_cv_type_uint16_t = no; then + cat >> confdefs.h <<\EOF +#define uint16_t unsigned short +EOF + fi -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. -cat > conftest.$ac_ext <&6 +echo "configure:1761: checking for uint32_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_uint32_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS #include +#include +#endif EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "free" >/dev/null 2>&1; then - : + egrep "(^|[^a-zA-Z_0-9])uint32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_uint32_t=yes else rm -rf conftest* - ac_cv_header_stdc=no + ac_cv_type_uint32_t=no fi rm -f conftest* fi +echo "$ac_t""$ac_cv_type_uint32_t" 1>&6 +if test $ac_cv_type_uint32_t = no; then + cat >> confdefs.h <<\EOF +#define uint32_t unsigned int +EOF -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. +fi + + +echo $ac_n "checking for long long""... $ac_c" 1>&6 +echo "configure:1795: checking for long long" >&5 +if eval "test \"`echo '$''{'ac_cv_c_long_long'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$GCC" = yes; then + ac_cv_c_long_long=yes +else if test "$cross_compiling" = yes; then - : + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < -#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int main () { int i; for (i = 0; i < 256; i++) -if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); -exit (0); } - +int main() { +long long foo = 0; +exit(sizeof(long long) < sizeof(long)); } EOF -if { (eval echo configure:1012: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1812: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then - : + ac_cv_c_long_long=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* - ac_cv_header_stdc=no + ac_cv_c_long_long=no fi rm -fr conftest* fi @@ -1023,21 +1823,26 @@ fi fi fi -echo "$ac_t""$ac_cv_header_stdc" 1>&6 -if test $ac_cv_header_stdc = yes; then +echo "$ac_t""$ac_cv_c_long_long" 1>&6 +if test $ac_cv_c_long_long = yes; then cat >> confdefs.h <<\EOF -#define STDC_HEADERS 1 +#define HAVE_LONG_LONG 1 EOF fi -echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:1036: checking for off_t" >&5 -if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then +if test $ac_cv_c_long_long = yes; then + long64='unsigned long long'; +else + long64='unsigned long'; +fi +echo $ac_n "checking for uint64_t""... $ac_c" 1>&6 +echo "configure:1841: checking for uint64_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_uint64_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1046,133 +1851,263 @@ else #endif EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + egrep "(^|[^a-zA-Z_0-9])uint64_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then rm -rf conftest* - ac_cv_type_off_t=yes + eval "ac_cv_type_uint64_t=yes" else rm -rf conftest* - ac_cv_type_off_t=no + eval "ac_cv_type_uint64_t=no" fi rm -f conftest* fi -echo "$ac_t""$ac_cv_type_off_t" 1>&6 -if test $ac_cv_type_off_t = no; then - cat >> confdefs.h <<\EOF -#define off_t long +if eval "test \"`echo '$ac_cv_type_'uint64_t`\" = yes"; then + echo "$ac_t""yes" 1>&6 +else + echo "$ac_t""no" 1>&6 + cat >> confdefs.h <&6 -echo "configure:1069: checking for size_t" >&5 -if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then + +echo $ac_n "checking size of uint8_t""... $ac_c" 1>&6 +echo "configure:1877: checking size of uint8_t" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_uint8_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_sizeof_uint8_t=0 else cat > conftest.$ac_ext < -#if STDC_HEADERS +#ifdef STDC_HEADERS #include -#include #endif + +#include +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(uint8_t)); + exit(0); +} EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_type_size_t=yes +if { (eval echo configure:1901: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_uint8_t=`cat conftestval` else - rm -rf conftest* - ac_cv_type_size_t=no + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_uint8_t=0 +fi +rm -fr conftest* fi -rm -f conftest* fi -echo "$ac_t""$ac_cv_type_size_t" 1>&6 -if test $ac_cv_type_size_t = no; then - cat >> confdefs.h <<\EOF -#define size_t unsigned +echo "$ac_t""$ac_cv_sizeof_uint8_t" 1>&6 +cat >> confdefs.h <&6 -echo "configure:1102: checking for st_rdev in struct stat" >&5 -if eval "test \"`echo '$''{'ac_cv_struct_st_rdev'+set}'`\" = set"; then + +echo $ac_n "checking size of uint16_t""... $ac_c" 1>&6 +echo "configure:1922: checking size of uint16_t" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_uint16_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_sizeof_uint16_t=0 else cat > conftest.$ac_ext < -#include -int main() { -struct stat s; s.st_rdev; -; return 0; } +#ifdef STDC_HEADERS +#include +#endif + +#include +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(uint16_t)); + exit(0); +} EOF -if { (eval echo configure:1115: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_struct_st_rdev=yes +if { (eval echo configure:1946: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_uint16_t=`cat conftestval` else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_struct_st_rdev=no + rm -fr conftest* + ac_cv_sizeof_uint16_t=0 fi -rm -f conftest* +rm -fr conftest* fi -echo "$ac_t""$ac_cv_struct_st_rdev" 1>&6 -if test $ac_cv_struct_st_rdev = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_ST_RDEV 1 +fi +echo "$ac_t""$ac_cv_sizeof_uint16_t" 1>&6 +cat >> confdefs.h <&6 -echo "configure:1137: checking for sys/wait.h that is POSIX.1 compatible" >&5 -if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then +echo $ac_n "checking size of uint32_t""... $ac_c" 1>&6 +echo "configure:1967: checking size of uint32_t" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_uint32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_sizeof_uint32_t=0 else cat > conftest.$ac_ext < -#include -#ifndef WEXITSTATUS -#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) +#ifdef STDC_HEADERS +#include #endif -#ifndef WIFEXITED -#define WIFEXITED(stat_val) (((stat_val) & 255) == 0) + +#include +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(uint32_t)); + exit(0); +} +EOF +if { (eval echo configure:1991: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_uint32_t=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_uint32_t=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_uint32_t" 1>&6 +cat >> confdefs.h <&6 +echo "configure:2012: checking size of uint64_t" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_uint64_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_sizeof_uint64_t=0 +else + cat > conftest.$ac_ext < +#ifdef STDC_HEADERS +#include #endif + +#include +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(uint64_t)); + exit(0); +} +EOF +if { (eval echo configure:2036: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_uint64_t=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_uint64_t=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_uint64_t" 1>&6 +cat >> confdefs.h <&6 +echo "configure:2060: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); +char (*f)(); + int main() { -int s; -wait (&s); -s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif + ; return 0; } EOF -if { (eval echo configure:1158: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2089: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* - ac_cv_header_sys_wait_h=yes + eval "ac_cv_func_$ac_func=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - ac_cv_header_sys_wait_h=no + eval "ac_cv_func_$ac_func=no" fi rm -f conftest* fi -echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6 -if test $ac_cv_header_sys_wait_h = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_SYS_WAIT_H 1 +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 fi +done trap '' 1 2 15 @@ -1198,7 +2133,7 @@ EOF # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | - case `(ac_space=' '; set) 2>&1` in + case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote substitution # turns \\\\ into \\, and sed turns \\ into \). @@ -1265,7 +2200,7 @@ do echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.12" + echo "$CONFIG_STATUS generated by autoconf version 2.14.1" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; @@ -1285,9 +2220,11 @@ sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF $ac_vpsub $extrasub +s%@SHELL@%$SHELL%g s%@CFLAGS@%$CFLAGS%g s%@CPPFLAGS@%$CPPFLAGS%g s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g s%@DEFS@%$DEFS%g s%@LDFLAGS@%$LDFLAGS%g s%@LIBS@%$LIBS%g @@ -1306,9 +2243,18 @@ s%@includedir@%$includedir%g s%@oldincludedir@%$oldincludedir%g s%@infodir@%$infodir%g s%@mandir@%$mandir%g -s%@CC@%$CC%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@PACKAGE@%$PACKAGE%g +s%@VERSION@%$VERSION%g +s%@ACLOCAL@%$ACLOCAL%g +s%@AUTOCONF@%$AUTOCONF%g +s%@AUTOMAKE@%$AUTOMAKE%g +s%@AUTOHEADER@%$AUTOHEADER%g +s%@MAKEINFO@%$MAKEINFO%g +s%@SET_MAKE@%$SET_MAKE%g +s%@CC@%$CC%g s%@LN_S@%$LN_S%g s%@CPP@%$CPP%g @@ -1521,8 +2467,10 @@ fi; done EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h exit 0 EOF diff --git a/configure.in b/configure.in index 557404cf..3fe3aa48 100644 --- a/configure.in +++ b/configure.in @@ -1,19 +1,73 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(file.c) -AC_CONFIG_HEADER(config.h) +AM_INIT_AUTOMAKE(file, 3.26) +AM_CONFIG_HEADER(config.h) + +AC_MSG_CHECKING(for builtin ELF support) +AC_ARG_ENABLE(elf, +[ --disable-elf disable builtin ELF support], +[if test "${enableval}" = yes; then + AC_MSG_RESULT(yes) + AC_DEFINE(BUILTIN_ELF) +else + AC_MSG_RESULT(no) +fi], [ + # enable by default + AC_MSG_RESULT(yes) + AC_DEFINE(BUILTIN_ELF) +]) + +AC_MSG_CHECKING(for ELF core file support) +AC_ARG_ENABLE(elf-core, +[ --disable-elf-core disable ELF core file support], +[if test "${enableval}" = yes; then + AC_MSG_RESULT(yes) + AC_DEFINE(ELFCORE) +else + AC_MSG_RESULT(no) +fi], [ + # enable by default + AC_MSG_RESULT(yes) + AC_DEFINE(ELFCORE) +]) dnl Checks for programs. AC_PROG_CC AC_PROG_INSTALL AC_PROG_LN_S +dnl Checks for headers +AC_HEADER_STDC +AC_HEADER_MAJOR +AC_HEADER_SYS_WAIT +AC_CHECK_HEADERS(unistd.h) + dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_OFF_T AC_TYPE_SIZE_T AC_STRUCT_ST_RDEV -dnl Checks for headers -AC_HEADER_SYS_WAIT +dnl FIXME: only found in standard headers! +AC_CHECK_TYPE(uint8_t, unsigned char) +AC_CHECK_TYPE(uint16_t, unsigned short) +AC_CHECK_TYPE(uint32_t, unsigned int) + +AC_C_LONG_LONG +if test $ac_cv_c_long_long = yes; then + long64='unsigned long long'; +else + long64='unsigned long'; +fi +dnl This needs a patch to autoconf 2.13 acgeneral.m4 +AC_CHECK_TYPE2(uint64_t, $long64) + +AC_CHECK_SIZEOF_STDC_HEADERS(uint8_t, 0) +AC_CHECK_SIZEOF_STDC_HEADERS(uint16_t, 0) +AC_CHECK_SIZEOF_STDC_HEADERS(uint32_t, 0) +AC_CHECK_SIZEOF_STDC_HEADERS(uint64_t, 0) + +dnl Checks for functions +AC_CHECK_FUNCS(strerror strtoul) AC_OUTPUT(Makefile) diff --git a/doc/file.man b/doc/file.man index c7458e01..09ea664f 100644 --- a/doc/file.man +++ b/doc/file.man @@ -1,12 +1,12 @@ .TH FILE __CSECTION__ "Copyright but distributable" -.\" $Id: file.man,v 1.32 1999/01/14 15:54:00 christos Exp $ +.\" $Id: file.man,v 1.33 1999/02/14 17:16:07 christos Exp $ .SH NAME file \- determine file type .SH SYNOPSIS .B file [ -.B \-bcnvzL +.B \-bcnsvzL ] [ .B \-f @@ -143,6 +143,27 @@ Try to look inside compressed files. option causes symlinks to be followed, as the like-named option in .BR ls (1). (on systems that support symbolic links). +.TP 8 +.B \-s +Normally, +.B file +only attempts to read and determine the type of argument files which +.BR stat (2) +reports are ordinary files. +This prevents problems, because reading special files may have peculiar +consequences. +Specifying the +.BR \-s +option causes +.B file +to also read argument files which are block or character special files. +This is useful for determining the filesystem types of the data in raw +disk partitions, which are block special files. +This option also causes +.B file +to disregard the file size as reported by +.BR stat (2) +since on some systems it reports a zero size for raw disk partitions. .SH FILES .I __MAGIC__ \- default list of magic numbers @@ -211,6 +232,27 @@ command uses a magic file, keep the old magic file around for comparison purposes (rename it to .IR __MAGIC__.orig ). +.SH EXAMPLES +.nf +$ file file.c file /dev/hda +file.c: C program text +file: ELF 32-bit LSB executable, Intel 80386, version 1, + dynamically linked, not stripped +/dev/hda: block special + +$ file -s /dev/hda{,1,2,3,4,5,6,7,8,9,10} +/dev/hda: x86 boot sector +/dev/hda1: Linux/i386 ext2 filesystem +/dev/hda2: x86 boot sector +/dev/hda3: x86 boot sector, extended partition table +/dev/hda4: Linux/i386 ext2 filesystem +/dev/hda5: Linux/i386 swap file +/dev/hda6: Linux/i386 swap file +/dev/hda7: Linux/i386 swap file +/dev/hda8: Linux/i386 swap file +/dev/hda9: empty +/dev/hda10: empty +.fi .SH HISTORY There has been a .B file @@ -256,7 +298,7 @@ the process running .RE .PP Changes by Ian Darwin and various authors including -Christos Zoulas (christos@astron.com), 1990-1997. +Christos Zoulas (christos@astron.com), 1990-1999. .SH LEGAL NOTICE Copyright (c) Ian F. Darwin, Toronto, Canada, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993. diff --git a/magic/Magdir/elf b/magic/Magdir/elf index 411a9ba3..92adae62 100644 --- a/magic/Magdir/elf +++ b/magic/Magdir/elf @@ -12,6 +12,9 @@ 0 string \177ELF ELF >4 byte 0 invalid class >4 byte 1 32-bit +# only for MIPS R3000_BE +>>18 beshort 8 +>>>36 belong &0x20 N32 >4 byte 2 64-bit >5 byte 0 invalid byte order >5 byte 1 LSB @@ -66,6 +69,24 @@ >>36 lelong 1 MathCoPro/FPU/MAU Required >8 string >\0 (%s) >5 byte 2 MSB +# only for MIPS R3000_BE +>>18 beshort 8 +# only for 32-bit +>>>4 byte 1 +>>>>36 belong&0xf0000000 0x00000000 mips-1 +>>>>36 belong&0xf0000000 0x10000000 mips-2 +>>>>36 belong&0xf0000000 0x20000000 mips-3 +>>>>36 belong&0xf0000000 0x30000000 mips-4 +>>>>36 belong&0xf0000000 0x40000000 mips-5 +>>>>36 belong&0xf0000000 0x50000000 mips-6 +# only for 64-bit +>>>4 byte 2 +>>>>48 belong&0xf0000000 0x00000000 mips-1 +>>>>48 belong&0xf0000000 0x10000000 mips-2 +>>>>48 belong&0xf0000000 0x20000000 mips-3 +>>>>48 belong&0xf0000000 0x30000000 mips-4 +>>>>48 belong&0xf0000000 0x40000000 mips-5 +>>>>48 belong&0xf0000000 0x50000000 mips-6 >>16 beshort 0 no file type, >>16 beshort 1 relocatable, >>16 beshort 2 executable, @@ -90,6 +111,10 @@ >>18 beshort 16 nCUBE, >>18 beshort 17 Fujitsu VPP500, >>18 beshort 18 SPARC32PLUS, +>>>36 belong&0xffff00 &0x000100 V8+ Required, +>>>36 belong&0xffff00 &0x000200 Sun UltraSPARC1 Extensions Required, +>>>36 belong&0xffff00 &0x000400 HaL R1 Extensions Required, +>>>36 belong&0xffff00 &0x000800 Sun UltraSPARC3 Extensions Required, >>18 beshort 20 PowerPC or cisco 4500, >>18 beshort 21 cisco 7500, >>18 beshort 24 cisco SVIP, diff --git a/magic/Magdir/filesystems b/magic/Magdir/filesystems index f3ae3a69..c6f6b40b 100644 --- a/magic/Magdir/filesystems +++ b/magic/Magdir/filesystems @@ -33,6 +33,7 @@ >>0x36 string FAT \b, %s >>>0x39 string 12 (%s bit) >>>0x39 string 16 (%s bit) +>0x52 string FAT32 \b, FAT (32 bit) >>>43 string >NO\ NAME label: %.11s, >>>43 string >>43 string NO\ NAME unlabeled, @@ -60,3 +61,18 @@ >4 lelong&0xFFFFFF00 !0 unknown mode 0x18b string OS/2 OS/2 Boot Manager + +9564 lelong 0x00011954 Unix Fast File system, +>8404 string x last mounted on %s, +>9504 ledate x last checkd at %s, +>8224 ledate x last writen at %s, +>8228 lelong x number of blocks %d, +>8232 lelong x number of data blocks %d, +>8236 lelong x number of cylinder groups %d, +>8240 lelong x number of basic blocks %d, +>8244 lelong x number of fragment blocks %d, +>8248 lelong x minimum percentage of free blocks %d, +>8252 lelong x rotational delay %dms, +>8256 lelong x disk rotational speed %drps, +>8320 lelong 0 TIME optimization +>8320 lelong 1 SPACE optimization diff --git a/magic/Magdir/mach b/magic/Magdir/mach index 308325ee..e0f4808e 100644 --- a/magic/Magdir/mach +++ b/magic/Magdir/mach @@ -1,12 +1,12 @@ #------------------------------------------------------------------------------ # mach file description # -0 belong 0xcafebabe mach-o fat file +0 belong 0xcafebabe Mach-O fat file >4 belong 1 with 1 architecture >4 belong >1 >>4 belong x with %ld architectures # -0 belong 0xfeedface mach-o +0 belong 0xfeedface Mach-O >12 belong 1 object >12 belong 2 executable >12 belong 3 shared library @@ -22,6 +22,11 @@ >4 belong 4 ns32032 >4 belong 5 ns32332 >4 belong 6 for m68k architecture +# from NeXTstep 3.0 +# i.e. mc680x0_all, ignore +# >>8 belong 1 (mc68030) +>>8 belong 2 (mc68040) +>>8 belong 3 (mc68030 only) >4 belong 7 i386 >4 belong 8 mips >4 belong 9 ns32532 diff --git a/magic/Magdir/varied.out b/magic/Magdir/varied.out index f1a3edf1..a3ef6e42 100644 --- a/magic/Magdir/varied.out +++ b/magic/Magdir/varied.out @@ -15,7 +15,7 @@ 6 beshort 0407 unicos (cray) executable # Ultrix 4.3 596 string \130\337\377\377 Ultrix core file ->600 string >\0 '%s' +>600 string >\0 from '%s' # BeOS and MAcOS PEF executables # From: hplus@zilker.net (Jon Watte) 0 string Joy!peffpwpc header for PowerPC PEF executable diff --git a/mkinstalldirs b/mkinstalldirs new file mode 100644 index 00000000..e69de29b diff --git a/src/acconfig.h b/src/acconfig.h new file mode 100644 index 00000000..947f8c8d --- /dev/null +++ b/src/acconfig.h @@ -0,0 +1,36 @@ +/* Define if builtin ELF support is enabled. */ +#undef BUILTIN_ELF + +/* Define if ELF core file support is enabled. */ +#undef ELFCORE + +/* Define if the `long long' type works. */ +#undef HAVE_LONG_LONG + +/* Define to `unsigned char' if standard headers don't define. */ +#undef uint8_t + +/* Define to `unsigned short' if standard headers don't define. */ +#undef uint16_t + +/* Define to `unsigned int' if standard headers don't define. */ +#undef uint32_t + +/* Define to `unsigned long long', if available, or `unsigned long', if + standard headers don't define. */ +#undef uint64_t + +/* FIXME: These have to be added manually because autoheader doesn't know + about AC_CHECK_SIZEOF_INCLUDES. */ + +/* The number of bytes in a uint8_t. */ +#define SIZEOF_UINT8_T 0 + +/* The number of bytes in a uint16_t. */ +#define SIZEOF_UINT16_T 0 + +/* The number of bytes in a uint32_t. */ +#define SIZEOF_UINT32_T 0 + +/* The number of bytes in a uint64_t. */ +#define SIZEOF_UINT64_T 0 diff --git a/src/ascmagic.c b/src/ascmagic.c index 7a3f1ae8..355881f6 100644 --- a/src/ascmagic.c +++ b/src/ascmagic.c @@ -26,17 +26,19 @@ * 4. This notice may not be removed or altered. */ +#include "file.h" #include #include #include #include #include +#ifdef HAVE_UNISTD_H #include -#include "file.h" +#endif #include "names.h" #ifndef lint -FILE_RCSID("@(#)$Id: ascmagic.c,v 1.23 1998/06/27 13:23:39 christos Exp $"); +FILE_RCSID("@(#)$Id: ascmagic.c,v 1.24 1999/02/14 17:16:00 christos Exp $") #endif /* lint */ /* an optimisation over plain strcmp() */ diff --git a/src/compress.c b/src/compress.c index 50647bf0..6020cedc 100644 --- a/src/compress.c +++ b/src/compress.c @@ -5,19 +5,18 @@ * uncompress(method, old, n, newch) - uncompress old into new, * using method, return sizeof new */ +#include "file.h" #include #include +#ifdef HAVE_UNISTD_H #include -#include -#ifdef HAVE_CONFIG_H -#include "config.h" #endif +#include #ifdef HAVE_SYS_WAIT_H #include #endif -#include "file.h" #ifndef lint -FILE_RCSID("@(#)$Id: compress.c,v 1.12 1998/06/27 13:57:23 christos Exp $") +FILE_RCSID("@(#)$Id: compress.c,v 1.13 1999/02/14 17:16:01 christos Exp $") #endif diff --git a/src/file.c b/src/file.c index e54fc257..9000f745 100644 --- a/src/file.c +++ b/src/file.c @@ -24,6 +24,7 @@ * * 4. This notice may not be removed or altered. */ +#include "file.h" #include #include #include @@ -42,15 +43,16 @@ # endif # endif #endif +#ifdef HAVE_UNISTD_H #include /* for read() */ +#endif #include /* for byte swapping */ #include "patchlevel.h" -#include "file.h" #ifndef lint -FILE_RCSID("@(#)$Id: file.c,v 1.45 1999/01/14 16:21:21 christos Exp $") +FILE_RCSID("@(#)$Id: file.c,v 1.46 1999/02/14 17:16:05 christos Exp $") #endif /* lint */ @@ -64,11 +66,16 @@ FILE_RCSID("@(#)$Id: file.c,v 1.45 1999/01/14 16:21:21 christos Exp $") # define MAGIC "/etc/magic" #endif +#ifndef MAXPATHLEN +#define MAXPATHLEN 512 +#endif + int /* Global command-line options */ debug = 0, /* debugging */ lflag = 0, /* follow Symlinks (BSD only) */ bflag = 0, /* brief output format */ zflag = 0, /* follow (uncompress) compressed files */ + sflag = 0, /* read block special files */ nobuffer = 0; /* Do not buffer stdout */ int /* Misc globals */ nmagic = 0; /* number of valid magic[]s */ @@ -108,7 +115,7 @@ main(argc, argv) if (!(magicfile = getenv("MAGIC"))) magicfile = MAGIC; - while ((c = getopt(argc, argv, "bcdnf:m:vzL")) != EOF) + while ((c = getopt(argc, argv, "bcdnf:m:svzL")) != EOF) switch (c) { case 'v': (void) fprintf(stdout, "%s-%d.%d\n", progname, @@ -147,6 +154,9 @@ main(argc, argv) case 'z': zflag++; break; + case 's': + sflag++; + break; case '?': default: errflg++; diff --git a/src/file.h b/src/file.h index 0adceea9..a481ef0d 100644 --- a/src/file.h +++ b/src/file.h @@ -1,6 +1,6 @@ /* * file.h - definitions for file(1) program - * @(#)$Id: file.h,v 1.28 1999/01/13 15:44:05 christos Exp $ + * @(#)$Id: file.h,v 1.29 1999/02/14 17:16:06 christos Exp $ * * Copyright (c) Ian F. Darwin, 1987. * Written by Ian F. Darwin. @@ -29,11 +29,15 @@ #ifndef __file_h__ #define __file_h__ +#ifdef HAVE_CONFIG_H +#include +#endif + typedef int int32; typedef unsigned int uint32; #ifndef HOWMANY -# define HOWMANY 8192 /* how much of the file to look at */ +# define HOWMANY 16384 /* how much of the file to look at */ #endif #define MAXMAGIS 1000 /* max entries in /etc/magic */ #define MAXDESC 50 /* max leng of text description */ @@ -80,7 +84,7 @@ struct magic { #include /* Include that here, to make sure __P gets defined */ #ifndef __P -# if __STDC__ || __cplusplus +# if defined(__STDC__) || defined(__cplusplus) # define __P(a) a # else # define __P(a) () @@ -106,7 +110,7 @@ extern int zmagic __P((unsigned char *, int)); extern void ckfprintf __P((FILE *, const char *, ...)); extern uint32 signextend __P((struct magic *, unsigned int32)); extern int internatmagic __P((unsigned char *, int)); -extern void tryelf __P((int, char *, int)); +extern void tryelf __P((int, unsigned char *, int)); extern int errno; /* Some unixes don't define this.. */ @@ -122,29 +126,20 @@ extern int nmagic; /* number of valid magic[]s */ extern int debug; /* enable debugging? */ extern int zflag; /* process compressed files? */ extern int lflag; /* follow symbolic links? */ +extern int sflag; /* read/analyze block special files? */ extern int optind; /* From getopt(3) */ extern char *optarg; -#if defined(sun) || defined(__sun__) || defined (__sun) -# if defined(__svr4) || defined (__SVR4) || defined(__svr4__) -# define SOLARIS -# else -# define SUNOS -# endif -#endif - - -#if !defined(__STDC__) || defined(SUNOS) || defined(__convex__) +#ifndef HAVE_STRERROR extern int sys_nerr; extern char *sys_errlist[]; #define strerror(e) \ (((e) >= 0 && (e) < sys_nerr) ? sys_errlist[(e)] : "Unknown error") -#define strtoul(a, b, c) strtol(a, b, c) #endif -#ifndef MAXPATHLEN -#define MAXPATHLEN 512 +#ifndef HAVE_STRTOUL +#define strtoul(a, b, c) strtol(a, b, c) #endif #ifdef __STDC__ diff --git a/src/fsmagic.c b/src/fsmagic.c index 00af8e3c..9fd74f8c 100644 --- a/src/fsmagic.c +++ b/src/fsmagic.c @@ -25,35 +25,36 @@ * 4. This notice may not be removed or altered. */ +#include "file.h" #include #include #include #include +#ifdef HAVE_UNISTD_H #include +#endif #include -#ifdef HAVE_CONFIG_H -#include "config.h" +/* Since major is a function on SVR4, we can't use `ifndef major'. */ +#ifdef MAJOR_IN_MKDEV +# include +# define HAVE_MAJOR #endif -#ifndef major -# if defined(__SVR4) || defined(_SVR4_SOURCE) -# include -# endif +#ifdef MAJOR_IN_SYSMACROS +# include +# define HAVE_MAJOR #endif -#ifndef major /* if `major' not defined in types.h, */ -#include /* try this one. */ +#ifdef major /* Might be defined in sys/types.h. */ +# define HAVE_MAJOR #endif -#ifndef major /* still not defined? give up, manual intervention needed */ - /* If cc tries to compile this, read and act on it. */ - /* On most systems cpp will discard it automatically */ - Congratulations, you have found a portability bug. - Please grep /usr/include/sys and edit the above #include - to point at the file that defines the "major" macro. -#endif /*major*/ - -#include "file.h" + +#ifndef HAVE_MAJOR +# define major(dev) (((dev) >> 8) & 0xff) +# define minor(dev) ((dev) & 0xff) +#endif +#undef HAVE_MAJOR #ifndef lint -FILE_RCSID("@(#)$Id: fsmagic.c,v 1.28 1999/01/13 15:44:06 christos Exp $") +FILE_RCSID("@(#)$Id: fsmagic.c,v 1.29 1999/02/14 17:16:08 christos Exp $") #endif /* lint */ int @@ -91,6 +92,13 @@ struct stat *sb; ckfputs("directory", stdout); return 1; case S_IFCHR: + /* + * If -s has been specified, treat character special files + * like ordinary files. Otherwise, just report that they + * are block special files and go on to the next file. + */ + if (sflag) + break; #ifdef HAVE_ST_RDEV # ifdef dv_unit (void) printf("character special (%d/%d/%d)", @@ -106,6 +114,13 @@ struct stat *sb; #endif return 1; case S_IFBLK: + /* + * If -s has been specified, treat block special files + * like ordinary files. Otherwise, just report that they + * are block special files and go on to the next file. + */ + if (sflag) + break; #ifdef HAVE_ST_RDEV # ifdef dv_unit (void) printf("block special (%d/%d/%d)", @@ -126,6 +141,11 @@ struct stat *sb; ckfputs("fifo (named pipe)", stdout); return 1; #endif +#ifdef S_IFDOOR + case S_IFDOOR: + ckfputs("door", stdout); + return 1; +#endif #ifdef S_IFLNK case S_IFLNK: { @@ -195,8 +215,17 @@ struct stat *sb; /* * regular file, check next possibility + * + * If stat() tells us the file has zero length, report here that + * the file is empty, so we can skip all the work of opening and + * reading the file. + * But if the -s option has been given, we skip this optimization, + * since on some systems, stat() reports zero size for raw disk + * partitions. (If the block special device really has zero length, + * the fact that it is empty will be detected and reported correctly + * when we read the file.) */ - if (sb->st_size == 0) { + if (!sflag && sb->st_size == 0) { ckfputs("empty", stdout); return 1; } diff --git a/src/is_tar.c b/src/is_tar.c index de93e9e0..f24212e7 100644 --- a/src/is_tar.c +++ b/src/is_tar.c @@ -2,10 +2,10 @@ * is_tar() -- figure out whether file is a tar archive. * * Stolen (by the author!) from the public domain tar program: - * Pubic Domain version written 26 Aug 1985 John Gilmore (ihnp4!hoptoad!gnu). + * Public Domain version written 26 Aug 1985 John Gilmore (ihnp4!hoptoad!gnu). * * @(#)list.c 1.18 9/23/86 Public Domain - gnu - * $Id: is_tar.c,v 1.11 1999/01/13 15:44:07 christos Exp $ + * $Id: is_tar.c,v 1.12 1999/02/14 17:16:08 christos Exp $ * * Comments changed and some code/comments reformatted * for file command by Ian Darwin. @@ -18,16 +18,12 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$Id: is_tar.c,v 1.11 1999/01/13 15:44:07 christos Exp $") +FILE_RCSID("@(#)$Id: is_tar.c,v 1.12 1999/02/14 17:16:08 christos Exp $") #endif #define isodigit(c) ( ((c) >= '0') && ((c) <= '7') ) -#if defined(__STDC__) || defined(__cplusplus) -static int from_oct(int, char*); /* Decode octal number */ -#else -static int from_oct(); -#endif +static int from_oct __P((int, char *)); /* Decode octal number */ /* * Return diff --git a/src/print.c b/src/print.c index 5814de52..146e8bb3 100644 --- a/src/print.c +++ b/src/print.c @@ -25,6 +25,7 @@ * 4. This notice may not be removed or altered. */ +#include "file.h" #include #include #include @@ -34,12 +35,13 @@ # include #endif #include +#ifdef HAVE_UNISTD_H #include +#endif #include -#include "file.h" #ifndef lint -FILE_RCSID("@(#)$Id: print.c,v 1.27 1999/01/13 15:44:09 christos Exp $") +FILE_RCSID("@(#)$Id: print.c,v 1.28 1999/02/14 17:16:10 christos Exp $") #endif /* lint */ #define SZOF(a) (sizeof(a) / sizeof(a[0])) @@ -122,7 +124,7 @@ ckfputs(str, fil) /*VARARGS*/ void -#if __STDC__ +#ifdef __STDC__ ckfprintf(FILE *f, const char *fmt, ...) #else ckfprintf(va_alist) @@ -130,7 +132,7 @@ ckfprintf(va_alist) #endif { va_list va; -#if __STDC__ +#ifdef __STDC__ va_start(va, fmt); #else FILE *f; @@ -150,7 +152,7 @@ ckfprintf(va_alist) */ /*VARARGS*/ void -#if __STDC__ +#ifdef __STDC__ error(const char *f, ...) #else error(va_alist) @@ -158,7 +160,7 @@ error(va_alist) #endif { va_list va; -#if __STDC__ +#ifdef __STDC__ va_start(va, f); #else const char *f; @@ -177,7 +179,7 @@ error(va_alist) /*VARARGS*/ void -#if __STDC__ +#ifdef __STDC__ magwarn(const char *f, ...) #else magwarn(va_alist) @@ -185,7 +187,7 @@ magwarn(va_alist) #endif { va_list va; -#if __STDC__ +#ifdef __STDC__ va_start(va, f); #else const char *f; diff --git a/src/readelf.c b/src/readelf.c index bc0fef96..daaf431e 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -1,3 +1,4 @@ +#include "file.h" #ifdef BUILTIN_ELF #include @@ -5,50 +6,148 @@ #include #include #include +#ifdef HAVE_UNISTD_H #include +#endif #include -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif #include "readelf.h" -#include "file.h" #ifndef lint -FILE_RCSID("@(#)$Id: readelf.c,v 1.9 1998/09/12 13:21:01 christos Exp $") +FILE_RCSID("@(#)$Id: readelf.c,v 1.10 1999/02/14 17:16:10 christos Exp $") #endif #ifdef ELFCORE -static void dophn_core __P((int, off_t, int, size_t, char *)); +static void dophn_core __P((int, int, int, off_t, int, size_t)); #endif -static void dophn_exec __P((int, off_t, int, size_t, char *)); -static void doshn __P((int, off_t, int, size_t, char *)); +static void dophn_exec __P((int, int, int, off_t, int, size_t)); +static void doshn __P((int, int, int, off_t, int, size_t)); + +static uint16_t getu16 __P((int, int)); +static uint32_t getu32 __P((int, uint32_t)); +static uint64_t getu64 __P((int, uint64_t)); + +static uint16_t +getu16(swap, value) + int swap; + uint16_t value; +{ + union { + uint16_t ui; + char c[2]; + } retval, tmpval; + + if (swap) { + tmpval.ui = value; + + retval.c[0] = tmpval.c[1]; + retval.c[1] = tmpval.c[0]; + + return retval.ui; + } else + return value; +} + +static uint32_t +getu32(swap, value) + int swap; + uint32_t value; +{ + union { + uint32_t ui; + char c[4]; + } retval, tmpval; + + if (swap) { + tmpval.ui = value; + + retval.c[0] = tmpval.c[3]; + retval.c[1] = tmpval.c[2]; + retval.c[2] = tmpval.c[1]; + retval.c[3] = tmpval.c[0]; + + return retval.ui; + } else + return value; +} + +static uint64_t +getu64(swap, value) + int swap; + uint64_t value; +{ + union { + uint64_t ui; + char c[8]; + } retval, tmpval; + + if (swap) { + tmpval.ui = value; + + retval.c[0] = tmpval.c[7]; + retval.c[1] = tmpval.c[6]; + retval.c[2] = tmpval.c[5]; + retval.c[3] = tmpval.c[4]; + retval.c[4] = tmpval.c[3]; + retval.c[5] = tmpval.c[2]; + retval.c[6] = tmpval.c[1]; + retval.c[7] = tmpval.c[0]; + + return retval.ui; + } else + return value; +} + +#define sh_addr (class == ELFCLASS32 \ + ? (void *) &sh32 \ + : (void *) &sh64) +#define shs_type (class == ELFCLASS32 \ + ? getu32(swap, sh32.sh_type) \ + : getu32(swap, sh64.sh_type)) +#define ph_addr (class == ELFCLASS32 \ + ? (void *) &ph32 \ + : (void *) &ph64) +#define ph_type (class == ELFCLASS32 \ + ? getu32(swap, ph32.p_type) \ + : getu32(swap, ph64.p_type)) +#define ph_offset (class == ELFCLASS32 \ + ? getu32(swap, ph32.p_offset) \ + : getu64(swap, ph64.p_offset)) +#define nh_size (class == ELFCLASS32 \ + ? sizeof *nh32 \ + : sizeof *nh64) +#define nh_type (class == ELFCLASS32 \ + ? getu32(swap, nh32->n_type) \ + : getu32(swap, nh64->n_type)) +#define nh_namesz (class == ELFCLASS32 \ + ? getu32(swap, nh32->n_namesz) \ + : getu32(swap, nh64->n_namesz)) +#define nh_descsz (class == ELFCLASS32 \ + ? getu32(swap, nh32->n_descsz) \ + : getu32(swap, nh64->n_descsz)) +#define prpsoffsets(i) (class == ELFCLASS32 \ + ? prpsoffsets32[i] \ + : prpsoffsets64[i]) static void -doshn(fd, off, num, size, buf) +doshn(class, swap, fd, off, num, size) + int class; + int swap; int fd; off_t off; int num; size_t size; - char *buf; { - /* - * This works for both 32-bit and 64-bit ELF formats, - * because it looks only at the "sh_type" field, which is - * always 32 bits, and is preceded only by the "sh_name" - * field which is also always 32 bits, and because it uses - * the shdr size from the ELF header rather than using - * the size of an "Elf32_Shdr". - */ - Elf32_Shdr *sh = (Elf32_Shdr *) buf; + Elf32_Shdr sh32; + Elf64_Shdr sh64; if (lseek(fd, off, SEEK_SET) == -1) error("lseek failed (%s).\n", strerror(errno)); for ( ; num; num--) { - if (read(fd, buf, size) == -1) + if (read(fd, sh_addr, size) == -1) error("read failed (%s).\n", strerror(errno)); - if (sh->sh_type == SHT_SYMTAB) { + if (shs_type == SHT_SYMTAB || shs_type == SHT_DYNSYM) { (void) printf (", not stripped"); return; } @@ -62,15 +161,16 @@ doshn(fd, off, num, size, buf) * otherwise it's statically linked. */ static void -dophn_exec(fd, off, num, size, buf) +dophn_exec(class, swap, fd, off, num, size) + int class; + int swap; int fd; off_t off; int num; size_t size; - char *buf; { - /* I am not sure if this works for 64 bit elf formats */ - Elf32_Phdr *ph = (Elf32_Phdr *) buf; + Elf32_Phdr ph32; + Elf64_Phdr ph64; char *linking_style = "statically"; char *shared_libraries = ""; @@ -78,10 +178,10 @@ dophn_exec(fd, off, num, size, buf) error("lseek failed (%s).\n", strerror(errno)); for ( ; num; num--) { - if (read(fd, buf, size) == -1) + if (read(fd, ph_addr, size) == -1) error("read failed (%s).\n", strerror(errno)); - switch (ph->p_type) { + switch (ph_type) { case PT_DYNAMIC: linking_style = "dynamically"; break; @@ -94,12 +194,19 @@ dophn_exec(fd, off, num, size, buf) } #ifdef ELFCORE -size_t prpsoffsets[] = { +size_t prpsoffsets32[] = { 84, /* SunOS 5.x */ 32, /* Linux */ }; -#define NOFFSETS (sizeof prpsoffsets / sizeof prpsoffsets[0]) +size_t prpsoffsets64[] = { + 120, /* SunOS 5.x, 64-bit */ +}; + +#define NOFFSETS32 (sizeof prpsoffsets32 / sizeof prpsoffsets32[0]) +#define NOFFSETS64 (sizeof prpsoffsets64 / sizeof prpsoffsets64[0]) + +#define NOFFSETS (class == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64) /* * Look through the program headers of an executable image, searching @@ -113,19 +220,18 @@ size_t prpsoffsets[] = { * containing the start of the command line for that program. */ static void -dophn_core(fd, off, num, size, buf) +dophn_core(class, swap, fd, off, num, size) + int class; + int swap; int fd; off_t off; int num; size_t size; - char *buf; { - /* - * This doesn't work for 64-bit ELF, as the "p_offset" field is - * 64 bits in 64-bit ELF. - */ - Elf32_Phdr *ph = (Elf32_Phdr *) buf; - Elf32_Nhdr *nh; + Elf32_Phdr ph32; + Elf32_Nhdr *nh32; + Elf64_Phdr ph64; + Elf64_Nhdr *nh64; size_t offset, noffset, reloffset; unsigned char c; int i, j; @@ -135,12 +241,12 @@ dophn_core(fd, off, num, size, buf) for ( ; num; num--) { if (lseek(fd, off, SEEK_SET) == -1) error("lseek failed (%s).\n", strerror(errno)); - if (read(fd, buf, size) == -1) + if (read(fd, ph_addr, size) == -1) error("read failed (%s).\n", strerror(errno)); off += size; - if (ph->p_type != PT_NOTE) + if (ph_type != PT_NOTE) continue; - if (lseek(fd, ph->p_offset, SEEK_SET) == -1) + if (lseek(fd, (off_t) ph_offset, SEEK_SET) == -1) error("lseek failed (%s).\n", strerror(errno)); bufsize = read(fd, nbuf, BUFSIZ); if (bufsize == -1) @@ -149,17 +255,20 @@ dophn_core(fd, off, num, size, buf) for (;;) { if (offset >= bufsize) break; - nh = (Elf32_Nhdr *)&nbuf[offset]; - offset += sizeof *nh; + if (class == ELFCLASS32) + nh32 = (Elf32_Nhdr *)&nbuf[offset]; + else + nh64 = (Elf64_Nhdr *)&nbuf[offset]; + offset += nh_size; /* * If this note isn't an NT_PRPSINFO note, it's * not what we're looking for. */ - if (nh->n_type != NT_PRPSINFO) { - offset += nh->n_namesz; + if (nh_type != NT_PRPSINFO) { + offset += nh_namesz; offset = ((offset + 3)/4)*4; - offset += nh->n_descsz; + offset += nh_descsz; offset = ((offset + 3)/4)*4; continue; } @@ -167,16 +276,16 @@ dophn_core(fd, off, num, size, buf) /* * Make sure this note has the name "CORE". */ - if (offset + nh->n_namesz >= bufsize) { + if (offset + nh_namesz >= bufsize) { /* * We're past the end of the buffer. */ break; } - if (nh->n_namesz != 5 + if (nh_namesz != 5 || strcmp(&nbuf[offset], "CORE") != 0) continue; - offset += nh->n_namesz; + offset += nh_namesz; offset = ((offset + 3)/4)*4; /* @@ -190,7 +299,7 @@ dophn_core(fd, off, num, size, buf) * it. */ for (i = 0; i < NOFFSETS; i++) { - reloffset = prpsoffsets[i]; + reloffset = prpsoffsets(i); noffset = offset + reloffset; for (j = 0; j < 16; j++, noffset++, reloffset++) { @@ -208,7 +317,7 @@ dophn_core(fd, off, num, size, buf) * are, this obviously isn't * the right offset. */ - if (reloffset >= nh->n_descsz) + if (reloffset >= nh_descsz) goto tryanother; c = nbuf[noffset]; @@ -220,13 +329,13 @@ dophn_core(fd, off, num, size, buf) * Well, that worked. */ printf(", from '%.16s'", - &nbuf[offset + prpsoffsets[i]]); + &nbuf[offset + prpsoffsets(i)]); return; tryanother: ; } - offset += nh->n_descsz; + offset += nh_descsz; offset = ((offset + 3)/4)*4; } } @@ -236,13 +345,15 @@ dophn_core(fd, off, num, size, buf) void tryelf(fd, buf, nbytes) int fd; - char *buf; + unsigned char *buf; int nbytes; { union { int32 l; char c[sizeof (int32)]; } u; + int class; + int swap; /* * ELF executables have multiple section headers in arbitrary @@ -256,7 +367,9 @@ tryelf(fd, buf, nbytes) return; - if (buf[4] == ELFCLASS32) { + class = buf[4]; + + if (class == ELFCLASS32) { Elf32_Ehdr elfhdr; if (nbytes <= sizeof (Elf32_Ehdr)) return; @@ -264,36 +377,36 @@ tryelf(fd, buf, nbytes) u.l = 1; (void) memcpy(&elfhdr, buf, sizeof elfhdr); - /* - * If the system byteorder does not equal the - * object byteorder then don't test. - * XXX - we could conceivably fix up the "dophn_XXX()" and - * "doshn()" routines to extract stuff in the right - * byte order.... - */ - if ((u.c[sizeof(long) - 1] + 1) == elfhdr.e_ident[5]) { - if (elfhdr.e_type == ET_CORE) + swap = (u.c[sizeof(long) - 1] + 1) != elfhdr.e_ident[5]; + + if (getu16(swap, elfhdr.e_type) == ET_CORE) #ifdef ELFCORE - dophn_core(fd, elfhdr.e_phoff, elfhdr.e_phnum, - elfhdr.e_phentsize, buf); + dophn_core(class, swap, + fd, + getu32(swap, elfhdr.e_phoff), + getu16(swap, elfhdr.e_phnum), + getu16(swap, elfhdr.e_phentsize)); #else - ; + ; #endif - else { - if (elfhdr.e_type == ET_EXEC) { - dophn_exec(fd, - elfhdr.e_phoff, - elfhdr.e_phnum, - elfhdr.e_phentsize, buf); - } - doshn(fd, elfhdr.e_shoff, elfhdr.e_shnum, - elfhdr.e_shentsize, buf); + else { + if (getu16(swap, elfhdr.e_type) == ET_EXEC) { + dophn_exec(class, swap, + fd, + getu32(swap, elfhdr.e_phoff), + getu16(swap, elfhdr.e_phnum), + getu16(swap, elfhdr.e_phentsize)); } + doshn(class, swap, + fd, + getu32(swap, elfhdr.e_shoff), + getu16(swap, elfhdr.e_shnum), + getu16(swap, elfhdr.e_shentsize)); } return; } - if (buf[4] == ELFCLASS64) { + if (class == ELFCLASS64) { Elf64_Ehdr elfhdr; if (nbytes <= sizeof (Elf64_Ehdr)) return; @@ -301,49 +414,44 @@ tryelf(fd, buf, nbytes) u.l = 1; (void) memcpy(&elfhdr, buf, sizeof elfhdr); + swap = (u.c[sizeof(long) - 1] + 1) != elfhdr.e_ident[5]; - /* - * If the system byteorder does not equal the - * object byteorder then don't test. - * XXX - we could conceivably fix up the "dophn_XXX()" and - * "doshn()" routines to extract stuff in the right - * byte order.... - */ - if ((u.c[sizeof(long) - 1] + 1) == elfhdr.e_ident[5]) { - if (elfhdr.e_type == ET_CORE) + if (getu16(swap, elfhdr.e_type) == ET_CORE) #ifdef ELFCORE - dophn_core(fd, -#ifndef __GNUC__ - elfhdr.e_phoff[1], + dophn_core(class, swap, + fd, +#ifdef USE_ARRAY_FOR_64BIT_TYPES + getu32(swap, elfhdr.e_phoff[1]), #else - elfhdr.e_phoff, + getu64(swap, elfhdr.e_phoff), #endif - elfhdr.e_phnum, - elfhdr.e_phentsize, buf); + getu16(swap, elfhdr.e_phnum), + getu16(swap, elfhdr.e_phentsize)); #else - ; + ; #endif - else - { - if (elfhdr.e_type == ET_EXEC) { - dophn_exec(fd, -#ifndef __GNUC__ - elfhdr.e_phoff[1], + else + { + if (getu16(swap, elfhdr.e_type) == ET_EXEC) { + dophn_exec(class, swap, + fd, +#ifdef USE_ARRAY_FOR_64BIT_TYPES + getu32(swap, elfhdr.e_phoff[1]), #else - elfhdr.e_phoff, + getu64(swap, elfhdr.e_phoff), #endif - elfhdr.e_phnum, - elfhdr.e_phentsize, buf); - } - doshn(fd, -#ifndef __GNUC__ - elfhdr.e_shoff[1], + getu16(swap, elfhdr.e_phnum), + getu16(swap, elfhdr.e_phentsize)); + } + doshn(class, swap, + fd, +#ifdef USE_ARRAY_FOR_64BIT_TYPES + getu32(swap, elfhdr.e_shoff[1]), #else - elfhdr.e_shoff, + getu64(swap, elfhdr.e_shoff), #endif - elfhdr.e_shnum, - elfhdr.e_shentsize, buf); - } + getu16(swap, elfhdr.e_shnum), + getu16(swap, elfhdr.e_shentsize)); } return; } diff --git a/src/readelf.h b/src/readelf.h index 511f5f85..d0ae3337 100644 --- a/src/readelf.h +++ b/src/readelf.h @@ -1,6 +1,6 @@ /* * readelf.h - * @(#)$Id: readelf.h,v 1.6 1998/09/12 13:21:01 christos Exp $ + * @(#)$Id: readelf.h,v 1.7 1999/02/14 17:16:11 christos Exp $ * * Provide elf data structures for non-elf machines, allowing file * non-elf hosts to determine if an elf binary is stripped. @@ -9,23 +9,25 @@ #ifndef __fake_elf_h__ #define __fake_elf_h__ -typedef unsigned int Elf32_Addr; -typedef unsigned int Elf32_Off; -typedef unsigned short Elf32_Half; -typedef unsigned int Elf32_Word; -typedef unsigned char Elf32_Char; - -#ifdef __GNUC__ -typedef unsigned long long Elf64_Addr; -typedef unsigned long long Elf64_Off; +typedef uint32_t Elf32_Addr; +typedef uint32_t Elf32_Off; +typedef uint16_t Elf32_Half; +typedef uint32_t Elf32_Word; +typedef uint8_t Elf32_Char; + +#if SIZEOF_UINT64_T != 8 +#define USE_ARRAY_FOR_64BIT_TYPES +typedef uint32_t Elf64_Addr[2]; +typedef uint32_t Elf64_Off[2]; +typedef uint32_t Elf64_Xword[2]; #else -/* XXX: We need 64 bit numbers here */ -typedef unsigned int Elf64_Addr[2]; -typedef unsigned int Elf64_Off[2]; +typedef uint64_t Elf64_Addr; +typedef uint64_t Elf64_Off; +typedef uint64_t Elf64_Xword; #endif -typedef unsigned short Elf64_Half; -typedef unsigned int Elf64_Word; -typedef unsigned char Elf64_Char; +typedef uint16_t Elf64_Half; +typedef uint32_t Elf64_Word; +typedef uint8_t Elf64_Char; #define EI_NIDENT 16 @@ -70,6 +72,7 @@ typedef struct { /* sh_type */ #define SHT_SYMTAB 2 #define SHT_NOTE 7 +#define SHT_DYNSYM 11 /* elf type */ #define ELFDATANONE 0 /* e_ident[EI_DATA] */ @@ -111,6 +114,17 @@ typedef struct { Elf32_Word p_align; } Elf32_Phdr; +typedef struct { + Elf64_Word p_type; + Elf64_Word p_flags; + Elf64_Off p_offset; + Elf64_Addr p_vaddr; + Elf64_Addr p_paddr; + Elf64_Xword p_filesz; + Elf64_Xword p_memsz; + Elf64_Xword p_align; +} Elf64_Phdr; + #define PT_NULL 0 /* p_type */ #define PT_LOAD 1 #define PT_DYNAMIC 2 @@ -154,9 +168,9 @@ typedef struct { /* Note header in a PT_NOTE section */ typedef struct elf_note { - Elf32_Word n_namesz; /* Name size */ - Elf32_Word n_descsz; /* Content size */ - Elf32_Word n_type; /* Content type */ + Elf32_Word n_namesz; /* Name size */ + Elf32_Word n_descsz; /* Content size */ + Elf32_Word n_type; /* Content type */ } Elf32_Nhdr; typedef struct { diff --git a/src/softmagic.c b/src/softmagic.c index 572f3162..4a4ba80e 100644 --- a/src/softmagic.c +++ b/src/softmagic.c @@ -31,13 +31,10 @@ #include #include -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif #include "file.h" #ifndef lint -FILE_RCSID("@(#)$Id: softmagic.c,v 1.38 1998/09/12 13:21:01 christos Exp $") +FILE_RCSID("@(#)$Id: softmagic.c,v 1.39 1999/02/14 17:16:12 christos Exp $") #endif /* lint */ static int match __P((unsigned char *, int)); diff --git a/stamp-h.in b/stamp-h.in new file mode 100644 index 00000000..e69de29b