summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--contrib/file/.cvsignore13
-rw-r--r--contrib/file/ChangeLog166
-rw-r--r--contrib/file/LEGAL.NOTICE4
-rw-r--r--contrib/file/Localstuff2
-rw-r--r--contrib/file/MAINT2
-rw-r--r--contrib/file/Magdir/adventure2
-rw-r--r--contrib/file/Magdir/amigaos27
-rw-r--r--contrib/file/Magdir/animation46
-rw-r--r--contrib/file/Magdir/apple28
-rw-r--r--contrib/file/Magdir/archive74
-rw-r--r--contrib/file/Magdir/audio196
-rw-r--r--contrib/file/Magdir/bFLT12
-rw-r--r--contrib/file/Magdir/bout9
-rw-r--r--contrib/file/Magdir/c-lang13
-rw-r--r--contrib/file/Magdir/c6427
-rw-r--r--contrib/file/Magdir/cad36
-rw-r--r--contrib/file/Magdir/chord9
-rw-r--r--contrib/file/Magdir/claris2
-rw-r--r--contrib/file/Magdir/commands13
-rw-r--r--contrib/file/Magdir/communications21
-rw-r--r--contrib/file/Magdir/compress9
-rw-r--r--contrib/file/Magdir/console35
-rw-r--r--contrib/file/Magdir/dact10
-rw-r--r--contrib/file/Magdir/database123
-rw-r--r--contrib/file/Magdir/diff5
-rw-r--r--contrib/file/Magdir/elf16
-rw-r--r--contrib/file/Magdir/fcs8
-rw-r--r--contrib/file/Magdir/filesystems61
-rw-r--r--contrib/file/Magdir/flash2
-rw-r--r--contrib/file/Magdir/fonts14
-rw-r--r--contrib/file/Magdir/games157
-rw-r--r--contrib/file/Magdir/gcc16
-rw-r--r--contrib/file/Magdir/geos19
-rw-r--r--contrib/file/Magdir/gnu12
-rw-r--r--contrib/file/Magdir/human68k44
-rw-r--r--contrib/file/Magdir/ibm60002
-rw-r--r--contrib/file/Magdir/iff4
-rw-r--r--contrib/file/Magdir/images172
-rw-r--r--contrib/file/Magdir/intel12
-rw-r--r--contrib/file/Magdir/jpeg115
-rw-r--r--contrib/file/Magdir/linux51
-rw-r--r--contrib/file/Magdir/mach7
-rw-r--r--contrib/file/Magdir/macintosh337
-rw-r--r--contrib/file/Magdir/mail.news12
-rw-r--r--contrib/file/Magdir/maple4
-rw-r--r--contrib/file/Magdir/mathematica11
-rw-r--r--contrib/file/Magdir/matroska14
-rw-r--r--contrib/file/Magdir/misctools5
-rw-r--r--contrib/file/Magdir/motorola20
-rw-r--r--contrib/file/Magdir/msdos97
-rw-r--r--contrib/file/Magdir/netbsd88
-rw-r--r--contrib/file/Magdir/netscape3
-rw-r--r--contrib/file/Magdir/ocaml13
-rw-r--r--contrib/file/Magdir/os220
-rw-r--r--contrib/file/Magdir/palm76
-rw-r--r--contrib/file/Magdir/perl1
-rw-r--r--contrib/file/Magdir/plan94
-rw-r--r--contrib/file/Magdir/printer26
-rw-r--r--contrib/file/Magdir/psion43
-rw-r--r--contrib/file/Magdir/python2
-rw-r--r--contrib/file/Magdir/revision5
-rw-r--r--contrib/file/Magdir/riff135
-rw-r--r--contrib/file/Magdir/rpm9
-rw-r--r--contrib/file/Magdir/sgi228
-rw-r--r--contrib/file/Magdir/sgml11
-rw-r--r--contrib/file/Magdir/sinclair126
-rw-r--r--contrib/file/Magdir/sniffer40
-rw-r--r--contrib/file/Magdir/spec20
-rw-r--r--contrib/file/Magdir/spectrum16
-rw-r--r--contrib/file/Magdir/sun16
-rw-r--r--contrib/file/Magdir/sysex51
-rw-r--r--contrib/file/Magdir/ti-8x239
-rw-r--r--contrib/file/Magdir/unknown4
-rw-r--r--contrib/file/Magdir/varied.out7
-rw-r--r--contrib/file/Magdir/varied.script12
-rw-r--r--contrib/file/Magdir/vmware6
-rw-r--r--contrib/file/Magdir/vorbis48
-rw-r--r--contrib/file/Magdir/wordprocessors111
-rw-r--r--contrib/file/Magdir/xwindows25
-rw-r--r--contrib/file/Makefile.am77
-rw-r--r--contrib/file/Makefile.in696
-rw-r--r--contrib/file/README23
-rw-r--r--contrib/file/acinclude.m430
-rw-r--r--contrib/file/aclocal.m41782
-rw-r--r--contrib/file/apprentice.c774
-rw-r--r--contrib/file/apptype.c170
-rw-r--r--contrib/file/ascmagic.c248
-rw-r--r--contrib/file/compress.c212
-rw-r--r--contrib/file/config.h.in185
-rwxr-xr-xcontrib/file/configure9897
-rw-r--r--contrib/file/configure.in14
-rw-r--r--contrib/file/file.c422
-rw-r--r--contrib/file/file.h302
-rw-r--r--contrib/file/file.man180
-rw-r--r--contrib/file/fsmagic.c273
-rw-r--r--contrib/file/funcs.c186
-rw-r--r--contrib/file/is_tar.c76
-rw-r--r--contrib/file/libmagic.man228
-rw-r--r--contrib/file/magic.c343
-rw-r--r--contrib/file/magic.h69
-rw-r--r--contrib/file/magic.man83
-rw-r--r--contrib/file/magic.mime364
-rwxr-xr-xcontrib/file/magic2mime2
-rw-r--r--contrib/file/names.h52
-rw-r--r--contrib/file/patchlevel.h49
-rw-r--r--contrib/file/print.c183
-rw-r--r--contrib/file/readelf.c986
-rw-r--r--contrib/file/readelf.h33
-rw-r--r--contrib/file/softmagic.c861
-rw-r--r--contrib/file/tar.h36
-rw-r--r--contrib/file/test.c61
111 files changed, 17197 insertions, 5181 deletions
diff --git a/contrib/file/.cvsignore b/contrib/file/.cvsignore
index f1a127a..d899218 100644
--- a/contrib/file/.cvsignore
+++ b/contrib/file/.cvsignore
@@ -1,12 +1 @@
-Makefile
-config.cache
-config.h
-config.log
-config.status
-stamp-h
-file
-file.1
-magic.4
-magic
-magic.mgc
-magic.mime.mgc
+autom4te.cache
diff --git a/contrib/file/ChangeLog b/contrib/file/ChangeLog
new file mode 100644
index 0000000..1239626
--- /dev/null
+++ b/contrib/file/ChangeLog
@@ -0,0 +1,166 @@
+
+2004-07-24 16:33 Christos Zoulas <christos@zoulas.com>
+
+ * magic.mime update Danny Milosavljevic <danny.milo@gmx.net>
+
+ * FreeBSD version update Oliver Eikemeier <eikemeier@fillmore-labs.com>
+
+ * utime/utimes detection Ian Lance Taylor <ian@wasabisystems.com>
+
+ * errors reading elf magic Jakub Bogusz <qboosh@pld-linux.org>
+
+2004-04-12 10:55 Christos Zoulas <christos@zoulas.com>
+
+ * make sure that magic formats match magic types during compilation
+
+ * fix broken sgi magic file
+
+2004-04-06 20:36 Christos Zoulas <christos@zoulas.com>
+
+ * detect present of mbstate_t Petter Reinholdtsen <pere@hungry.com>
+
+ * magic fixes
+
+2004-03-22 15:25 Christos Zoulas <christos@zoulas.com>
+
+ * Lots of mime fixes
+ (Joerg Ostertag) <ostertag@rechengilde.de>
+
+ * FreeBSD ELF version handling
+ (Edwin Groothuis) <edwin@mavetju.org>
+
+ * correct cleanup in all cases; don't just close the file.
+ (Christos Zoulas) <christos@zoulas.com>
+
+ * add gettext message catalogue support
+ (Michael Piefel) <piefel@debian.org>
+
+ * better printout for unreadable files
+ (Michael Piefel) <piefel@debian.org>
+
+ * compensate for missing MAXPATHLEN
+ (Michael Piefel) <piefel@debian.org>
+
+ * add wide character string length computation
+ (Michael Piefel) <piefel@debian.org>
+
+ * Avoid infinite loops caused by bad elf alignments
+ or name and description note sizes. Reported by
+ (Mikael Magnusson) <mmikael@comhem.se>
+
+2004-03-09 13:55 Christos Zoulas <christos@zoulas.com>
+
+ * Fix possible memory leak on error and add missing regfree
+ (Dmitry V. Levin) <ldv@altlinux.org>
+
+2003-12-23 12:12 Christos Zoulas <christos@zoulas.com>
+
+ * fix -k flag (Maciej W. Rozycki)
+
+2003-11-18 14:10 Christos Zoulas <christos@zoulas.com>
+
+ * Try to give us much info as possible on corrupt elf files.
+ (Willy Tarreau) <willy@w.ods.org>
+ * Updated python bindings (Brett Funderburg)
+ <brettf@deepfile.com>
+
+2003-11-11 15:03 Christos Zoulas <christos@zoulas.com>
+
+ * Include file.h first, because it includes config.h
+ breaks largefile test macros otherwise.
+ (Paul Eggert <eggert@CS.UCLA.EDU> via
+ Lars Hecking <lhecking@nmrc.ie>)
+
+2003-10-14 21:39 Christos Zoulas <christos@zoulas.com>
+
+ * Python bindings (Brett Funderburg) <brettf@deepfile.com>
+ * Don't lookup past the end of the buffer
+ (Chad Hanson) <chanson@tcs-sec.com>
+ * Add MAGIC_ERROR and api on magic_errno()
+
+2003-10-08 12:40 Christos Zoulas <christos@zoulas.com>
+
+ * handle error conditions from compile as fatal
+ (Antti Kantee) <pooka@netbsd.org>
+ * handle magic filename parsing sanely
+ * more magic fixes.
+ * fix a memory leak (Illes Marton) <illes.marton@balabit.hu>
+ * describe magic file handling
+ (Bryan Henderson) <bryanh@giraffe-data.com>
+
+2003-09-12 15:09 Christos Zoulas <christos@zoulas.com>
+
+ * update magic files.
+ * remove largefile support from file.h; it breaks things on most OS's
+
+2003-08-10 10:25 Christos Zoulas <christos@zoulas.com>
+
+ * fix unmapping'ing of mmaped files.
+
+2003-07-10 12:03 Christos Zoulas <christos@zoulas.com>
+
+ * don't exit with -1 on error; always exit 1 (Marty Leisner)
+ * restore utimes code.
+
+2003-06-10 17:03 Christos Zoulas <christos@zoulas.com>
+
+ * make sure we don't access uninitialized memory.
+ * pass lint
+ * #ifdef __cplusplus in magic.h
+
+2003-05-25 19:23 Christos Zoulas <christos@zoulas.com>
+
+ * rename cvs magic file to revision to deal with
+ case insensitive filesystems.
+
+2003-05-23 17:03 Christos Zoulas <christos@zoulas.com>
+
+ * documentation fixes from Michael Piefel <piefel@debian.org>
+ * magic fixes (various)
+ * revert basename magic in .mgc name determination
+ * buffer protection in uncompress,
+ signness issues,
+ close files
+ Maciej W. Rozycki <macro@ds2.pg.gda.pl
+
+2003-04-21 20:12 Christos Zoulas <christos@zoulas.com>
+
+ * fix zsh magic
+
+2003-04-04 16:59 Christos Zoulas <christos@zoulas.com>
+
+ * fix operand sort order in string.
+
+2003-04-02 17:30 Christos Zoulas <christos@zoulas.com>
+
+ * cleanup namespace in magic.h
+
+2003-04-02 13:50 Christos Zoulas <christos@zoulas.com>
+
+ * Magic additions (Alex Ott)
+ * Fix bug that broke VPATH compilation (Peter Breitenlohner)
+
+2003-03-28 16:03 Christos Zoulas <christos@zoulas.com>
+
+ * remove packed attribute from magic struct.
+ * make the magic struct properly aligned.
+ * bump version number of compiled files to 2.
+
+2003-03-27 13:10 Christos Zoulas <christos@zoulas.com>
+
+ * separate tar detection and run it before softmagic.
+ * fix reversed symlink test.
+ * fix version printing.
+ * make separator a string instead of a char.
+ * update manual page and sort options.
+
+2003-03-26 11:00 Christos Zoulas <christos@zoulas.com>
+
+ * Pass lint
+ * make NULL in magic_file mean stdin
+ * Fix "-" argument to file to pass NULL to magic_file
+ * avoid pointer casts by using memcpy
+ * rename magic_buf -> magic_buffer
+ * keep only the first error
+ * manual page: new sentence, new line
+ * fix typo in api function (magic_buf -> magic_buffer)
diff --git a/contrib/file/LEGAL.NOTICE b/contrib/file/LEGAL.NOTICE
index 72cc535..dd8b90a 100644
--- a/contrib/file/LEGAL.NOTICE
+++ b/contrib/file/LEGAL.NOTICE
@@ -1,7 +1,7 @@
-$Id: LEGAL.NOTICE,v 1.11 1999/01/14 16:30:12 christos Exp $
+$Id: LEGAL.NOTICE,v 1.13 2003/03/23 22:23:30 christos Exp $
Copyright (c) Ian F. Darwin 1986, 1987, 1989, 1990, 1991, 1992, 1994, 1995.
Software written by Ian F. Darwin and others;
-maintained 1994-1999 Christos Zoulas.
+maintained 1994-2003 Christos Zoulas.
This software is not subject to any export provision of the United States
Department of Commerce, and may be exported to any country or planet.
diff --git a/contrib/file/Localstuff b/contrib/file/Localstuff
index 3c2fa0e..914d449 100644
--- a/contrib/file/Localstuff
+++ b/contrib/file/Localstuff
@@ -2,6 +2,6 @@
#------------------------------------------------------------------------------
# Localstuff: file(1) magic for locally observed files
#
-# $Id: Localstuff,v 1.3 1995/01/21 21:09:00 christos Exp $
+# $Id: Localstuff,v 1.4 2003/03/23 04:17:27 christos Exp $
# Add any locally observed files here. Remember:
# text if readable, executable if runnable binary, data if unreadable.
diff --git a/contrib/file/MAINT b/contrib/file/MAINT
index 5a87683..c711117 100644
--- a/contrib/file/MAINT
+++ b/contrib/file/MAINT
@@ -1,4 +1,4 @@
-$Id: MAINT,v 1.4 2000/04/11 02:43:51 christos Exp $
+$Id: MAINT,v 1.5 2003/03/23 04:36:37 christos Exp $
Maintenance notes:
diff --git a/contrib/file/Magdir/adventure b/contrib/file/Magdir/adventure
index 864712f..fb05cbe 100644
--- a/contrib/file/Magdir/adventure
+++ b/contrib/file/Magdir/adventure
@@ -16,7 +16,7 @@
# Infocom
# (Note: to avoid false matches Z-machine version 1 and 2 are not
# recognized since only the oldest Zork I and II used them. Similarly
-# there are 4 Infocom games that use verion 4 that are not recognized.)
+# there are 4 Infocom games that use version 4 that are not recognized.)
#0 byte 3 Infocom game data (Z-machine 3,
#>2 beshort <0x7fff Release %3d,
#>26 beshort >0 Size %d*2
diff --git a/contrib/file/Magdir/amigaos b/contrib/file/Magdir/amigaos
index a1be613..ba2366c 100644
--- a/contrib/file/Magdir/amigaos
+++ b/contrib/file/Magdir/amigaos
@@ -3,9 +3,8 @@
#
# From ignatios@cs.uni-bonn.de (Ignatios Souvatzis)
-# Some formats are still missing: AmigaOS special IFF's, e.g.: FORM....CTLG
-# (the others should be separate, anyway)
#
+0 belong 0x000003fa AmigaOS shared library
0 belong 0x000003f3 AmigaOS loadseg()ble executable/binary
0 belong 0x000003e7 AmigaOS object/library data
#
@@ -33,7 +32,25 @@
0 string ARP. The Holy Noise Module sound file
0 string BeEp\0 JamCracker Module sound file
0 string COSO\0 Hippel-COSO Module sound file
-26 string V.3 Brian Postma's Soundmon Module sound file v3
-26 string BPSM Brian Postma's Soundmon Module sound file v3
-26 string V.2 Brian Postma's Soundmon Module sound file v2
+# Too simple (short, pure ASCII, deep), MPi
+#26 string V.3 Brian Postma's Soundmon Module sound file v3
+#26 string BPSM Brian Postma's Soundmon Module sound file v3
+#26 string V.2 Brian Postma's Soundmon Module sound file v2
+# The following are from: "Stefan A. Haubenthal" <polluks@web.de>
+0 beshort 0x0f00 AmigaOS bitmap font
+0 beshort 0x0f03 AmigaOS outline font
+0 belong 0x80001001 AmigaOS outline tag
+0 string ##\ version catalog translation
+
+# Amiga disk types
+#
+0 string RDSK Rigid Disk Block
+>160 string x on %.24s
+0 string DOS\0 Amiga DOS disk
+0 string DOS\1 Amiga FFS disk
+0 string DOS\2 Amiga Inter DOS disk
+0 string DOS\3 Amiga Inter FFS disk
+0 string DOS\4 Amiga Fastdir DOS disk
+0 string DOS\5 Amiga Fastdir FFS disk
+0 string KICK Kickstart disk
diff --git a/contrib/file/Magdir/animation b/contrib/file/Magdir/animation
index 56f25cf..815a208 100644
--- a/contrib/file/Magdir/animation
+++ b/contrib/file/Magdir/animation
@@ -118,6 +118,12 @@
#>3 byte&0x03 1 \b, Emphasis 5
#>3 byte&0x03 3 \b, Emphasis c
+#From: Johan Gade <jgade@diku.dk>
+
+# MPEG-4 Advanced Audio Coding (AAC) file (perhaps also MPEG-2 ACC?)
+16 string M4A MPEG-4 Advanced Audio Coding file (AAC)
+
+
# FLI animation format
4 leshort 0xAF11 FLI file
>6 leshort x - %d frames,
@@ -157,10 +163,19 @@
# \003. Most of them start with non-null values at hex offset 0x34 or so.
#0 string \3\0\0\0\0\0\0\0\0\0\0\0 DL version 3
-# SGI and Apple formats
+# SGI formats
0 string MOVI Silicon Graphics movie file
+
+# Apple Quicktime: Scan for all known top-level QT atom markers
4 string moov Apple QuickTime movie file (moov)
4 string mdat Apple QuickTime movie file (mdat)
+4 string ftyp Apple QuickTime movie file (ftyp)
+4 string free Apple QuickTime movie file (free)
+4 string junk Apple QuickTime movie file (junk)
+4 string pnot Apple QuickTime movie file (pnot)
+4 string skip Apple QuickTime movie file (skip)
+4 string wide Apple QuickTime movie file (wide)
+4 string pict Apple QuickTime movie file (pict)
# iso 13818 transport stream
#
@@ -194,3 +209,32 @@
0 string \x8aMNG MNG video data,
>4 belong !0x0d0a1a0a CORRUPTED,
>4 belong 0x0d0a1a0a
+>>16 belong x %ld x
+>>20 belong x %ld
+
+# JNG Video Format, <URL:http://www.libpng.org/pub/mng/spec/>
+0 string \x8bJNG JNG video data,
+>4 belong !0x0d0a1a0a CORRUPTED,
+>4 belong 0x0d0a1a0a
+>>16 belong x %ld x
+>>20 belong x %ld
+
+# Vivo video (Wolfram Kleff)
+3 string \x0D\x0AVersion:Vivo Vivo video data
+
+# VRML (Virtual Reality Modelling Language)
+0 string/b #VRML\ V1.0\ ascii VRML 1 file
+0 string/b #VRML\ V2.0\ utf8 ISO/IEC 14772 VRML 97 file
+
+#---------------------------------------------------------------------------
+# HVQM4: compressed movie format designed by Hudson for Nintendo GameCube
+# From Mark Sheppard <msheppard@climax.co.uk>, 2002-10-03
+#
+0 string HVQM4 %s
+>6 string >\0 v%s
+>0 byte x GameCube movie,
+>0x34 ubeshort x %d x
+>0x36 ubeshort x %d,
+>0x26 ubeshort x %dµs,
+>0x42 ubeshort 0 no audio
+>0x42 ubeshort >0 %dHz audio
diff --git a/contrib/file/Magdir/apple b/contrib/file/Magdir/apple
index c2b372b..2b0a290 100644
--- a/contrib/file/Magdir/apple
+++ b/contrib/file/Magdir/apple
@@ -28,6 +28,13 @@
>12 belong &0x02000000 UseFasterCompression,
>16 belong x version %d
+0 string package4 Newton package,
+>8 byte 8 NOS 1.x,
+>8 byte 9 NOS 2.x,
+>12 belong &0x80000000 AutoRemove,
+>12 belong &0x40000000 CopyProtect,
+>12 belong &0x10000000 NoCompression,
+
# The following entries for the Apple II are for files that have
# been transferred as raw binary data from an Apple, without having
# been encapsulated by any of the above archivers.
@@ -120,3 +127,24 @@
# Beagle Bros. Apple Mechanic fonts
0 belong&0xFF00FFFF 0x6400D000 Apple Mechanic font
+
+# Apple Universal Disk Image Format (UDIF) - dmg files.
+# From Johan Gade.
+# These entries are disabled for now until we fix the following issues.
+#
+# Note there might be some problems with the "VAX COFF executable"
+# entry. Note this entry should be placed before the mac filesystem section,
+# particularly the "Apple Partition data" entry.
+#
+# The intended meaning of these tests is, that the file is only of the
+# specified type if both of the lines are correct - i.e. if the first
+# line matches and the second doesn't then it is not of that type.
+#
+#0 long 0x7801730d
+#>4 long 0x62626060 UDIF read-only zlib-compressed image (UDZO)
+#
+# Note that this entry is recognized correctly by the "Apple Partition
+# data" entry - however since this entry is more specific - this
+# information seems to be more useful.
+#0 long 0x45520200
+#>0x410 string disk\ image UDIF read/write image (UDRW)
diff --git a/contrib/file/Magdir/archive b/contrib/file/Magdir/archive
index 133e50c..070feab 100644
--- a/contrib/file/Magdir/archive
+++ b/contrib/file/Magdir/archive
@@ -32,8 +32,10 @@
0 string !<arch>\ndebian
>8 string debian-split part of multipart Debian package
>8 string debian-binary Debian binary package
->68 string >\n (format %s)
->136 ledate x created: %s
+>68 string >\0 (format %s)
+>81 string bz2 \b, uses bzip2 compression
+>84 string gz \b, uses gzip compression
+#>136 ledate x created: %s
# other archives
0 long 0177555 very old archive
@@ -187,7 +189,12 @@
>20 byte x - header level %d
# RAR archiver (Greg Roelofs, newt@uchicago.edu)
-0 string Rar! RAR archive data
+0 string Rar! RAR archive data,
+>44 byte x v%0x,
+>35 byte 0 os: MS-DOS
+>35 byte 1 os: OS/2
+>35 byte 2 os: Win32
+>35 byte 3 os: Unix
# SQUISH archiver (Greg Roelofs, newt@uchicago.edu)
0 string SQSH squished archive data (Acorn RISCOS)
@@ -239,9 +246,11 @@
# Microsoft cabinets
# by David Necas (Yeti) <yeti@physics.muni.cz>
-0 string MSCF\0\0\0\0 Microsoft cabinet file data,
->25 byte x v%d
->24 byte x \b.%d
+#0 string MSCF\0\0\0\0 Microsoft cabinet file data,
+#>25 byte x v%d
+#>24 byte x \b.%d
+# MPi: All CABs have version 1.3, so this is pointless.
+# Better magic in debian-additions.
# GTKtalog catalogs
# by David Necas (Yeti) <yeti@physics.muni.cz>
@@ -256,3 +265,56 @@
0 string PAR\0 PARity archive data
>48 leshort =0 - Index file
>48 leshort >0 - file number %d
+
+# Felix von Leitner <felix-file@fefe.de>
+0 string d8:announce BitTorrent file
+
+# Atari MSA archive - Teemu Hukkanen <tjhukkan@iki.fi>
+0 beshort 0x0e0f Atari MSA archive data
+>2 beshort x \b, %d sectors per track
+>4 beshort 0 \b, 1 sided
+>4 beshort 1 \b, 2 sided
+>6 beshort x \b, starting track: %d
+>8 beshort x \b, ending track: %d
+
+# Alternate ZIP string (amc@arwen.cs.berkeley.edu)
+0 string PK00PK\003\004 Zip archive data
+
+# ACE archive (from http://www.wotsit.org/download.asp?f=ace)
+# by Stefan `Sec` Zehl <sec@42.org>
+7 string **ACE** ACE compressed archive
+>15 byte >0 version %d
+>16 byte =0x00 \b, from MS-DOS
+>16 byte =0x01 \b, from OS/2
+>16 byte =0x02 \b, from Win/32
+>16 byte =0x03 \b, from Unix
+>16 byte =0x04 \b, from MacOS
+>16 byte =0x05 \b, from WinNT
+>16 byte =0x06 \b, from Primos
+>16 byte =0x07 \b, from AppleGS
+>16 byte =0x08 \b, from Atari
+>16 byte =0x09 \b, from Vax/VMS
+>16 byte =0x0A \b, from Amiga
+>16 byte =0x0B \b, from Next
+>14 byte x \b, version %d to extract
+>5 leshort &0x0080 \b, multiple volumes,
+>>17 byte x \b (part %d),
+>5 leshort &0x0002 \b, contains comment
+>5 leshort &0x0200 \b, sfx
+>5 leshort &0x0400 \b, small dictionary
+>5 leshort &0x0800 \b, multi-volume
+>5 leshort &0x1000 \b, contains AV-String
+>>30 string\x16*UNREGISTERED\x20VERSION* (unregistered)
+>5 leshort &0x2000 \b, with recovery record
+>5 leshort &0x4000 \b, locked
+>5 leshort &0x8000 \b, solid
+# Date in MS-DOS format (whatever that is)
+#>18 lelong x Created on
+
+# sfArk : compression program for Soundfonts (sf2) by Dirk Jagdmann
+# <doj@cubic.org>
+0x1A string sfArk sfArk compressed Soundfont
+>0x15 string 2
+>>0x1 string >\0 Version %s
+>>0x2A string >\0 : %s
+
diff --git a/contrib/file/Magdir/audio b/contrib/file/Magdir/audio
index 9507c12..6a4ef95 100644
--- a/contrib/file/Magdir/audio
+++ b/contrib/file/Magdir/audio
@@ -8,18 +8,28 @@
# Sun/NeXT audio data
0 string .snd Sun/NeXT audio data:
->12 belong 1 8-bit ISDN u-law,
+>12 belong 1 8-bit ISDN mu-law,
>12 belong 2 8-bit linear PCM [REF-PCM],
>12 belong 3 16-bit linear PCM,
>12 belong 4 24-bit linear PCM,
>12 belong 5 32-bit linear PCM,
>12 belong 6 32-bit IEEE floating point,
>12 belong 7 64-bit IEEE floating point,
->12 belong 23 8-bit ISDN u-law compressed (CCITT G.721 ADPCM voice data encoding),
->12 belong 24 compressed (8-bit G.722 ADPCM)
->12 belong 25 compressed (3-bit G.723 ADPCM),
->12 belong 26 compressed (5-bit G.723 ADPCM),
->12 belong 27 8-bit A-law,
+>12 belong 8 Fragmented sample data,
+>12 belong 10 DSP program,
+>12 belong 11 8-bit fixed point,
+>12 belong 12 16-bit fixed point,
+>12 belong 13 24-bit fixed point,
+>12 belong 14 32-bit fixed point,
+>12 belong 18 16-bit linear with emphasis,
+>12 belong 19 16-bit linear compressed,
+>12 belong 20 16-bit linear with emphasis and compression,
+>12 belong 21 Music kit DSP commands,
+>12 belong 23 8-bit ISDN mu-law compressed (CCITT G.721 ADPCM voice data encoding),
+>12 belong 24 compressed (8-bit CCITT G.722 ADPCM)
+>12 belong 25 compressed (3-bit CCITT G.723.3 ADPCM),
+>12 belong 26 compressed (5-bit CCITT G.723.5 ADPCM),
+>12 belong 27 8-bit A-law (CCITT G.711),
>20 belong 1 mono,
>20 belong 2 stereo,
>20 belong 4 quad,
@@ -28,14 +38,28 @@
# DEC systems (e.g. DECstation 5000) use a variant of the Sun/NeXT format
# that uses little-endian encoding and has a different magic number
0 lelong 0x0064732E DEC audio data:
->12 lelong 1 8-bit ISDN u-law,
+>12 lelong 1 8-bit ISDN mu-law,
>12 lelong 2 8-bit linear PCM [REF-PCM],
>12 lelong 3 16-bit linear PCM,
>12 lelong 4 24-bit linear PCM,
>12 lelong 5 32-bit linear PCM,
>12 lelong 6 32-bit IEEE floating point,
>12 lelong 7 64-bit IEEE floating point,
->12 lelong 23 8-bit ISDN u-law compressed (CCITT G.721 ADPCM voice data encoding),
+>12 belong 8 Fragmented sample data,
+>12 belong 10 DSP program,
+>12 belong 11 8-bit fixed point,
+>12 belong 12 16-bit fixed point,
+>12 belong 13 24-bit fixed point,
+>12 belong 14 32-bit fixed point,
+>12 belong 18 16-bit linear with emphasis,
+>12 belong 19 16-bit linear compressed,
+>12 belong 20 16-bit linear with emphasis and compression,
+>12 belong 21 Music kit DSP commands,
+>12 lelong 23 8-bit ISDN mu-law compressed (CCITT G.721 ADPCM voice data encoding),
+>12 belong 24 compressed (8-bit CCITT G.722 ADPCM)
+>12 belong 25 compressed (3-bit CCITT G.723.3 ADPCM),
+>12 belong 26 compressed (5-bit CCITT G.723.5 ADPCM),
+>12 belong 27 8-bit A-law (CCITT G.711),
>20 lelong 1 mono,
>20 lelong 2 stereo,
>20 lelong 4 quad,
@@ -43,8 +67,12 @@
# Creative Labs AUDIO stuff
0 string MThd Standard MIDI data
->9 byte >0 (format %d)
->11 byte >1 using %d tracks
+>8 beshort x (format %d)
+>10 beshort x using %d track
+>10 beshort >1 \bs
+>12 beshort&0x7fff x at 1/%d
+>12 beshort&0x8000 >0 SMPTE
+
0 string CTMF Creative Music (CMF) data
0 string SBI SoundBlaster instrument data
0 string Creative\ Voice\ File Creative Labs voice data
@@ -72,12 +100,18 @@
# MTM/669/FAR/S3M/ULT/XM format checking [Aaron Eppert, aeppert@dialin.ind.net]
# Oct 31, 1995
-0 string MTM MultiTracker Module sound file
+# fixed by <doj@cubic.org> 2003-06-24
+# Too short...
+#0 string MTM MultiTracker Module sound file
#0 string if Composer 669 Module sound data
-0 string FAR Module sound data
+#0 string JN Composer 669 Module sound data (extended format)
0 string MAS_U ULT(imate) Module sound data
+
+#0 string FAR Module sound data
+#>4 string >\15 Title: "%s"
+
0x2c string SCRM ScreamTracker III Module sound data
-0 string Extended Module Extended Module sound data
+>0 string >\0 Title: "%s"
# Gravis UltraSound patches
# From <ache@nagual.ru>
@@ -88,37 +122,68 @@
#
# Taken from loader code from mikmod version 2.14
# by Steve McIntyre (stevem@chiark.greenend.org.uk)
-0 string JN extended 669 module data
+# <doj@cubic.org> added title printing on 2003-06-24
0 string MAS_UTrack_V00
>14 string >/0 ultratracker V1.%.1s module sound data
+
0 string UN05 MikMod UNI format module sound data
+
0 string Extended\ Module: Fasttracker II module sound data
-21 string !SCREAM! Screamtracker 2 module sound data
+>17 string >\0 Title: "%s"
+
+21 string/c !SCREAM! Screamtracker 2 module sound data
+21 string BMOD2STM Screamtracker 2 module sound data
1080 string M.K. 4-channel Protracker module sound data
+>0 string >\0 Title: "%s"
1080 string M!K! 4-channel Protracker module sound data
+>0 string >\0 Title: "%s"
1080 string FLT4 4-channel Startracker module sound data
+>0 string >\0 Title: "%s"
+1080 string FLT8 8-channel Startracker module sound data
+>0 string >\0 Title: "%s"
1080 string 4CHN 4-channel Fasttracker module sound data
+>0 string >\0 Title: "%s"
1080 string 6CHN 6-channel Fasttracker module sound data
+>0 string >\0 Title: "%s"
1080 string 8CHN 8-channel Fasttracker module sound data
-1080 string CD81 8-channel Oktalyzer module sound data
+>0 string >\0 Title: "%s"
+1080 string CD81 8-channel Octalyser module sound data
+>0 string >\0 Title: "%s"
1080 string OKTA 8-channel Oktalyzer module sound data
+>0 string >\0 Title: "%s"
# Not good enough.
#1082 string CH
#>1080 string >/0 %.2s-channel Fasttracker "oktalyzer" module sound data
1080 string 16CN 16-channel Taketracker module sound data
+>0 string >\0 Title: "%s"
1080 string 32CN 32-channel Taketracker module sound data
+>0 string >\0 Title: "%s"
# TOC sound files -Trevor Johnson <trevor@jpj.net>
#
0 string TOC TOC sound file
# sidfiles <pooka@iki.fi>
+# added name,author,(c) and new RSID type by <doj@cubic.org> 2003-06-24
0 string SIDPLAY\ INFOFILE Sidplay info file
+
0 string PSID PlaySID v2.2+ (AMIGA) sidtune
>4 beshort >0 w/ header v%d,
>14 beshort =1 single song,
>14 beshort >1 %d songs,
>16 beshort >0 default song: %d
+>0x16 string >\0 name: "%s"
+>0x36 string >\0 author: "%s"
+>0x56 string >\0 copyright: "%s"
+
+0 string RSID RSID sidtune PlaySID compatible
+>4 beshort >0 w/ header v%d,
+>14 beshort =1 single song,
+>14 beshort >1 %d songs,
+>16 beshort >0 default song: %d
+>0x16 string >\0 name: "%s"
+>0x36 string >\0 author: "%s"
+>0x56 string >\0 copyright: "%s"
# IRCAM <mpruett@sgi.com>
# VAX and MIPS files are little-endian; Sun and NeXT are big-endian
@@ -133,8 +198,25 @@
# Sample Vision <mpruett@sgi.com>
0 string SOUND\ SAMPLE\ DATA\ Sample Vision file
-# Audio Visual Research <mpruett@sgi.com>
-0 string 2BIT Audio Visual Research file
+# Audio Visual Research <tonigonenstein@users.sourceforge.net>
+0 string 2BIT Audio Visual Research file,
+>12 beshort =0 mono,
+>12 beshort =-1 stereo,
+>14 beshort x %d bits
+>16 beshort =0 unsigned,
+>16 beshort =-1 signed,
+>22 belong&0x00ffffff x %d Hz,
+>18 beshort =0 no loop,
+>18 beshort =-1 loop,
+>21 ubyte <=127 note %d,
+>22 byte =0 replay 5.485 KHz
+>22 byte =1 replay 8.084 KHz
+>22 byte =2 replay 10.971 Khz
+>22 byte =3 replay 16.168 Khz
+>22 byte =4 replay 21.942 KHz
+>22 byte =5 replay 32.336 KHz
+>22 byte =6 replay 43.885 KHz
+>22 byte =7 replay 47.261 KHz
# SGI SoundTrack <mpruett@sgi.com>
0 string _SGI_SoundTrack SGI SoundTrack project file
@@ -230,6 +312,29 @@
0 string FTMN FaceTheMusic module
>16 string >\0d \b, "%s"
+# From: <doj@cubic.org> 2003-06-24
+0 string AMShdr\32 Velvet Studio AMS Module v2.2
+0 string Extreme Extreme Tracker AMS Module v1.3
+0 string DDMF Xtracker DMF Module
+>4 byte x v%i
+>0xD string >\0 Title: "%s"
+>0x2B string >\0 Composer: "%s"
+0 string DSM\32 Dynamic Studio Module DSM
+0 string SONG DigiTrekker DTM Module
+0 string DMDL DigiTrakker MDL Module
+0 string PSM\32 Protracker Studio PSM Module
+44 string PTMF Poly Tracker PTM Module
+>0 string >\32 Title: "%s"
+0 string MT20 MadTracker 2.0 Module MT2
+0 string RAD\40by\40REALiTY!! RAD Adlib Tracker Module RAD
+0 string RTMM RTM Module
+0x426 string MaDoKaN96 XMS Adlib Module
+>0 string >\0 Composer: "%s"
+0 string AMF AMF Module
+>4 string >\0 Title: "%s"
+0 string MODINFO1 Open Cubic Player Module Inforation MDZ
+0 string Extended\40Instrument: Fast Tracker II Instrument
+
# From: Takeshi Hamasaki <hma@syd.odn.ne.jp>
# NOA Nancy Codec file
0 string \210NOA\015\012\032 NOA Nancy Codec Movie file
@@ -240,7 +345,56 @@
>20 string Ver01.00 Ver. 1.00
>>32 byte x , %d tracks
-# FLAC audio stream <URL:http://flac.sourceforge.net/>
-# From: Dan Fandrich <dan@coneharvesters.com>
-0 string fLaC FLAC audio stream data
+# Free lossless audio codec <http://flac.sourceforge.net>
+# From: Przemyslaw Augustyniak <silvathraec@rpg.pl>
+0 string fLaC FLAC audio bitstream data
+>4 byte&0x7f >0 \b, unknown version
+>4 byte&0x7f 0 \b
+# some common bits/sample values
+>>20 beshort&0x1f0 0x030 \b, 4 bit
+>>20 beshort&0x1f0 0x050 \b, 6 bit
+>>20 beshort&0x1f0 0x070 \b, 8 bit
+>>20 beshort&0x1f0 0x0b0 \b, 12 bit
+>>20 beshort&0x1f0 0x0f0 \b, 16 bit
+>>20 beshort&0x1f0 0x170 \b, 24 bit
+>>20 byte&0xe 0x0 \b, mono
+>>20 byte&0xe 0x2 \b, stereo
+>>20 byte&0xe 0x4 \b, 3 channels
+>>20 byte&0xe 0x6 \b, 4 channels
+>>20 byte&0xe 0x8 \b, 5 channels
+>>20 byte&0xe 0xa \b, 6 channels
+>>20 byte&0xe 0xc \b, 7 channels
+>>20 byte&0xe 0xe \b, 8 channels
+# some common sample rates
+>>17 belong&0xfffff0 0x0ac440 \b, 44.1 kHz
+>>17 belong&0xfffff0 0x0bb800 \b, 48 kHz
+>>17 belong&0xfffff0 0x07d000 \b, 32 kHz
+>>17 belong&0xfffff0 0x056220 \b, 22.05 kHz
+>>17 belong&0xfffff0 0x05dc00 \b, 24 kHz
+>>17 belong&0xfffff0 0x03e800 \b, 16 kHz
+>>17 belong&0xfffff0 0x02b110 \b, 11.025 kHz
+>>17 belong&0xfffff0 0x02ee00 \b, 12 kHz
+>>17 belong&0xfffff0 0x01f400 \b, 8 kHz
+>>17 belong&0xfffff0 0x177000 \b, 96 kHz
+>>17 belong&0xfffff0 0x0fa000 \b, 64 kHz
+>>21 byte&0xf >0 \b, >4G samples
+>>21 byte&0xf 0 \b
+>>>22 belong >0 \b, %u samples
+>>>22 belong 0 \b, length unknown
+
+# (ISDN) VBOX voice message file (Wolfram Kleff)
+0 string VBOX VBOX voice message data
+
+# ReBorn Song Files (.rbs)
+# David J. Singer <doc@deadvirgins.org.uk>
+8 string RB40 RBS Song file
+>29 string ReBorn created by ReBorn
+>37 string Propellerhead created by ReBirth
+
+# Synthesizer Generator and Kimwitu share their file format
+0 string A#S#C#S#S#L#V#3 Synthesizer Generator or Kimwitu data
+# Kimwitu++ uses a slightly different magic
+0 string A#S#C#S#S#L#HUB Kimwitu++ data
+# From "Simon Hosie
+0 string TFMX-SONG TFMX module sound data
diff --git a/contrib/file/Magdir/bFLT b/contrib/file/Magdir/bFLT
new file mode 100644
index 0000000..5e288d1
--- /dev/null
+++ b/contrib/file/Magdir/bFLT
@@ -0,0 +1,12 @@
+#------------------------------------------------------------------------------
+# bFLT: file(1) magic for BFLT uclinux binary files
+#
+# From Philippe De Muyter <phdm@macqel.be>
+#
+0 string bFLT BFLT executable
+>4 belong x - version %ld
+>4 belong 4
+>>36 belong&0x1 0x1 ram
+>>36 belong&0x2 0x2 gotpic
+>>36 belong&0x4 0x4 gzip
+>>36 belong&0x8 0x8 gzdata
diff --git a/contrib/file/Magdir/bout b/contrib/file/Magdir/bout
new file mode 100644
index 0000000..ab771fe
--- /dev/null
+++ b/contrib/file/Magdir/bout
@@ -0,0 +1,9 @@
+#
+# i80960 b.out objects and archives
+#
+0 long 0x10d i960 b.out relocatable object
+>16 long >0 not stripped
+#
+# b.out archive (hp-rt on i960)
+0 string !<bout> b.out archive
+>8 string __.SYMDEF random library
diff --git a/contrib/file/Magdir/c-lang b/contrib/file/Magdir/c-lang
index 1b01475..1dcf636 100644
--- a/contrib/file/Magdir/c-lang
+++ b/contrib/file/Magdir/c-lang
@@ -10,4 +10,15 @@
# this first will upset you if you're a PL/1 shop...
# in which case rm it; ascmagic will catch real C programs
#0 string /* C or REXX program text
-0 string // C++ program text
+#0 string // C++ program text
+
+# From: Mikhail Teterin <mi@aldan.algebra.com>
+0 string cscope cscope reference data
+>7 string x version %.2s
+# We skip the path here, because it is often long (so file will
+# truncate it) and mostly redundant.
+# The inverted index functionality was added some time betwen
+# versions 11 and 15, so look for -q if version is above 14:
+>7 string >14
+>>10 regex .+\ -q\ with inverted index
+>10 regex .+\ -c\ text (non-compressed)
diff --git a/contrib/file/Magdir/c64 b/contrib/file/Magdir/c64
new file mode 100644
index 0000000..4ca143f
--- /dev/null
+++ b/contrib/file/Magdir/c64
@@ -0,0 +1,27 @@
+
+#------------------------------------------------------------------------------
+# c64: file(1) magic for various commodore 64 related files
+#
+# From <doj@cubic.org>
+
+0x16500 belong 0x12014100 D64 Image
+0x16500 belong 0x12014180 D71 Image
+0x61800 belong 0x28034400 D81 Image
+0 string C64\40CARTRIDGE CCS C64 Emultar Cartridge Image
+0 belong 0x43154164 X64 Image
+
+0 string GCR-1541 GCR Image
+>8 byte x version: $i
+>9 byte x tracks: %i
+
+9 string PSUR ARC archive (c64)
+2 string -LH1- LHA archive (c64)
+
+0 string C64File PC64 Emulator file
+>8 string >\0 "%s"
+0 string C64Image PC64 Freezer Image
+
+0 beshort 0x38CD C64 PCLink Image
+0 string CBM\144\0\0 Power 64 C64 Emulator Snapshot
+
+0 belong 0xFF424CFF WRAptor packer (c64)
diff --git a/contrib/file/Magdir/cad b/contrib/file/Magdir/cad
new file mode 100644
index 0000000..92aa837
--- /dev/null
+++ b/contrib/file/Magdir/cad
@@ -0,0 +1,36 @@
+
+#------------------------------------------------------------------------------
+# autocad: file(1) magic for cad files
+#
+
+# AutoCAD DWG versions R13/R14 (www.autodesk.com)
+# Written December 01, 2003 by Lester Hightower
+# Based on the DWG File Format Specifications at http://www.opendwg.org/
+0 string \101\103\061\060\061 AutoCAD
+>5 string \062\000\000\000\000 DWG ver. R13
+>5 string \064\000\000\000\000 DWG ver. R14
+
+# Microstation DGN/CIT Files (www.bentley.com)
+# Written October 30, 2003 by Lester Hightower
+# DGN is the default file extension of Microstation/Intergraph CAD files.
+# CIT is the proprietary raster format (similar to TIFF) used to attach
+# raster underlays to Microstation DGN (vector) drawings.
+#
+# http://www.wotsit.org/search.asp
+# http://filext.com/detaillist.php?extdetail=DGN
+# http://filext.com/detaillist.php?extdetail=CIT
+#
+# http://www.bentley.com/products/default.cfm?objectid=97F351F5-9C35-4E5E-89C2
+# 3F86C928&method=display&p_objectid=97F351F5-9C35-4E5E-89C280A93F86C928
+# http://www.bentley.com/products/default.cfm?objectid=A5C2FD43-3AC9-4C71-B682
+# 721C479F&method=display&p_objectid=A5C2FD43-3AC9-4C71-B682C7BE721C479F
+0 string \010\011\376 Microstation
+>3 string \002
+>>30 string \372\104 DGN File
+>>30 string \172\104 DGN File
+>>30 string \026\105 DGN File
+>4 string \030\000\000 CIT File
+
+# AutoCad, from Nahuel Greco
+0 string AC1012 AutoCad (release 12)
+0 string AC1014 AutoCad (release 14)
diff --git a/contrib/file/Magdir/chord b/contrib/file/Magdir/chord
new file mode 100644
index 0000000..3639f3c
--- /dev/null
+++ b/contrib/file/Magdir/chord
@@ -0,0 +1,9 @@
+
+#------------------------------------------------------------------------------
+# chord: file(1) magic for Chord music sheet typesetting utility input files
+#
+# From Philippe De Muyter <phdm@macqel.be>
+# File format is actually free, but many distributed files begin with `{title'
+#
+0 string {title Chord text file
+
diff --git a/contrib/file/Magdir/claris b/contrib/file/Magdir/claris
index b18bd91..368b473 100644
--- a/contrib/file/Magdir/claris
+++ b/contrib/file/Magdir/claris
@@ -32,7 +32,7 @@
# a t r i s t sp ^ S cr nl d i v sp #
# .mth Thesaurus
-# statrts with \0 but no magic header
+# starts with \0 but no magic header
# .chy Hyphenation file
# I am not sure: 000 210 034 000 000
diff --git a/contrib/file/Magdir/commands b/contrib/file/Magdir/commands
index a9dd089..93244b8 100644
--- a/contrib/file/Magdir/commands
+++ b/contrib/file/Magdir/commands
@@ -13,6 +13,8 @@
#
# zsh/ash/ae/nawk/gawk magic from cameron@cs.unsw.oz.au (Cameron Simpson)
+0 string/b #!\ /bin/zsh Paul Falstad's zsh script text executable
+0 string/b #!\ /usr/bin/zsh Paul Falstad's zsh script text executable
0 string/b #!\ /usr/local/bin/zsh Paul Falstad's zsh script text executable
0 string/b #!\ /usr/local/bin/ash Neil Brown's ash script text executable
0 string/b #!\ /usr/local/bin/ae Neil Brown's ae script text executable
@@ -40,17 +42,6 @@
0 string #!\ /usr/bin/env a
>16 string >\0 %s script text executable
-
-# generic shell magic
-0 string #!\ / a
->3 string >\0 %s script text executable
-0 string #!\ / a
->3 string >\0 %s script text executable
-0 string #!/ a
->2 string >\0 %s script text executable
-0 string #!\ script text executable
->3 string >\0 for %s
-
# PHP scripts
# Ulf Harnhammar <ulfh@update.uu.se>
0 string/c =<?php PHP script text
diff --git a/contrib/file/Magdir/communications b/contrib/file/Magdir/communications
new file mode 100644
index 0000000..81417ec
--- /dev/null
+++ b/contrib/file/Magdir/communications
@@ -0,0 +1,21 @@
+
+#----------------------------------------------------------------------------
+# communication
+
+# TTCN is the Tree and Tabular Combined Notation described in ISO 9646-3.
+# It is used for conformance testing of communication protocols.
+# Added by W. Borgert <debacle@debian.org>.
+0 string $Suite TTCN Abstract Test Suite
+>&1 string $SuiteId
+>>&1 string >\n %s
+>&2 string $SuiteId
+>>&1 string >\n %s
+>&3 string $SuiteId
+>>&1 string >\n %s
+
+# MSC (message sequence charts) are a formal description technique,
+# described in ITU-T Z.120, mainly used for communication protocols.
+# Added by W. Borgert <debacle@debian.org>.
+0 string mscdocument Message Sequence Chart (document)
+0 string msc Message Sequence Chart (chart)
+0 string submsc Message Sequence Chart (subchart)
diff --git a/contrib/file/Magdir/compress b/contrib/file/Magdir/compress
index 0130541..71e689c 100644
--- a/contrib/file/Magdir/compress
+++ b/contrib/file/Magdir/compress
@@ -46,10 +46,8 @@
>2 belong >1 \b, %d characters originally
>2 belong =1 \b, %d character originally
#
-# This magic number is byte-order-independent. XXX - Does that mean this
-# is big-endian, little-endian, either, or that you can't tell?
-# this short is valid for SunOS
-0 short 017437 old packed data
+# This magic number is byte-order-independent.
+0 short 0x1f1f old packed data
# XXX - why *two* entries for "compacted data", one of which is
# byte-order independent, and one of which is byte-order dependent?
@@ -169,3 +167,6 @@
0 string 7z\274\257\047\034 7z archive data,
>6 byte x version %d
>7 byte x \b.%d
+
+# AFX compressed files (Wolfram Kleff)
+2 string -afx- AFX compressed file data
diff --git a/contrib/file/Magdir/console b/contrib/file/Magdir/console
index f8d2ebb..ff5a152 100644
--- a/contrib/file/Magdir/console
+++ b/contrib/file/Magdir/console
@@ -119,4 +119,37 @@
#------------------------------------------------------------------------------
# msx: file(1) magic for MSX game cartridge dumps
-0 beshort 0x4142 MSX game cartridge dump
+# Too simple - MPi
+#0 beshort 0x4142 MSX game cartridge dump
+
+#------------------------------------------------------------------------------
+# Sony Playstation executables (Adam Sjoegren <asjo@diku.dk>) :
+0 string PS-X\ EXE Sony Playstation executable
+# Area:
+>113 string x (%s)
+
+#------------------------------------------------------------------------------
+# Microsoft Xbox executables .xbe (Esa Hyytiä <ehyytia@cc.hut.fi>)
+0 string XBEH XBE, Microsoft Xbox executable
+# probabilistic checks whether signed or not
+>0x0004 ulelong =0x0
+>>&2 ulelong =0x0
+>>>&2 ulelong =0x0 \b, not signed
+>0x0004 ulelong >0
+>>&2 ulelong >0
+>>>&2 ulelong >0 \b, signed
+# expect base address of 0x10000
+>0x0104 ulelong =0x10000
+>>(0x0118-0x0FF60) ulelong&0x80000007 0x80000007 \b, all regions
+>>(0x0118-0x0FF60) ulelong&0x80000007 !0x80000007
+>>>(0x0118-0x0FF60) ulelong >0 (regions:
+>>>>(0x0118-0x0FF60) ulelong &0x00000001 NA
+>>>>(0x0118-0x0FF60) ulelong &0x00000002 Japan
+>>>>(0x0118-0x0FF60) ulelong &0x00000004 Rest_of_World
+>>>>(0x0118-0x0FF60) ulelong &0x80000000 Manufacturer
+>>>(0x0118-0x0FF60) ulelong >0 \b)
+
+# --------------------------------
+# Microsoft Xbox data file formats
+0 string XIP0 XIP, Microsoft Xbox data
+0 string XTF0 XTF, Microsoft Xbox data
diff --git a/contrib/file/Magdir/dact b/contrib/file/Magdir/dact
new file mode 100644
index 0000000..5cca8d9
--- /dev/null
+++ b/contrib/file/Magdir/dact
@@ -0,0 +1,10 @@
+
+#------------------------------------------------------------------------------
+# dact: file(1) magic for DACT compressed files
+#
+0 long 0x444354C3 DACT compressed data
+>4 byte >-1 (version %i.
+>5 byte >-1 $BS%i.
+>6 byte >-1 $BS%i)
+>7 long >0 $BS, original size: %i bytes
+>15 long >30 $BS, block size: %i bytes
diff --git a/contrib/file/Magdir/database b/contrib/file/Magdir/database
index 9d5fe19..f31aee5 100644
--- a/contrib/file/Magdir/database
+++ b/contrib/file/Magdir/database
@@ -78,3 +78,126 @@
0 string root\0 ROOT file
>4 belong x Version %d
>33 belong x (Compression: %d)
+
+# XXX: Weak magic.
+# Alex Ott <ott@jet.msk.su>
+## Paradox file formats
+#2 leshort 0x0800 Paradox
+#>0x39 byte 3 v. 3.0
+#>0x39 byte 4 v. 3.5
+#>0x39 byte 9 v. 4.x
+#>0x39 byte 10 v. 5.x
+#>0x39 byte 11 v. 5.x
+#>0x39 byte 12 v. 7.x
+#>>0x04 byte 0 indexed .DB data file
+#>>0x04 byte 1 primary index .PX file
+#>>0x04 byte 2 non-indexed .DB data file
+#>>0x04 byte 3 non-incrementing secondary index .Xnn file
+#>>0x04 byte 4 secondary index .Ynn file
+#>>0x04 byte 5 incrementing secondary index .Xnn file
+#>>0x04 byte 6 non-incrementing secondary index .XGn file
+#>>0x04 byte 7 secondary index .YGn file
+#>>>0x04 byte 8 incrementing secondary index .XGn file
+## XBase database files
+#0 byte 0x02
+#>8 leshort >0
+#>>12 leshort 0 FoxBase
+#>>>0x04 lelong 0 (no records)
+#>>>0x04 lelong >0 (%ld records)
+#
+#0 byte 0x03
+#>8 leshort >0
+#>>12 leshort 0 FoxBase+, FoxPro, dBaseIII+, dBaseIV, no memo
+#>>>0x04 lelong 0 (no records)
+#>>>0x04 lelong >0 (%ld records)
+#
+#0 byte 0x04
+#>8 leshort >0
+#>>12 leshort 0 dBASE IV no memo file
+#>>>0x04 lelong 0 (no records)
+#>>>0x04 lelong >0 (%ld records)
+#
+#0 byte 0x05
+#>8 leshort >0
+#>>12 leshort 0 dBASE V no memo file
+#>>>0x04 lelong 0 (no records)
+#>>>0x04 lelong >0 (%ld records)
+#
+#0 byte 0x30
+#>8 leshort >0
+#>>12 leshort 0 Visual FoxPro
+#>>>0x04 lelong 0 (no records)
+#>>>0x04 lelong >0 (%ld records)
+#
+#0 byte 0x43
+#>8 leshort >0
+#>>12 leshort 0 FlagShip with memo var size
+#>>>0x04 lelong 0 (no records)
+#>>>0x04 lelong >0 (%ld records)
+#
+#0 byte 0x7b
+#>8 leshort >0
+#>>12 leshort 0 dBASEIV with memo
+#>>>0x04 lelong 0 (no records)
+#>>>0x04 lelong >0 (%ld records)
+#
+#0 byte 0x83
+#>8 leshort >0
+#>>12 leshort 0 FoxBase+, dBaseIII+ with memo
+#>>>0x04 lelong 0 (no records)
+#>>>0x04 lelong >0 (%ld records)
+#
+#0 byte 0x8b
+#>8 leshort >0
+#>>12 leshort 0 dBaseIV with memo
+#>>>0x04 lelong 0 (no records)
+#>>>0x04 lelong >0 (%ld records)
+#
+#0 byte 0x8e
+#>8 leshort >0
+#>>12 leshort 0 dBaseIV with SQL Table
+#>>>0x04 lelong 0 (no records)
+#>>>0x04 lelong >0 (%ld records)
+#
+#0 byte 0xb3
+#>8 leshort >0
+#>>12 leshort 0 FlagShip with .dbt memo
+#>>>0x04 lelong 0 (no records)
+#>>>0x04 lelong >0 (%ld records)
+#
+#0 byte 0xf5
+#>8 leshort >0
+#>>12 leshort 0 FoxPro with memo
+#>>>0x04 lelong 0 (no records)
+#>>>0x04 lelong >0 (%ld records)
+#
+#0 leshort 0x0006 DBase 3 index file
+
+# MS Access database
+4 string Standard\ Jet\ DB Microsoft Access Database
+
+# TDB database from Samba et al - Martin Pool <mbp@samba.org>
+0 string TDB\ file TDB database
+>32 lelong 0x2601196D version 6, little-endian
+>>36 lelong x hash size %d bytes
+
+# SE Linux policy database
+0 lelong 0xf97cff8c SE Linux policy
+>16 lelong x v%d
+>20 lelong 1 MLS
+>24 lelong x %d symbols
+>28 lelong x %d ocons
+
+# ICE authority file data (Wolfram Kleff)
+2 string ICE ICE authority data
+
+# X11 Xauthority file (Wolfram Kleff)
+10 string MIT-MAGIC-COOKIE-1 X11 Xauthority data
+11 string MIT-MAGIC-COOKIE-1 X11 Xauthority data
+12 string MIT-MAGIC-COOKIE-1 X11 Xauthority data
+13 string MIT-MAGIC-COOKIE-1 X11 Xauthority data
+14 string MIT-MAGIC-COOKIE-1 X11 Xauthority data
+15 string MIT-MAGIC-COOKIE-1 X11 Xauthority data
+16 string MIT-MAGIC-COOKIE-1 X11 Xauthority data
+17 string MIT-MAGIC-COOKIE-1 X11 Xauthority data
+18 string MIT-MAGIC-COOKIE-1 X11 Xauthority data
diff --git a/contrib/file/Magdir/diff b/contrib/file/Magdir/diff
index 81a9b82..9e65146 100644
--- a/contrib/file/Magdir/diff
+++ b/contrib/file/Magdir/diff
@@ -6,8 +6,3 @@
0 string ***\ 'diff' output text
0 string Only\ in\ 'diff' output text
0 string Common\ subdirectories:\ 'diff' output text
-
-# xdelta is like diff(1) for binary files (works for text, too).
-# Available from: ftp://ftp.xcf.berkeley.edu/pub/xdelta/
-0 string %XDZ xdelta diff file
->4 string >% version %.3s
diff --git a/contrib/file/Magdir/elf b/contrib/file/Magdir/elf
index bac7f71..10aac06 100644
--- a/contrib/file/Magdir/elf
+++ b/contrib/file/Magdir/elf
@@ -12,9 +12,14 @@
>4 byte 0 invalid class
>4 byte 1 32-bit
# only for MIPS - in the future, the ABI field of e_flags should be used.
+>>18 leshort 8
+>>>36 lelong &0x20 N32
+>>18 leshort 10
+>>>36 lelong &0x20 N32
>>18 beshort 8
+>>>36 belong &0x20 N32
>>18 beshort 10
->>>36 belong &0x20 N32
+>>>36 belong &0x20 N32
>4 byte 2 64-bit
>5 byte 0 invalid byte order
>5 byte 1 LSB
@@ -77,12 +82,14 @@
>>18 leshort 17 Fujitsu VPP500,
>>18 leshort 18 SPARC32PLUS,
>>18 leshort 20 PowerPC,
+>>18 leshort 22 IBM S/390,
>>18 leshort 36 NEC V800,
>>18 leshort 37 Fujitsu FR20,
>>18 leshort 38 TRW RH-32,
>>18 leshort 39 Motorola RCE,
>>18 leshort 40 ARM,
>>18 leshort 41 Alpha,
+>>18 leshort 0xa390 IBM S/390 (obsolete),
>>18 leshort 42 Hitachi SH,
>>18 leshort 43 SPARC V9 - invalid byte order,
>>18 leshort 44 Siemens Tricore Embedded Processor,
@@ -162,6 +169,7 @@
>>>36 belong&0xffff00 &0x000800 Sun UltraSPARC3 Extensions Required,
>>18 beshort 20 PowerPC or cisco 4500,
>>18 beshort 21 cisco 7500,
+>>18 beshort 22 IBM S/390,
>>18 beshort 24 cisco SVIP,
>>18 beshort 25 cisco 7200,
>>18 beshort 36 NEC V800 or cisco 12000,
@@ -186,10 +194,14 @@
>>18 beshort 75 Digital VAX,
>>18 beshort 97 NatSemi 32k,
>>18 beshort 0x9026 Alpha (unofficial),
+>>18 beshort 0xa390 IBM S/390 (obsolete),
>>20 belong 0 invalid version
>>20 belong 1 version 1
>>36 belong 1 MathCoPro/FPU/MAU Required
->8 string >\0 (%s)
+# Up to now only 0, 1 and 2 are defined; I've seen a file with 0x83, it seemed
+# like proper ELF, but extracting the string had bad results.
+>4 byte <0x80
+>>8 string >\0 (%s)
>8 string \0
>>7 byte 0 (SYSV)
>>7 byte 1 (HP-UX)
diff --git a/contrib/file/Magdir/fcs b/contrib/file/Magdir/fcs
new file mode 100644
index 0000000..ac4b02c
--- /dev/null
+++ b/contrib/file/Magdir/fcs
@@ -0,0 +1,8 @@
+
+#------------------------------------------------------------------------------
+# fcs: file(1) magic for FCS (Flow Cytometry Standard) data files
+# From Roger Leigh <roger@whinlatter.uklinux.net>
+0 string FCS1.0 Flow Cytometry Standard (FCS) data, version 1.0
+0 string FCS2.0 Flow Cytometry Standard (FCS) data, version 2.0
+0 string FCS3.0 Flow Cytometry Standard (FCS) data, version 3.0
+
diff --git a/contrib/file/Magdir/filesystems b/contrib/file/Magdir/filesystems
index f34c823..c798525 100644
--- a/contrib/file/Magdir/filesystems
+++ b/contrib/file/Magdir/filesystems
@@ -205,8 +205,8 @@
# SGI XFS filesystem - Nathan Scott <nathans@debian.org>
0 belong 0x58465342 SGI XFS filesystem data
->0x4 belong x (blksz=3D%d,
->0x68 beshort x inosz=3D%d,
+>0x4 belong x (blksz %d,
+>0x68 beshort x inosz %d,
>0x64 beshort ^0x2004 v1 dirs)
>0x64 beshort &0x2004 v2 dirs)
@@ -276,5 +276,62 @@
# CDROM Filesystems
32769 string CD001 ISO 9660 CD-ROM filesystem data
+# "application id" which appears to be used as a volume label
+>32808 string >\0 '%s'
+>34816 string \000CD001\001EL\ TORITO\ SPECIFICATION (bootable)
37633 string CD001 ISO 9660 CD-ROM filesystem data (raw 2352 byte sectors)
32776 string CDROM High Sierra CD-ROM filesystem data
+
+# cramfs filesystem - russell@coker.com.au
+0 lelong 0x28cd3d45 Linux Compressed ROM File System data, little endian
+>4 lelong x size %d
+>8 lelong &1 version #2
+>8 lelong &2 sorted_dirs
+>8 lelong &4 hole_support
+>32 lelong x CRC 0x%x,
+>36 lelong x edition %d,
+>40 lelong x %d blocks,
+>44 lelong x %d files
+
+0 belong 0x28cd3d45 Linux Compressed ROM File System data, big endian
+>4 belong x size %d
+>8 belong &1 version #2
+>8 belong &2 sorted_dirs
+>8 belong &4 hole_support
+>32 belong x CRC 0x%x,
+>36 belong x edition %d,
+>40 belong x %d blocks,
+>44 belong x %d files
+
+# reiserfs - russell@coker.com.au
+0x10034 string ReIsErFs ReiserFS V3.5
+0x10034 string ReIsEr2Fs ReiserFS V3.6
+>0x1002c leshort x block size %d
+>0x10032 leshort &2 (mounted or unclean)
+>0x10000 lelong x num blocks %d
+>0x10040 lelong 1 tea hash
+>0x10040 lelong 2 yura hash
+>0x10040 lelong 3 r5 hash
+
+# JFFS - russell@coker.com.au
+0 lelong 0x34383931 Linux Journalled Flash File system, little endian
+0 belong 0x34383931 Linux Journalled Flash File system, big endian
+
+# EST flat binary format (which isn't, but anyway)
+# From: Mark Brown <broonie@sirena.org.uk>
+0 string ESTFBINR EST flat binary
+
+# Aculab VoIP firmware
+# From: Mark Brown <broonie@sirena.org.uk>
+0 string VoIP\ Startup\ and Aculab VoIP firmware
+>35 string x format %s
+
+# PPCBoot image file
+# From: Mark Brown <broonie@sirena.org.uk>
+0 belong 0x27051956 PPCBoot image
+>4 string PPCBoot
+>>12 string x version %s
+
+# JFFS2 file system
+0 leshort 0x1984 Linux old jffs2 filesystem data little endian
+0 lelong 0xe0011985 Linux jffs2 filesystem data little endian
diff --git a/contrib/file/Magdir/flash b/contrib/file/Magdir/flash
index 0db9bfe..2f343d8 100644
--- a/contrib/file/Magdir/flash
+++ b/contrib/file/Magdir/flash
@@ -8,6 +8,8 @@
#
0 string FWS Macromedia Flash data,
>3 byte x version %d
+0 string CWS Macromedia Flash data (compressed),
+>3 byte x version %d
#
# From Dave Wilson
0 string AGD4\xbe\xb8\xbb\xcb\x00 Macromedia Freehand 9 Document
diff --git a/contrib/file/Magdir/fonts b/contrib/file/Magdir/fonts
index d0dc225..6a1ad34 100644
--- a/contrib/file/Magdir/fonts
+++ b/contrib/file/Magdir/fonts
@@ -7,9 +7,9 @@
0 short 017001 byte-swapped Berkeley vfont data
# PostScript fonts (must precede "printer" entries), quinlan@yggdrasil.com
-0 string %!PS-AdobeFont-1.0 PostScript Type 1 font text
+0 string %!PS-AdobeFont-1. PostScript Type 1 font text
>20 string >\0 (%s)
-6 string %!PS-AdobeFont-1.0 PostScript Type 1 font program data
+6 string %!PS-AdobeFont-1. PostScript Type 1 font program data
# X11 font files in SNF (Server Natural Format) format
0 belong 00000004 X11 SNF font data, MSB first
@@ -49,3 +49,13 @@
# downloadable fonts for browser (prints type) anthon@mnt.org
0 string PFR1 PFR1 font
>102 string >0 \b: %s
+
+# True Type fonts
+0 string \000\001\000\000\000 TrueType font data
+
+0 string \007\001\001\000Copyright\ (c)\ 199 Adobe Multiple Master font
+0 string \012\001\001\000Copyright\ (c)\ 199 Adobe Multiple Master font
+
+# Opentype font data from Avi Bercovich
+0 string OTTO OpenType font data
+
diff --git a/contrib/file/Magdir/games b/contrib/file/Magdir/games
new file mode 100644
index 0000000..2dc17da
--- /dev/null
+++ b/contrib/file/Magdir/games
@@ -0,0 +1,157 @@
+#------------------------------------------------------------------------------
+# games: file(1) for games
+
+# Thomas M. Ott (ThMO)
+1 string =WAD DOOM data,
+>0 string =I main wad
+>0 string =P patch wad
+>0 byte x unknown junk
+
+# Fabio Bonelli <fabiobonelli@libero.it>
+# Quake II - III data files
+0 string IDP2 Quake II 3D Model file,
+>20 long x %lu skin(s),
+>8 long x (%lu x
+>12 long x %lu),
+>40 long x %lu frame(s),
+>16 long x Frame size %lu bytes,
+>24 long x %lu vertices/frame,
+>28 long x %lu texture coordinates,
+>32 long x %lu triangles/frame
+
+0 string IBSP Quake
+>4 long 0x26 II Map file (BSP)
+>4 long 0x2E III Map file (BSP)
+
+0 string IDS2 Quake II SP2 sprite file
+
+#---------------------------------------------------------------------------
+# Doom and Quake
+# submitted by Nicolas Patrois
+
+# DOOM
+
+0 string IWAD DOOM or DOOM ][ world
+0 string PWAD DOOM or DOOM ][ extension world
+
+0 string \xcb\x1dBoom\xe6\xff\x03\x01 Boom or linuxdoom demo
+# some doom lmp files don't match, I've got one beginning with \x6d\x02\x01\x01
+
+24 string LxD\ 203 Linuxdoom save
+>0 string x , name=%s
+>44 string x , world=%s
+
+# Quake
+
+0 string PACK Quake I or II world or extension
+
+#0 string -1\x0a Quake I demo
+#>30 string x version %.4s
+#>61 string x level %s
+
+#0 string 5\x0a Quake I save
+
+# The levels
+
+# Quake 1
+
+0 string 5\x0aIntroduction Quake I save: start Introduction
+0 string 5\x0athe_Slipgate_Complex Quake I save: e1m1 The slipgate complex
+0 string 5\x0aCastle_of_the_Damned Quake I save: e1m2 Castle of the damned
+0 string 5\x0athe_Necropolis Quake I save: e1m3 The necropolis
+0 string 5\x0athe_Grisly_Grotto Quake I save: e1m4 The grisly grotto
+0 string 5\x0aZiggurat_Vertigo Quake I save: e1m8 Ziggurat vertigo (secret)
+0 string 5\x0aGloom_Keep Quake I save: e1m5 Gloom keep
+0 string 5\x0aThe_Door_To_Chthon Quake I save: e1m6 The door to Chthon
+0 string 5\x0aThe_House_of_Chthon Quake I save: e1m7 The house of Chthon
+0 string 5\x0athe_Installation Quake I save: e2m1 The installation
+0 string 5\x0athe_Ogre_Citadel Quake I save: e2m2 The ogre citadel
+0 string 5\x0athe_Crypt_of_Decay Quake I save: e2m3 The crypt of decay (dopefish lives!)
+0 string 5\x0aUnderearth Quake I save: e2m7 Underearth (secret)
+0 string 5\x0athe_Ebon_Fortress Quake I save: e2m4 The ebon fortress
+0 string 5\x0athe_Wizard's_Manse Quake I save: e2m5 The wizard's manse
+0 string 5\x0athe_Dismal_Oubliette Quake I save: e2m6 The dismal oubliette
+0 string 5\x0aTermination_Central Quake I save: e3m1 Termination central
+0 string 5\x0aVaults_of_Zin Quake I save: e3m2 Vaults of Zin
+0 string 5\x0athe_Tomb_of_Terror Quake I save: e3m3 The tomb of terror
+0 string 5\x0aSatan's_Dark_Delight Quake I save: e3m4 Satan's dark delight
+0 string 5\x0athe_Haunted_Halls Quake I save: e3m7 The haunted halls (secret)
+0 string 5\x0aWind_Tunnels Quake I save: e3m5 Wind tunnels
+0 string 5\x0aChambers_of_Torment Quake I save: e3m6 Chambers of torment
+0 string 5\x0athe_Sewage_System Quake I save: e4m1 The sewage system
+0 string 5\x0aThe_Tower_of_Despair Quake I save: e4m2 The tower of despair
+0 string 5\x0aThe_Elder_God_Shrine Quake I save: e4m3 The elder god shrine
+0 string 5\x0athe_Palace_of_Hate Quake I save: e4m4 The palace of hate
+0 string 5\x0aHell's_Atrium Quake I save: e4m5 Hell's atrium
+0 string 5\x0athe_Nameless_City Quake I save: e4m8 The nameless city (secret)
+0 string 5\x0aThe_Pain_Maze Quake I save: e4m6 The pain maze
+0 string 5\x0aAzure_Agony Quake I save: e4m7 Azure agony
+0 string 5\x0aShub-Niggurath's_Pit Quake I save: end Shub-Niggurath's pit
+
+# Quake DeathMatch levels
+
+0 string 5\x0aPlace_of_Two_Deaths Quake I save: dm1 Place of two deaths
+0 string 5\x0aClaustrophobopolis Quake I save: dm2 Claustrophobopolis
+0 string 5\x0aThe_Abandoned_Base Quake I save: dm3 The abandoned base
+0 string 5\x0aThe_Bad_Place Quake I save: dm4 The bad place
+0 string 5\x0aThe_Cistern Quake I save: dm5 The cistern
+0 string 5\x0aThe_Dark_Zone Quake I save: dm6 The dark zone
+
+# Scourge of Armagon
+
+0 string 5\x0aCommand_HQ Quake I save: start Command HQ
+0 string 5\x0aThe_Pumping_Station Quake I save: hip1m1 The pumping station
+0 string 5\x0aStorage_Facility Quake I save: hip1m2 Storage facility
+0 string 5\x0aMilitary_Complex Quake I save: hip1m5 Military complex (secret)
+0 string 5\x0athe_Lost_Mine Quake I save: hip1m3 The lost mine
+0 string 5\x0aResearch_Facility Quake I save: hip1m4 Research facility
+0 string 5\x0aAncient_Realms Quake I save: hip2m1 Ancient realms
+0 string 5\x0aThe_Gremlin's_Domain Quake I save: hip2m6 The gremlin's domain (secret)
+0 string 5\x0aThe_Black_Cathedral Quake I save: hip2m2 The black cathedral
+0 string 5\x0aThe_Catacombs Quake I save: hip2m3 The catacombs
+0 string 5\x0athe_Crypt__ Quake I save: hip2m4 The crypt
+0 string 5\x0aMortum's_Keep Quake I save: hip2m5 Mortum's keep
+0 string 5\x0aTur_Torment Quake I save: hip3m1 Tur torment
+0 string 5\x0aPandemonium Quake I save: hip3m2 Pandemonium
+0 string 5\x0aLimbo Quake I save: hip3m3 Limbo
+0 string 5\x0athe_Edge_of_Oblivion Quake I save: hipdm1 The edge of oblivion (secret)
+0 string 5\x0aThe_Gauntlet Quake I save: hip3m4 The gauntlet
+0 string 5\x0aArmagon's_Lair Quake I save: hipend Armagon's lair
+
+# Malice
+
+0 string 5\x0aThe_Academy Quake I save: start The academy
+0 string 5\x0aThe_Lab Quake I save: d1 The lab
+0 string 5\x0aArea_33 Quake I save: d1b Area 33
+0 string 5\x0aSECRET_MISSIONS Quake I save: d3b Secret missions
+0 string 5\x0aThe_Hospital Quake I save: d10 The hospital (secret)
+0 string 5\x0aThe_Genetics_Lab Quake I save: d11 The genetics lab (secret)
+0 string 5\x0aBACK_2_MALICE Quake I save: d4b Back to Malice
+0 string 5\x0aArea44 Quake I save: d1c Area 44
+0 string 5\x0aTakahiro_Towers Quake I save: d2 Takahiro towers
+0 string 5\x0aA_Rat's_Life Quake I save: d3 A rat's life
+0 string 5\x0aInto_The_Flood Quake I save: d4 Into the flood
+0 string 5\x0aThe_Flood Quake I save: d5 The flood
+0 string 5\x0aNuclear_Plant Quake I save: d6 Nuclear plant
+0 string 5\x0aThe_Incinerator_Plant Quake I save: d7 The incinerator plant
+0 string 5\x0aThe_Foundry Quake I save: d7b The foundry
+0 string 5\x0aThe_Underwater_Base Quake I save: d8 The underwater base
+0 string 5\x0aTakahiro_Base Quake I save: d9 Takahiro base
+0 string 5\x0aTakahiro_Laboratories Quake I save: d12 Takahiro laboratories
+0 string 5\x0aStayin'_Alive Quake I save: d13 Stayin' alive
+0 string 5\x0aB.O.S.S._HQ Quake I save: d14 B.O.S.S. HQ
+0 string 5\x0aSHOWDOWN! Quake I save: d15 Showdown!
+
+# Malice DeathMatch levels
+
+0 string 5\x0aThe_Seventh_Precinct Quake I save: ddm1 The seventh precinct
+0 string 5\x0aSub_Station Quake I save: ddm2 Sub station
+0 string 5\x0aCrazy_Eights! Quake I save: ddm3 Crazy eights!
+0 string 5\x0aEast_Side_Invertationa Quake I save: ddm4 East side invertationa
+0 string 5\x0aSlaughterhouse Quake I save: ddm5 Slaughterhouse
+0 string 5\x0aDOMINO Quake I save: ddm6 Domino
+0 string 5\x0aSANDRA'S_LADDER Quake I save: ddm7 Sandra's ladder
+
+
+0 string MComprHD MAME CHD compressed hard disk image,
+>12 belong x version %lu
diff --git a/contrib/file/Magdir/gcc b/contrib/file/Magdir/gcc
new file mode 100644
index 0000000..ee726f3
--- /dev/null
+++ b/contrib/file/Magdir/gcc
@@ -0,0 +1,16 @@
+
+#------------------------------------------------------------------------------
+# gcc: file(1) magic for GCC special files
+#
+0 string gpch GCC precompiled header
+
+# The version field is annoying. It's 3 characters, not zero-terminated.
+>5 byte x (version %c
+>6 byte x \b%c
+>7 byte x \b%c)
+
+# 67 = 'C', 111 = 'o', 43 = '+', 79 = 'O'
+>4 byte 67 for C
+>4 byte 111 for Objective C
+>4 byte 43 for C++
+>4 byte 79 for Objective C++
diff --git a/contrib/file/Magdir/geos b/contrib/file/Magdir/geos
new file mode 100644
index 0000000..af1df7b
--- /dev/null
+++ b/contrib/file/Magdir/geos
@@ -0,0 +1,19 @@
+
+#------------------------------------------------------------------------------
+# GEOS files (Vidar Madsen, vidar@gimp.org)
+# semi-commonly used in embedded and handheld systems.
+0 belong 0xc745c153 GEOS
+>40 byte 1 executable
+>40 byte 2 VMFile
+>40 byte 3 binary
+>40 byte 4 directory label
+>40 byte <1 unknown
+>40 byte >4 unknown
+>4 string >\0 \b, name "%s"
+#>44 short x \b, version %d
+#>46 short x \b.%d
+#>48 short x \b, rev %d
+#>50 short x \b.%d
+#>52 short x \b, proto %d
+#>54 short x \br%d
+#>168 string >\0 \b, copyright "%s"
diff --git a/contrib/file/Magdir/gnu b/contrib/file/Magdir/gnu
index a385fc9..99b9830 100644
--- a/contrib/file/Magdir/gnu
+++ b/contrib/file/Magdir/gnu
@@ -10,3 +10,15 @@
# message catalogs, from Mitchum DSouza <m.dsouza@mrc-apu.cam.ac.uk>
0 string *nazgul* Nazgul style compiled message catalog
>8 lelong >0 \b, version %ld
+# GnuPG
+# The format is very similar to pgp
+0 string \001gpg GPG key trust database
+>4 byte x version %d
+0 beshort 0x9901 GPG key public ring
+# This magic is not particularly good, as the keyrings don't have true
+# magic. Nevertheless, it covers many keyrings.
+
+# Gnumeric spreadsheet
+# This entry is only semi-helpful, as Gnumeric compresses its files, so
+# they will ordinarily reported as "compressed", but at least -z helps
+39 string =<gmr:Workbook Gnumeric spreadsheet
diff --git a/contrib/file/Magdir/human68k b/contrib/file/Magdir/human68k
index 0ac82a7..d8070f7 100644
--- a/contrib/file/Magdir/human68k
+++ b/contrib/file/Magdir/human68k
@@ -1,25 +1,25 @@
#------------------------------------------------------------------------------
# human68k: file(1) magic for Human68k (X680x0 DOS) binary formats
-
-0 string HU Human68k
->68 string LZX LZX compressed
->>72 string >\0 (version %s)
->(8.L+74) string LZX LZX compressed
->>(8.L+78) string >\0 (version %s)
->60 belong >0 binded
->(8.L+66) string #HUPAIR hupair
->0 string HU X executable
->(8.L+74) string #LIBCV1 - linked PD LIBC ver 1
->4 belong >0 - base address 0x%x
->28 belong >0 not stripped
->32 belong >0 with debug information
-0 beshort 0x601a Human68k Z executable
-0 beshort 0x6000 Human68k object file
-0 belong 0xd1000000 Human68k ar binary archive
-0 belong 0xd1010000 Human68k ar ascii archive
-0 beshort 0x0068 Human68k lib archive
-4 string LZX Human68k LZX compressed
->8 string >\0 (version %s)
->4 string LZX R executable
-2 string #HUPAIR Human68k hupair R executable
+# Magic too short!
+#0 string HU Human68k
+#>68 string LZX LZX compressed
+#>>72 string >\0 (version %s)
+#>(8.L+74) string LZX LZX compressed
+#>>(8.L+78) string >\0 (version %s)
+#>60 belong >0 binded
+#>(8.L+66) string #HUPAIR hupair
+#>0 string HU X executable
+#>(8.L+74) string #LIBCV1 - linked PD LIBC ver 1
+#>4 belong >0 - base address 0x%x
+#>28 belong >0 not stripped
+#>32 belong >0 with debug information
+#0 beshort 0x601a Human68k Z executable
+#0 beshort 0x6000 Human68k object file
+#0 belong 0xd1000000 Human68k ar binary archive
+#0 belong 0xd1010000 Human68k ar ascii archive
+#0 beshort 0x0068 Human68k lib archive
+#4 string LZX Human68k LZX compressed
+#>8 string >\0 (version %s)
+#>4 string LZX R executable
+#2 string #HUPAIR Human68k hupair R executable
diff --git a/contrib/file/Magdir/ibm6000 b/contrib/file/Magdir/ibm6000
index 8e1077b..6870c31 100644
--- a/contrib/file/Magdir/ibm6000
+++ b/contrib/file/Magdir/ibm6000
@@ -15,3 +15,5 @@
0 string 0xabcdef AIX message catalog
0 belong 0x000001f9 AIX compiled message catalog
0 string \<aiaff> archive
+0 string \<bigaf> archive (big format)
+
diff --git a/contrib/file/Magdir/iff b/contrib/file/Magdir/iff
index 68d1b79..334d71e 100644
--- a/contrib/file/Magdir/iff
+++ b/contrib/file/Magdir/iff
@@ -16,6 +16,8 @@
>8 string AIFC \b, AIFF-C compressed audio
>8 string 8SVX \b, 8SVX 8-bit sampled sound voice
>8 string SAMP \b, SAMP sampled audio
+>8 string DTYP \b, DTYP datatype description
+>8 string PTCH \b, PTCH binary patch
# image formats
>8 string ILBMBMHD \b, ILBM interleaved image
>>20 beshort x \b, %d x
@@ -26,3 +28,5 @@
>8 string TDDD \b, TDDD 3-D rendering
# other formats
>8 string FTXT \b, FTXT formatted text
+>8 string CTLG \b, CTLG message catalog
+>8 string PREF \b, PREF preferences
diff --git a/contrib/file/Magdir/images b/contrib/file/Magdir/images
index 27a38eb..b992a92 100644
--- a/contrib/file/Magdir/images
+++ b/contrib/file/Magdir/images
@@ -17,10 +17,16 @@
# `tgatoppm' recognizes a superset (Index may be anything)
1 belong&0xfff7ffff 0x01010000 Targa image data - Map
>2 byte&8 8 - RLE
+>12 leshort >0 %hd x
+>14 leshort >0 %hd
1 belong&0xfff7ffff 0x00020000 Targa image data - RGB
>2 byte&8 8 - RLE
+>12 leshort >0 %hd x
+>14 leshort >0 %hd
1 belong&0xfff7ffff 0x00030000 Targa image data - Mono
>2 byte&8 8 - RLE
+>12 leshort >0 %hd x
+>14 leshort >0 %hd
# PBMPLUS images
# The next byte following the magic is always whitespace.
@@ -158,10 +164,11 @@
>>18 lelong x \b, %d x
>>22 lelong x %d x
>>28 leshort x %d
-0 string IC PC icon data
-0 string PI PC pointer image data
-0 string CI PC color icon data
-0 string CP PC color pointer image data
+# Too simple - MPi
+#0 string IC PC icon data
+#0 string PI PC pointer image data
+#0 string CI PC color icon data
+#0 string CP PC color pointer image data
# Conflicts with other entries [BABYL]
#0 string BA PC bitmap array data
@@ -269,11 +276,11 @@
# DICOM medical imaging data
128 string DICM DICOM medical imaging data
-# XWD - X-Windows Dump file.
+# XWD - X Window Dump file.
# As described in /usr/X11R6/include/X11/XWDFile.h
# used by the xwd program.
# Bradford Castalia, idaeim, 1/01
-4 belong 7 XWD X-Windows Dump image data
+4 belong 7 XWD X Window Dump image data
>100 string >\0 \b, "%s"
>16 belong x \b, %dx
>20 belong x \b%dx
@@ -359,3 +366,156 @@
>>14 leshort x %hd dpi,
>2 byte 0 uncompressed
>2 byte 1 RLE compressed
+
+# Adobe Photoshop
+0 string 8BPS Adobe Photoshop Image
+
+# XV thumbnail indicator (ThMO)
+0 string P7\ 332 XV thumbnail image data
+
+# NITF is defined by United States MIL-STD-2500A
+0 string NITF National Imagery Transmission Format
+>25 string >\0 dated %.14s
+
+# GEM Image: Version 1, Headerlen 8 (Wolfram Kleff)
+0 belong 0x00010008 GEM Image data
+>12 beshort x %d x
+>14 beshort x %d,
+>4 beshort x %d planes,
+>8 beshort x %d x
+>10 beshort x %d pixelsize
+
+# GEM Metafile (Wolfram Kleff)
+0 lelong 0x0018FFFF GEM Metafile data
+>4 leshort x version %d
+
+#
+# SMJPEG. A custom Motion JPEG format used by Loki Entertainment
+# Software Torbjorn Andersson <d91tan@Update.UU.SE>.
+#
+0 string \0\nSMJPEG SMJPEG
+>8 belong x %d.x data
+# According to the specification you could find any number of _TXT
+# headers here, but I can't think of any way of handling that. None of
+# the SMJPEG files I tried it on used this feature. Even if such a
+# file is encountered the output should still be reasonable.
+>16 string _SND \b,
+>>24 beshort >0 %d Hz
+>>26 byte 8 8-bit
+>>26 byte 16 16-bit
+>>28 string NONE uncompressed
+# >>28 string APCM ADPCM compressed
+>>27 byte 1 mono
+>>28 byte 2 stereo
+# Help! Isn't there any way to avoid writing this part twice?
+>>32 string _VID \b,
+# >>>48 string JFIF JPEG
+>>>40 belong >0 %d frames
+>>>44 beshort >0 (%d x
+>>>46 beshort >0 %d)
+>16 string _VID \b,
+# >>32 string JFIF JPEG
+>>24 belong >0 %d frames
+>>28 beshort >0 (%d x
+>>30 beshort >0 %d)
+
+0 string Paint\ Shop\ Pro\ Image\ File Paint Shop Pro Image File
+
+# "thumbnail file" (icon)
+# descended from "xv", but in use by other applications as well (Wolfram Kleff)
+0 string P7\ 332 XV "thumbnail file" (icon) data
+
+# taken from fkiss: (<yav@mte.biglobe.ne.jp> ?)
+0 string KiSS KISS/GS
+>4 byte 16 color
+>>5 byte x %d bit
+>>8 leshort x %d colors
+>>10 leshort x %d groups
+>4 byte 32 cell
+>>5 byte x %d bit
+>>8 leshort x %d x
+>>10 leshort x %d
+>>12 leshort x +%d
+>>14 leshort x +%d
+
+# Webshots (www.webshots.com), by John Harrison
+0 string C\253\221g\230\0\0\0 Webshots Desktop .wbz file
+
+# Hercules DASD image files
+# From Jan Jaeger <jj@septa.nl>
+0 string CKD_P370 Hercules CKD DASD image file
+>8 long x \b, %d heads per cylinder
+>12 long x \b, track size %d bytes
+>16 byte x \b, device type 33%2.2X
+
+0 string CKD_C370 Hercules compressed CKD DASD image file
+>8 long x \b, %d heads per cylinder
+>12 long x \b, track size %d bytes
+>16 byte x \b, device type 33%2.2X
+
+0 string CKD_S370 Hercules CKD DASD shadow file
+>8 long x \b, %d heads per cylinder
+>12 long x \b, track size %d bytes
+>16 byte x \b, device type 33%2.2X
+
+# Squeak images and - etoffi@softhome.net
+0 string \146\031\0\0 Squeak image data
+0 string 'From\040Squeak Squeak program text
+
+# partimage: file(1) magic for PartImage files (experimental, incomplete)
+# Author: Hans-Joachim Baader <hjb@pro-linux.de>
+0 string PaRtImAgE-VoLuMe PartImage
+>0x0020 string 0.6.1 file version %s
+>>0x0060 lelong >-1 volume %ld
+#>>0x0064 8 byte identifier
+#>>0x007c reserved
+>>0x0200 string >\0 type %s
+>>0x1400 string >\0 device %s,
+>>0x1600 string >\0 original filename %s,
+# Some fields omitted
+>>0x2744 lelong 0 not compressed
+>>0x2744 lelong 1 gzip compressed
+>>0x2744 lelong 2 bzip2 compressed
+>>0x2744 lelong >2 compressed with unknown algorithm
+>0x0020 string >0.6.1 file version %s
+>0x0020 string <0.6.1 file version %s
+
+# DCX is multi-page PCX, using a simple header of up to 1024
+# offsets for the respective PCX components.
+# From: Joerg Wunsch <joerg_wunsch@uriah.heep.sax.de>
+0 lelong 987654321 DCX multi-page PCX image data
+
+# Simon Walton <simonw@matteworld.com>
+# Kodak Cineon format for scanned negatives
+# http://www.kodak.com/US/en/motion/support/dlad/
+0 lelong 0xd75f2a80 Cineon image data
+>200 belong >0 \b, %ld x
+>204 belong >0 %ld
+
+
+# Bio-Rad .PIC is an image format used by microscope control systems
+# and related image processing software used by biologists.
+# From: Vebjorn Ljosa <vebjorn@ljosa.com>
+54 leshort 12345 Bio-Rad .PIC Image File
+>0 leshort >0 %hd x
+>2 leshort >0 %hd,
+>4 leshort =1 1 image in file
+>4 leshort >1 %hd images in file
+
+# From Jan "Yenya" Kasprzak <kas@fi.muni.cz>
+# The description of *.mrw format can be found at
+# http://www.dalibor.cz/minolta/raw_file_format.htm
+0 string \000MRM Minolta Dimage camera raw image data
+
+# From: stephane.loeuillet@tiscali.f
+# http://www.djvuzone.org/
+0 string AT&TFORM DjVu Image file
+
+# From: Jason Bacon <bacon@smithers.neuro.mcw.edu>
+0 beshort 0x3020 character Computer Graphics Metafile
+
+
+
+# From: Tom Hilinski <tom.hilinski@comcast.net>
+# http://www.unidata.ucar.edu/packages/netcdf/
+0 string CDF\001 netcdf file
diff --git a/contrib/file/Magdir/intel b/contrib/file/Magdir/intel
index d450e26..00942c2 100644
--- a/contrib/file/Magdir/intel
+++ b/contrib/file/Magdir/intel
@@ -33,3 +33,15 @@
0 leshort =0514 80386 COFF executable
>12 lelong >0 not stripped
>22 leshort >0 - version %ld
+
+# rom: file(1) magic for BIOS ROM Extensions found in intel machines
+# mapped into memory between 0xC0000 and 0xFFFFF
+# From Gürkan Sengün <gurkan@linuks.mine.nu>, www.linuks.mine.nu
+0 beshort 0x55AA BIOS (ia32) ROM Ext.
+>5 string USB USB
+>7 string LDR UNDI image
+>30 string IBM IBM comp. Video
+>26 string Adaptec Adaptec
+>28 string Adaptec Adaptec
+>42 string PROMISE Promise
+>2 byte x (%d*512)
diff --git a/contrib/file/Magdir/jpeg b/contrib/file/Magdir/jpeg
index bedc6c9..af646d6 100644
--- a/contrib/file/Magdir/jpeg
+++ b/contrib/file/Magdir/jpeg
@@ -10,22 +10,113 @@
#
0 beshort 0xffd8 JPEG image data
>6 string JFIF \b, JFIF standard
->6 string Exif \b, EXIF standard
# The following added by Erik Rossen <rossen@freesurf.ch> 1999-09-06
# in a vain attempt to add image size reporting for JFIF. Note that these
# tests are not fool-proof since some perfectly valid JPEGs are currently
# impossible to specify in magic(4) format.
# First, a little JFIF version info:
->11 byte x \b %d.
->12 byte x \b%02d
+>>11 byte x \b %d.
+>>12 byte x \b%02d
# Next, the resolution or aspect ratio of the image:
->13 byte 0 \b, aspect ratio
->13 byte 1 \b, resolution (DPI)
->13 byte 2 \b, resolution (DPCM)
-#>4 beshort x \b, segment length %d
+#>>13 byte 0 \b, aspect ratio
+#>>13 byte 1 \b, resolution (DPI)
+#>>13 byte 2 \b, resolution (DPCM)
+#>>4 beshort x \b, segment length %d
# Next, show thumbnail info, if it exists:
->18 byte !0 \b, thumbnail %dx
->>19 byte x \b%d
+>>18 byte !0 \b, thumbnail %dx
+>>>19 byte x \b%d
+
+# EXIF moved down here to avoid reporting a bogus version number,
+# and EXIF version number printing added.
+# - Patrik R=E5dman <patrik+file-magic@iki.fi>
+>6 string Exif \b, EXIF standard
+# Look for EXIF IFD offset in IFD 0, and then look for EXIF version tag in EXIF IFD.
+# All possible combinations of entries have to be enumerated, since no looping
+# is possible. And both endians are possible...
+# The combinations included below are from real-world JPEGs.
+# Little-endian
+>>12 string II
+# IFD 0 Entry #5:
+>>>70 leshort 0x8769
+# EXIF IFD Entry #1:
+>>>>(78.l+14) leshort 0x9000
+>>>>>(78.l+23) byte x %c
+>>>>>(78.l+24) byte x \b.%c
+>>>>>(78.l+25) byte !0x30 \b%c
+# IFD 0 Entry #9:
+>>>118 leshort 0x8769
+# EXIF IFD Entry #3:
+>>>>(126.l+38) leshort 0x9000
+>>>>>(126.l+47) byte x %c
+>>>>>(126.l+48) byte x \b.%c
+>>>>>(126.l+49) byte !0x30 \b%c
+# IFD 0 Entry #10
+>>>130 leshort 0x8769
+# EXIF IFD Entry #3:
+>>>>(138.l+38) leshort 0x9000
+>>>>>(138.l+47) byte x %c
+>>>>>(138.l+48) byte x \b.%c
+>>>>>(138.l+49) byte !0x30 \b%c
+# EXIF IFD Entry #4:
+>>>>(138.l+50) leshort 0x9000
+>>>>>(138.l+59) byte x %c
+>>>>>(138.l+60) byte x \b.%c
+>>>>>(138.l+61) byte !0x30 \b%c
+# EXIF IFD Entry #5:
+>>>>(138.l+62) leshort 0x9000
+>>>>>(138.l+71) byte x %c
+>>>>>(138.l+72) byte x \b.%c
+>>>>>(138.l+73) byte !0x30 \b%c
+# IFD 0 Entry #11
+>>>142 leshort 0x8769
+# EXIF IFD Entry #3:
+>>>>(150.l+38) leshort 0x9000
+>>>>>(150.l+47) byte x %c
+>>>>>(150.l+48) byte x \b.%c
+>>>>>(150.l+49) byte !0x30 \b%c
+# EXIF IFD Entry #4:
+>>>>(150.l+50) leshort 0x9000
+>>>>>(150.l+59) byte x %c
+>>>>>(150.l+60) byte x \b.%c
+>>>>>(150.l+61) byte !0x30 \b%c
+# EXIF IFD Entry #5:
+>>>>(150.l+62) leshort 0x9000
+>>>>>(150.l+71) byte x %c
+>>>>>(150.l+72) byte x \b.%c
+>>>>>(150.l+73) byte !0x30 \b%c
+# Big-endian
+>>12 string MM
+# IFD 0 Entry #9:
+>>>118 beshort 0x8769
+# EXIF IFD Entry #1:
+>>>>(126.L+14) beshort 0x9000
+>>>>>(126.L+23) byte x %c
+>>>>>(126.L+24) byte x \b.%c
+>>>>>(126.L+25) byte !0x30 \b%c
+# EXIF IFD Entry #3:
+>>>>(126.L+38) beshort 0x9000
+>>>>>(126.L+47) byte x %c
+>>>>>(126.L+48) byte x \b.%c
+>>>>>(126.L+49) byte !0x30 \b%c
+# IFD 0 Entry #10
+>>>130 beshort 0x8769
+# EXIF IFD Entry #3:
+>>>>(138.L+38) beshort 0x9000
+>>>>>(138.L+47) byte x %c
+>>>>>(138.L+48) byte x \b.%c
+>>>>>(138.L+49) byte !0x30 \b%c
+# EXIF IFD Entry #5:
+>>>>(138.L+62) beshort 0x9000
+>>>>>(138.L+71) byte x %c
+>>>>>(138.L+72) byte x \b.%c
+>>>>>(138.L+73) byte !0x30 \b%c
+# IFD 0 Entry #11
+>>>142 beshort 0x8769
+# EXIF IFD Entry #4:
+>>>>(150.L+50) beshort 0x9000
+>>>>>(150.L+59) byte x %c
+>>>>>(150.L+60) byte x \b.%c
+>>>>>(150.L+61) byte !0x30 \b%c
# Here things get sticky. We can do ONE MORE marker segment with
# indirect addressing, and that's all. It would be great if we could
# do pointer arithemetic like in an assembler language. Christos?
@@ -33,7 +124,7 @@
# named accumulators, it would be even more effective...
# At least we can show a comment if no other segments got inserted before:
>(4.S+5) byte 0xFE
->>(4.S+8) string >\0 \b, "%s"
+>>(4.S+8) string >\0 \b, comment: "%s"
#>(4.S+5) byte 0xFE \b, comment
#>>(4.S+6) beshort x \b length=%d
#>>(4.S+8) string >\0 \b, "%s"
@@ -54,8 +145,8 @@
# I've commented-out quantisation table reporting. I doubt anyone cares yet.
#>(4.S+5) byte 0xDB \b, quantisation table
#>>(4.S+6) beshort x \b length=%d
->14 beshort x \b, %d x
->16 beshort x \b %d
+#>14 beshort x \b, %d x
+#>16 beshort x \b %d
# HSI is Handmade Software's proprietary JPEG encoding scheme
0 string hsi1 JPEG image data, HSI proprietary
diff --git a/contrib/file/Magdir/linux b/contrib/file/Magdir/linux
index 4db4958..1b8961c 100644
--- a/contrib/file/Magdir/linux
+++ b/contrib/file/Magdir/linux
@@ -44,11 +44,6 @@
# this can be overridden by the DOS executable (COM) entry
2 string LILO Linux/i386 LILO boot/chain loader
#
-# Debian Packages, from Peter Tobias <tobias@server.et-inf.fho-emden.de>
-0 string 0.9
->8 byte 0x0a old Debian Binary Package
->>3 byte >0 \b, created by dpkg 0.9%c
->>4 byte >0 pl%c
# PSF fonts, from H. Peter Anvin <hpa@yggdrasil.com>
0 leshort 0x0436 Linux/i386 PC Screen Font data,
>2 byte 0 256 characters, no directory,
@@ -60,6 +55,8 @@
4086 string SWAP-SPACE Linux/i386 swap file
# according to man page of mkswap (8) March 1999
4086 string SWAPSPACE2 Linux/i386 swap file (new style)
+>0x400 long x %d (4K pages)
+>0x404 long x size %d pages
# ECOFF magic for OSF/1 and Linux (only tested under Linux though)
#
# from Erik Troan (ewt@redhat.com) examining od dumps, so this
@@ -79,28 +76,38 @@
# and others such as Axel Kohlmeyer <akohlmey@rincewind.chemie.uni-ulm.de>
# and Nicolás Lichtmaier <nick@debian.org>
# All known start with: b8 c0 07 8e d8 b8 00 90 8e c0 b9 00 01 29 f6 29
-514 string HdrS Linux kernel
->518 leshort >0
->>529 byte 0 zImage data,
->>529 byte 1 bzImage data,
->0x048c byte 0x31
->>0x048c string x version %s
->0x0493 byte 0x31
->>0x0493 string x version %s
->0x048c byte 0x32
->>0x048c string x version %s
->0x0493 byte 0x32
->>0x0493 string x version %s
->0x04df byte 0x32
->>0x04df string x version %s
->0x04fb byte 0x32
->>0x04fb string x version %s
+# Linux kernel boot images (i386 arch) (Wolfram Kleff)
+514 string HdrS Linux kernel
+>510 leshort 0xAA55 x86 boot executable
+>>518 leshort >=3D0x200
+>>529 byte 0 zImage,
+>>>529 byte 1 bzImage,
+>>>(526.s+0x200) string >\0 version %s,
+>>498 leshort 1 RO-rootFS,
+>>498 leshort 0 RW-rootFS,
+>>508 leshort >0 root_dev 0x%X,
+>>502 leshort >0 swap_dev 0x%X,
+>>504 leshort >0 RAMdisksize %u KB,
+>>506 leshort 0xFFFF Normal VGA
+>>506 leshort 0xFFFE Extended VGA
+>>506 leshort 0xFFFD Prompt for Videomode
+>>506 leshort >0 Video mode %d
# This also matches new kernels, which were caught above by "HdrS".
0 belong 0xb8c0078e Linux kernel
>0x1e3 string Loading version 1.3.79 or older
>0x1e9 string Loading from prehistoric times
-# LSM entries - Nicolás Lichtmaier <nick@feedback.net.ar>
+
+# System.map files - Nicolás Lichtmaier <nick@debian.org>
+8 string \ A\ _text Linux kernel symbol map text
+
+# LSM entries - Nicolás Lichtmaier <nick@debian.org>
0 string Begin3 Linux Software Map entry text
+0 string Begin4 Linux Software Map entry text (new format)
+
+# From Matt Zimmerman
+0 belong 0x4f4f4f4d User-mode Linux COW file
+>4 belong x \b, version %d
+>8 string >\0 \b, backing file %s
############################################################################
# Linux kernel versions
diff --git a/contrib/file/Magdir/mach b/contrib/file/Magdir/mach
index e0f4808..d3fd470 100644
--- a/contrib/file/Magdir/mach
+++ b/contrib/file/Magdir/mach
@@ -12,7 +12,10 @@
>12 belong 3 shared library
>12 belong 4 core
>12 belong 5 preload executable
->12 belong >5
+>12 belong 6 dynamically linked shared library
+>12 belong 7 dynamic linker
+>12 belong 8 bundle
+>12 belong >8
>>12 belong x filetype=%ld
>4 belong <0
>>4 belong x architecture=%ld
@@ -38,6 +41,6 @@
>4 belong 15 i860-big
>4 belong 16 i860
>4 belong 17 rs6000
->4 belong 18 powerPC
+>4 belong 18 ppc
>4 belong >18
>>4 belong x architecture=%ld
diff --git a/contrib/file/Magdir/macintosh b/contrib/file/Magdir/macintosh
index 277cb6b..91364a0 100644
--- a/contrib/file/Magdir/macintosh
+++ b/contrib/file/Magdir/macintosh
@@ -88,7 +88,8 @@
# that the first one be 0x80, 0x81, 0x82, or 0x83, and that the second
# be 0x81. This works for the files I have, but maybe not for everyone's.
-122 beshort&0xFCFF 0x8081 Macintosh MacBinary data
+# Unfortunately, this magic is quite weak - MPi
+#122 beshort&0xFCFF 0x8081 Macintosh MacBinary data
# MacBinary I doesn't have the version number field at all, but MacBinary II
# has been in use since 1987 so I hope there aren't many really old files
@@ -111,117 +112,117 @@
# >73 byte&0x10 0x40 \b, invisible
# >73 byte&0x10 0x80 \b, locked
->65 string x \b, type "%4.4s"
+#>65 string x \b, type "%4.4s"
->65 string 8BIM (PhotoShop)
->65 string ALB3 (PageMaker 3)
->65 string ALB4 (PageMaker 4)
->65 string ALT3 (PageMaker 3)
->65 string APPL (application)
->65 string AWWP (AppleWorks word processor)
->65 string CIRC (simulated circuit)
->65 string DRWG (MacDraw)
->65 string EPSF (Encapsulated PostScript)
->65 string FFIL (font suitcase)
->65 string FKEY (function key)
->65 string FNDR (Macintosh Finder)
->65 string GIFf (GIF image)
->65 string Gzip (GNU gzip)
->65 string INIT (system extension)
->65 string LIB\ (library)
->65 string LWFN (PostScript font)
->65 string MSBC (Microsoft BASIC)
->65 string PACT (Compact Pro archive)
->65 string PDF\ (Portable Document Format)
->65 string PICT (picture)
->65 string PNTG (MacPaint picture)
->65 string PREF (preferences)
->65 string PROJ (Think C project)
->65 string QPRJ (Think Pascal project)
->65 string SCFL (Defender scores)
->65 string SCRN (startup screen)
->65 string SITD (StuffIt Deluxe)
->65 string SPn3 (SuperPaint)
->65 string STAK (HyperCard stack)
->65 string Seg\ (StuffIt segment)
->65 string TARF (Unix tar archive)
->65 string TEXT (ASCII)
->65 string TIFF (TIFF image)
->65 string TOVF (Eudora table of contents)
->65 string WDBN (Microsoft Word word processor)
->65 string WORD (MacWrite word processor)
->65 string XLS\ (Microsoft Excel)
->65 string ZIVM (compress (.Z))
->65 string ZSYS (Pre-System 7 system file)
->65 string acf3 (Aldus FreeHand)
->65 string cdev (control panel)
->65 string dfil (Desk Acessory suitcase)
->65 string libr (library)
->65 string nX^d (WriteNow word processor)
->65 string nX^w (WriteNow dictionary)
->65 string rsrc (resource)
->65 string scbk (Scrapbook)
->65 string shlb (shared library)
->65 string ttro (SimpleText read-only)
->65 string zsys (system file)
+#>65 string 8BIM (PhotoShop)
+#>65 string ALB3 (PageMaker 3)
+#>65 string ALB4 (PageMaker 4)
+#>65 string ALT3 (PageMaker 3)
+#>65 string APPL (application)
+#>65 string AWWP (AppleWorks word processor)
+#>65 string CIRC (simulated circuit)
+#>65 string DRWG (MacDraw)
+#>65 string EPSF (Encapsulated PostScript)
+#>65 string FFIL (font suitcase)
+#>65 string FKEY (function key)
+#>65 string FNDR (Macintosh Finder)
+#>65 string GIFf (GIF image)
+#>65 string Gzip (GNU gzip)
+#>65 string INIT (system extension)
+#>65 string LIB\ (library)
+#>65 string LWFN (PostScript font)
+#>65 string MSBC (Microsoft BASIC)
+#>65 string PACT (Compact Pro archive)
+#>65 string PDF\ (Portable Document Format)
+#>65 string PICT (picture)
+#>65 string PNTG (MacPaint picture)
+#>65 string PREF (preferences)
+#>65 string PROJ (Think C project)
+#>65 string QPRJ (Think Pascal project)
+#>65 string SCFL (Defender scores)
+#>65 string SCRN (startup screen)
+#>65 string SITD (StuffIt Deluxe)
+#>65 string SPn3 (SuperPaint)
+#>65 string STAK (HyperCard stack)
+#>65 string Seg\ (StuffIt segment)
+#>65 string TARF (Unix tar archive)
+#>65 string TEXT (ASCII)
+#>65 string TIFF (TIFF image)
+#>65 string TOVF (Eudora table of contents)
+#>65 string WDBN (Microsoft Word word processor)
+#>65 string WORD (MacWrite word processor)
+#>65 string XLS\ (Microsoft Excel)
+#>65 string ZIVM (compress (.Z))
+#>65 string ZSYS (Pre-System 7 system file)
+#>65 string acf3 (Aldus FreeHand)
+#>65 string cdev (control panel)
+#>65 string dfil (Desk Acessory suitcase)
+#>65 string libr (library)
+#>65 string nX^d (WriteNow word processor)
+#>65 string nX^w (WriteNow dictionary)
+#>65 string rsrc (resource)
+#>65 string scbk (Scrapbook)
+#>65 string shlb (shared library)
+#>65 string ttro (SimpleText read-only)
+#>65 string zsys (system file)
->69 string x \b, creator "%4.4s"
+#>69 string x \b, creator "%4.4s"
# Somewhere, Apple has a repository of registered Creator IDs. These are
# just the ones that I happened to have files from and was able to identify.
->69 string 8BIM (Adobe Photoshop)
->69 string ALD3 (PageMaker 3)
->69 string ALD4 (PageMaker 4)
->69 string ALFA (Alpha editor)
->69 string APLS (Apple Scanner)
->69 string APSC (Apple Scanner)
->69 string BRKL (Brickles)
->69 string BTFT (BitFont)
->69 string CCL2 (Common Lisp 2)
->69 string CCL\ (Common Lisp)
->69 string CDmo (The Talking Moose)
->69 string CPCT (Compact Pro)
->69 string CSOm (Eudora)
->69 string DMOV (Font/DA Mover)
->69 string DSIM (DigSim)
->69 string EDIT (Macintosh Edit)
->69 string ERIK (Macintosh Finder)
->69 string EXTR (self-extracting archive)
->69 string Gzip (GNU gzip)
->69 string KAHL (Think C)
->69 string LWFU (LaserWriter Utility)
->69 string LZIV (compress)
->69 string MACA (MacWrite)
->69 string MACS (Macintosh operating system)
->69 string MAcK (MacKnowledge terminal emulator)
->69 string MLND (Defender)
->69 string MPNT (MacPaint)
->69 string MSBB (Microsoft BASIC (binary))
->69 string MSWD (Microsoft Word)
->69 string NCSA (NCSA Telnet)
->69 string PJMM (Think Pascal)
->69 string PSAL (Hunt the Wumpus)
->69 string PSI2 (Apple File Exchange)
->69 string R*ch (BBEdit)
->69 string RMKR (Resource Maker)
->69 string RSED (Resource Editor)
->69 string Rich (BBEdit)
->69 string SIT! (StuffIt)
->69 string SPNT (SuperPaint)
->69 string Unix (NeXT Mac filesystem)
->69 string VIM! (Vim editor)
->69 string WILD (HyperCard)
->69 string XCEL (Microsoft Excel)
->69 string aCa2 (Fontographer)
->69 string aca3 (Aldus FreeHand)
->69 string dosa (Macintosh MS-DOS file system)
->69 string movr (Font/DA Mover)
->69 string nX^n (WriteNow)
->69 string pdos (Apple ProDOS file system)
->69 string scbk (Scrapbook)
->69 string ttxt (SimpleText)
->69 string ufox (Foreign File Access)
+#>69 string 8BIM (Adobe Photoshop)
+#>69 string ALD3 (PageMaker 3)
+#>69 string ALD4 (PageMaker 4)
+#>69 string ALFA (Alpha editor)
+#>69 string APLS (Apple Scanner)
+#>69 string APSC (Apple Scanner)
+#>69 string BRKL (Brickles)
+#>69 string BTFT (BitFont)
+#>69 string CCL2 (Common Lisp 2)
+#>69 string CCL\ (Common Lisp)
+#>69 string CDmo (The Talking Moose)
+#>69 string CPCT (Compact Pro)
+#>69 string CSOm (Eudora)
+#>69 string DMOV (Font/DA Mover)
+#>69 string DSIM (DigSim)
+#>69 string EDIT (Macintosh Edit)
+#>69 string ERIK (Macintosh Finder)
+#>69 string EXTR (self-extracting archive)
+#>69 string Gzip (GNU gzip)
+#>69 string KAHL (Think C)
+#>69 string LWFU (LaserWriter Utility)
+#>69 string LZIV (compress)
+#>69 string MACA (MacWrite)
+#>69 string MACS (Macintosh operating system)
+#>69 string MAcK (MacKnowledge terminal emulator)
+#>69 string MLND (Defender)
+#>69 string MPNT (MacPaint)
+#>69 string MSBB (Microsoft BASIC (binary))
+#>69 string MSWD (Microsoft Word)
+#>69 string NCSA (NCSA Telnet)
+#>69 string PJMM (Think Pascal)
+#>69 string PSAL (Hunt the Wumpus)
+#>69 string PSI2 (Apple File Exchange)
+#>69 string R*ch (BBEdit)
+#>69 string RMKR (Resource Maker)
+#>69 string RSED (Resource Editor)
+#>69 string Rich (BBEdit)
+#>69 string SIT! (StuffIt)
+#>69 string SPNT (SuperPaint)
+#>69 string Unix (NeXT Mac filesystem)
+#>69 string VIM! (Vim editor)
+#>69 string WILD (HyperCard)
+#>69 string XCEL (Microsoft Excel)
+#>69 string aCa2 (Fontographer)
+#>69 string aca3 (Aldus FreeHand)
+#>69 string dosa (Macintosh MS-DOS file system)
+#>69 string movr (Font/DA Mover)
+#>69 string nX^n (WriteNow)
+#>69 string pdos (Apple ProDOS file system)
+#>69 string scbk (Scrapbook)
+#>69 string ttxt (SimpleText)
+#>69 string ufox (Foreign File Access)
# Just in case...
@@ -236,6 +237,14 @@
>24 string CATALOG catalog
>24 string INDEX data file index
>24 string VIEW data view
+# sas 7+ magic from Reinhold Koch (reinhold.koch@roche.com)
+#
+0x54 string SAS SAS 7+
+>0x9C string DATA data file
+>0x9C string CATALOG catalog
+>0x9C string INDEX data file index
+>0x9C string VIEW data view
+
# spss magic for SPSS system and portable files,
# from Bruce Foster (bef@nwu.edu).
@@ -247,6 +256,7 @@
# Macintosh filesystem data
# From "Tom N Harris" <telliamed@mac.com>
+# Fixed HFS+ and Partition map magic: Ethan Benson <erbenson@alaska.net>
# The MacOS epoch begins on 1 Jan 1904 instead of 1 Jan 1970, so these
# entries depend on the data arithmetic added after v.35
# There's also some Pascal strings in here, ditto...
@@ -266,39 +276,39 @@
>0x412 beshort x number of blocks: %d,
>0x424 pstring x volume name: %s
-0x400 beshort 0x4244 Macintosh HFS data
->0 beshort 0x4C4B (bootable)
->0x40a beshort &0x8000 (locked)
->0x40a beshort ^0x0100 (mounted)
->0x40a beshort &0x0800 (unclean)
->0x402 beldate-0x7C25B080 x created: %s,
->0x406 beldate-0x7C25B080 x last modified: %s,
->0x440 beldate-0x7C25B080 >0 last backup: %s,
->0x414 belong x block size: %d,
->0x412 beshort x number of blocks: %d,
->0x424 pstring x volume name: %s
-#>0x480 beshort =0x482B Embedded HFS+ Volume:
-#>>((0x482*(0x414))+(0x41c*512)) x \b
-# Well, this is (theoretically) how we could do this. But it occurs to
-# me that we likely don't read in a large enough chunk. I don't have any
-# HFS+ volumes to see what a typical offset would be.
+# "BD" is has many false positives
+#0x400 beshort 0x4244 Macintosh HFS data
+#>0 beshort 0x4C4B (bootable)
+#>0x40a beshort &0x8000 (locked)
+#>0x40a beshort ^0x0100 (mounted)
+#>0x40a beshort &0x0200 (spared blocks)
+#>0x40a beshort &0x0800 (unclean)
+#>0x47C beshort 0x482B (Embedded HFS+ Volume)
+#>0x402 beldate-0x7C25B080 x created: %s,
+#>0x406 beldate-0x7C25B080 x last modified: %s,
+#>0x440 beldate-0x7C25B080 >0 last backup: %s,
+#>0x414 belong x block size: %d,
+#>0x412 beshort x number of blocks: %d,
+#>0x424 pstring x volume name: %s
0x400 beshort 0x482B Macintosh HFS Extended
->&2 beshort x version %d data
+>&0 beshort x version %d data
>0 beshort 0x4C4B (bootable)
->&4 belong ^0x00000100 (mounted)
->&4 belong &0x00000800 (unclean)
->&4 belong &0x00008000 (locked)
->&8 string x last mounted by: '%.4s',
+>0x404 belong ^0x00000100 (mounted)
+>&2 belong &0x00000200 (spared blocks)
+>&2 belong &0x00000800 (unclean)
+>&2 belong &0x00008000 (locked)
+>&6 string x last mounted by: '%.4s',
# really, that should be treated as a belong and we print a string
# based on the value. TN1150 only mentions '8.10' for "MacOS 8.1"
->&16 beldate-0x7C25B080 x created: %s,
->&20 beldate-0x7C25B080 x last modified: %s,
->&24 beldate-0x7C25B080 >0 last backup: %s,
->&28 beldate-0x7C25B080 >0 last checked: %s,
->&40 belong x block size: %d,
->&44 belong x number of blocks: %d,
->&48 belong x free blocks: %d
+>&14 beldate-0x7C25B080 x created: %s,
+# only the creation date is local time, all other timestamps in HFS+ are UTC.
+>&18 bedate-0x7C25B080 x last modified: %s,
+>&22 bedate-0x7C25B080 >0 last backup: %s,
+>&26 bedate-0x7C25B080 >0 last checked: %s,
+>&38 belong x block size: %d,
+>&42 belong x number of blocks: %d,
+>&46 belong x free blocks: %d
# I don't think this is really necessary since it doesn't do much and
# anything with a valid driver descriptor will also have a valid
@@ -311,29 +321,40 @@
# cstring. Of course, partitions can contain more than four entries, but
# what're you gonna do?
0x200 beshort 0x504D Apple Partition data
->&2 beshort x block size: %d
->&48 string x first type: %s,
->&12 belong x number of blocks: %d,
->(&0x2.S) beshort 0x504D
->>&48 string x second type: %s
->>&12 belong x number of blocks: %d,
->>(&0x2.S) beshort 0x504D
->>>&48 string x third type: %s
->>>&12 belong x number of blocks: %d,
->>>(&0x2.S) beshort 0x504D
->>>>&48 string x fourth type: %s
->>>>&12 belong x number of blocks: %d,
+>0x2 beshort x block size: %d,
+>0x230 string x first type: %s,
+>0x210 string x name: %s,
+>0x254 belong x number of blocks: %d,
+>0x400 beshort 0x504D
+>>0x430 string x second type: %s,
+>>0x410 string x name: %s,
+>>0x454 belong x number of blocks: %d,
+>>0x800 beshort 0x504D
+>>>0x830 string x third type: %s,
+>>>0x810 string x name: %s,
+>>>0x854 belong x number of blocks: %d,
+>>>0xa00 beshort 0x504D
+>>>>0xa30 string x fourth type: %s,
+>>>>0xa10 string x name: %s,
+>>>>0xa54 belong x number of blocks: %d
# AFAIK, only the signature is different
0x200 beshort 0x5453 Apple Old Partition data
->&2 beshort x block size: %d
->&48 string x first type: %s,
->&12 belong x number of blocks: %d,
->(&0x2.S) beshort 0x504D
->>&48 string x second type: %s
->>&12 belong x number of blocks: %d,
->>(&0x2.S) beshort 0x504D
->>>&48 string x third type: %s
->>>&12 belong x number of blocks: %d,
->>>(&0x2.S) beshort 0x504D
->>>>&48 string x fourth type: %s
->>>>&12 belong x number of blocks: %d,
+>0x2 beshort x block size: %d,
+>0x230 string x first type: %s,
+>0x210 string x name: %s,
+>0x254 belong x number of blocks: %d,
+>0x400 beshort 0x504D
+>>0x430 string x second type: %s,
+>>0x410 string x name: %s,
+>>0x454 belong x number of blocks: %d,
+>>0x800 beshort 0x504D
+>>>0x830 string x third type: %s,
+>>>0x810 string x name: %s,
+>>>0x854 belong x number of blocks: %d,
+>>>0xa00 beshort 0x504D
+>>>>0xa30 string x fourth type: %s,
+>>>>0xa10 string x name: %s,
+>>>>0xa54 belong x number of blocks: %d
+
+# From: Remi Mommsen <mommsen@slac.stanford.edu>
+0 string BOMStore Mac OS X bill of materials (BOM) fil
diff --git a/contrib/file/Magdir/mail.news b/contrib/file/Magdir/mail.news
index ab8b293..2cace95 100644
--- a/contrib/file/Magdir/mail.news
+++ b/contrib/file/Magdir/mail.news
@@ -26,3 +26,15 @@
# From: Kevin Sullivan <ksulliva@psc.edu>
0 string *mbx* MBX mail folder
+# From: Simon Matter <simon.matter@invoca.ch>
+0 string \241\002\213\015skiplist\ file\0\0\0 Cyrus skiplist DB
+
+# JAM(mbp) Fidonet message area databases
+# JHR file
+0 string JAM\0 JAM message area header file
+>12 leshort >0 (%d messages)
+
+# Squish Fidonet message area databases
+# SQD file (requires at least one message in the area)
+256 leshort 0xAFAE4453 Squish message area data file
+>4 leshort >0 (%d messages)
diff --git a/contrib/file/Magdir/maple b/contrib/file/Magdir/maple
index f39c62d..eea4794 100644
--- a/contrib/file/Magdir/maple
+++ b/contrib/file/Magdir/maple
@@ -20,9 +20,9 @@
0 string \<PACKAGE= Maple help file
0 string \<HELP\ NAME= Maple help file
0 string \n\<HELP\ NAME= Maple help file with extra carriage return at start (yuck)
-0 string #\ Newton Maple help file, old style
+#0 string #\ Newton Maple help file, old style
0 string #\ daub Maple help file, old style
-0 string #=========== Maple help file, old style
+#0 string #=========== Maple help file, old style
# .mws
0 string \000\000\001\044\000\221 Maple worksheet
diff --git a/contrib/file/Magdir/mathematica b/contrib/file/Magdir/mathematica
index 136c253..b9d3405 100644
--- a/contrib/file/Magdir/mathematica
+++ b/contrib/file/Magdir/mathematica
@@ -56,4 +56,13 @@
0 string (*********************** Mathematica 3.0 notebook
# other (* matches it is a comment start in these langs
-0 string (* Mathematica, or Pascal, Modula-2 or 3 code
+0 string (* Mathematica, or Pascal, Modula-2 or 3 code text
+
+#########################
+# MatLab v5
+0 string MATLAB Matlab v5 mat-file
+>126 short 0x494d (big endian)
+>>124 beshort x version 0x%04x
+>126 short 0x4d49 (little endian)
+>>124 leshort x version 0x%04x
+
diff --git a/contrib/file/Magdir/matroska b/contrib/file/Magdir/matroska
new file mode 100644
index 0000000..ca00db4
--- /dev/null
+++ b/contrib/file/Magdir/matroska
@@ -0,0 +1,14 @@
+
+#------------------------------------------------------------------------------
+# matroska: file(1) magic for Matroska files
+#
+# See http://www.matroska.org/
+#
+
+# EBML id:
+0 belong 0x1a45dfa3
+# DocType id:
+>5 beshort 0x4282
+# DocType contents:
+>>8 string matroska Matroska data
+
diff --git a/contrib/file/Magdir/misctools b/contrib/file/Magdir/misctools
new file mode 100644
index 0000000..c32d52c
--- /dev/null
+++ b/contrib/file/Magdir/misctools
@@ -0,0 +1,5 @@
+#-----------------------------------------------------------------------------
+# misctools: file(1) magic for miscelanous UNIX tools.
+#
+0 string %%!! X-Post-It-Note text
+0 string BEGIN:VCALENDAR vCalendar calendar file
diff --git a/contrib/file/Magdir/motorola b/contrib/file/Magdir/motorola
index 1a3174c..bfe7ea0 100644
--- a/contrib/file/Magdir/motorola
+++ b/contrib/file/Magdir/motorola
@@ -48,3 +48,23 @@
>6 belong x dat=%ld,
>10 belong x bss=%ld,
>14 belong x sym=%ld)
+
+# Atari ST/TT... program format (sent by Wolfram Kleff <kleff@cs.uni-bonn.de>)
+0 beshort 0x601A Atari 68xxx executable,
+>2 belong x text len %lu,
+>6 belong x data len %lu,
+>10 belong x BSS len %lu,
+>14 belong x symboltab len %lu,
+>18 belong 0
+>22 belong &0x01 fastload flag,
+>22 belong &0x02 may be loaded to alternate RAM,
+>22 belong &0x04 malloc may be from alternate RAM,
+>22 belong x flags: 0x%lX,
+>26 beshort 0 no relocation tab
+>26 beshort !0 + relocation tab
+>30 string SFX [Self-Extracting LZH SFX archive]
+>38 string SFX [Self-Extracting LZH SFX archive]
+>44 string ZIP! [Self-Extracting ZIP SFX archive]
+
+0 beshort 0x0064 Atari 68xxx CPX file
+>8 beshort x (version %04lx)
diff --git a/contrib/file/Magdir/msdos b/contrib/file/Magdir/msdos
index 99f1109..1c707d4 100644
--- a/contrib/file/Magdir/msdos
+++ b/contrib/file/Magdir/msdos
@@ -4,7 +4,7 @@
#
# .BAT files (Daniel Quinlan, quinlan@yggdrasil.com)
-0 string @echo\ off MS-DOS batch file text
+0 string/c @echo\ off MS-DOS batch file text
# XXX - according to Microsoft's spec, at an offset of 0x3c in a
# PE-format executable is the offset in the file of the PE header;
@@ -144,9 +144,10 @@
#
#
-# Windows NT Registry files.
+# Windows Registry files.
#
-0 string regf Windows NT Registry file
+0 string regf Windows NT registry file
+0 string CREG Windows 95 registry file
# Popular applications
2080 string Microsoft\ Word\ 6.0\ Document %s
@@ -159,13 +160,17 @@
0 string PO^Q` Microsoft Word 6.0 Document
#
0 string \376\067\0\043 Microsoft Office Document
-0 string \320\317\021\340\241\261 Microsoft Office Document
+0 string \320\317\021\340\241\261\032\341 Microsoft Office Document
0 string \333\245-\0\0\0 Microsoft Office Document
#
2080 string Microsoft\ Excel\ 5.0\ Worksheet %s
+2080 string Foglio\ di\ lavoro\ Microsoft\ Exce %s
#
# Pawel Wiecek <coven@i17linuxb.ists.pwr.wroc.pl> (for polish Excel)
2114 string Biff5 Microsoft Excel 5.0 Worksheet
+# Italian MS-Excel
+2121 string Biff5 Microsoft Excel 5.0 Worksheet
+0 string \x09\x04\x06\x00\x00\x00\x10\x00 Microsoft Excel Worksheet
#
0 belong 0x00001a00 Lotus 1-2-3
>4 belong 0x00100400 wk3 document data
@@ -180,9 +185,6 @@
# Help files
0 string ?_\3\0 MS Windows Help Data
-# Microsoft CAB distribution format Dale Worley <root@dworley.ny.mediaone.net>
-0 string MSCF\000\000\000\000 Microsoft CAB file
-
# DeIsL1.isu what this is I don't know
0 string \161\250\000\000\001\002 DeIsL1.isu whatever that is
@@ -238,11 +240,6 @@
>>8 byte >0 \b, %d-colors
-# True Type fonts currently misidentified as raw G3 data
-
-0 string \000\001\000\000\000 MS-Windows true type font .ttf
-
-
# .chr files
0 string PK\010\010BGI Borland font
>4 string >\0 %s
@@ -263,9 +260,9 @@
# Acroread or something files wrongly identified as G3 .pfm
# these have the form \000 \001 any? \002 \000 \000
# or \000 \001 any? \022 \000 \000
-0 string \000\001 pfm?
->3 string \022\000\000Copyright\ yes
->3 string \002\000\000Copyright\ yes
+#0 string \000\001 pfm?
+#>3 string \022\000\000Copyright\ yes
+#>3 string \002\000\000Copyright\ yes
#>3 string >\0 oops, not a font file. Cancel that.
#it clashes with ttf files so put it lower down.
@@ -278,7 +275,8 @@
0 string DCU1 Borland Delphi .DCU file
0 string !<spell> MKS Spell hash list (old format)
0 string !<spell2> MKS Spell hash list
-0 string AH Halo(TM) bitmapped font file
+# Too simple - MPi
+#0 string AH Halo(TM) bitmapped font file
0 lelong 0x08086b70 TurboC BGI file
0 lelong 0x08084b50 TurboC Font file
@@ -309,3 +307,70 @@
# TNEF magic From "Joomy" <joomy@se-ed.net>
0 leshort 0x223e9f78 TNEF
+
+# HtmlHelp files (.chm)
+0 string ITSF\003\000\000\000\x60\000\000\000\001\000\000\000 MS Windows HtmlHelp Data
+
+# GFA-BASIC (Wolfram Kleff)
+2 string GFA-BASIC3 GFA-BASIC 3 data
+
+# DJGPP compiled files
+# v >2, uses DPMI & small(2k) stub (Robert vd Boon, rjvdboon@europe.com)
+0x200 string go32stub DOS-executable compiled w/DJGPP
+>0x20c string >0 (stub v%.4s)
+>>0x8b2 string djp [compressed w/%s
+>>>&1 string >\0 %.4s]
+>>0x8ad string UPX [compressed w/%s
+>>>&1 string >\0 %.4s]
+>>0x1c string pmodedj stubbed with %s
+
+# QDOS
+4 belong 0x4AFB QDOS executable
+>9 pstring x '%s'
+0 beshort 0xFB01 QDOS object
+>2 pstring x '%s'
+
+#------------------------------------------------------------------------------
+# From Stuart Caie <kyzer@4u.net> (developer of cabextract)
+# Microsoft Cabinet files
+0 string MSCF\0\0\0\0 Microsoft Cabinet file
+>8 lelong x \b, %u bytes
+>28 leshort 1 \b, 1 file
+>28 leshort >1 \b, %u files
+
+# InstallShield Cabinet files
+0 string ISc( InstallShield Cabinet file
+>5 byte&0xf0 =0x60 version 6,
+>5 byte&0xf0 !0x60 version 4/5,
+>(12.l+40) lelong x %u files
+
+# Windows CE package files
+0 string MSCE\0\0\0\0 Microsoft WinCE install header
+>20 lelong 0 \b, architecture-independent
+>20 lelong 103 \b, Hitachi SH3
+>20 lelong 104 \b, Hitachi SH4
+>20 lelong 0xA11 \b, StrongARM
+>20 lelong 4000 \b, MIPS R4000
+>20 lelong 10003 \b, Hitachi SH3
+>20 lelong 10004 \b, Hitachi SH3E
+>20 lelong 10005 \b, Hitachi SH4
+>20 lelong 70001 \b, ARM 7TDMI
+>52 leshort 1 \b, 1 file
+>52 leshort >1 \b, %u files
+>56 leshort 1 \b, 1 registry entry
+>56 leshort >1 \b, %u registry entries
+
+# Outlook Personal Folders
+0 lelong 0x4E444221 Microsoft Outlook binary email folder
+
+# From: Dirk Jagdmann <doj@cubic.org>
+0 lelong 0x00035f3f Windows 3.x help file
+
+# Christophe Monniez
+0 string Client\ UrlCache\ MMF Microsoft Internet Explorer Cache File
+>20 string >\0 Version %s
+0 string \xCF\xAD\x12\xFE Microsoft Outlook Express DBX File
+>4 byte =0xC5 Message database
+>4 byte =0xC6 Folder database
+>4 byte =0xC7 Accounts informations
+>4 byte =0x30 Offline database
diff --git a/contrib/file/Magdir/netbsd b/contrib/file/Magdir/netbsd
index 7c260e4..b6aae1ac6 100644
--- a/contrib/file/Magdir/netbsd
+++ b/contrib/file/Magdir/netbsd
@@ -5,187 +5,187 @@
# All new-style magic numbers are in network byte order.
#
-0 lelong 000000407 NetBSD little-endian object file
+0 lelong 000000407 a.out NetBSD little-endian object file
>16 lelong >0 not stripped
-0 belong 000000407 NetBSD big-endian object file
+0 belong 000000407 a.out NetBSD big-endian object file
>16 belong >0 not stripped
-0 belong&0377777777 041400413 NetBSD/i386 demand paged
+0 belong&0377777777 041400413 a.out NetBSD/i386 demand paged
>0 byte &0x80
>>20 lelong <4096 shared library
>>20 lelong =4096 dynamically linked executable
>>20 lelong >4096 dynamically linked executable
>0 byte ^0x80 executable
>16 lelong >0 not stripped
-0 belong&0377777777 041400410 NetBSD/i386 pure
+0 belong&0377777777 041400410 a.out NetBSD/i386 pure
>0 byte &0x80 dynamically linked executable
>0 byte ^0x80 executable
>16 lelong >0 not stripped
-0 belong&0377777777 041400407 NetBSD/i386
+0 belong&0377777777 041400407 a.out NetBSD/i386
>0 byte &0x80 dynamically linked executable
>0 byte ^0x80
>>0 byte &0x40 position independent
>>20 lelong !0 executable
>>20 lelong =0 object file
>16 lelong >0 not stripped
-0 belong&0377777777 041400507 NetBSD/i386 core
+0 belong&0377777777 041400507 a.out NetBSD/i386 core
>12 string >\0 from '%s'
>32 lelong !0 (signal %d)
-0 belong&0377777777 041600413 NetBSD/m68k demand paged
+0 belong&0377777777 041600413 a.out NetBSD/m68k demand paged
>0 byte &0x80
>>20 belong <8192 shared library
>>20 belong =8192 dynamically linked executable
>>20 belong >8192 dynamically linked executable
>0 byte ^0x80 executable
>16 belong >0 not stripped
-0 belong&0377777777 041600410 NetBSD/m68k pure
+0 belong&0377777777 041600410 a.out NetBSD/m68k pure
>0 byte &0x80 dynamically linked executable
>0 byte ^0x80 executable
>16 belong >0 not stripped
-0 belong&0377777777 041600407 NetBSD/m68k
+0 belong&0377777777 041600407 a.out NetBSD/m68k
>0 byte &0x80 dynamically linked executable
>0 byte ^0x80
>>0 byte &0x40 position independent
>>20 belong !0 executable
>>20 belong =0 object file
>16 belong >0 not stripped
-0 belong&0377777777 041600507 NetBSD/m68k core
+0 belong&0377777777 041600507 a.out NetBSD/m68k core
>12 string >\0 from '%s'
>32 belong !0 (signal %d)
-0 belong&0377777777 042000413 NetBSD/m68k4k demand paged
+0 belong&0377777777 042000413 a.out NetBSD/m68k4k demand paged
>0 byte &0x80
>>20 belong <4096 shared library
>>20 belong =4096 dynamically linked executable
>>20 belong >4096 dynamically linked executable
>0 byte ^0x80 executable
>16 belong >0 not stripped
-0 belong&0377777777 042000410 NetBSD/m68k4k pure
+0 belong&0377777777 042000410 a.out NetBSD/m68k4k pure
>0 byte &0x80 dynamically linked executable
>0 byte ^0x80 executable
>16 belong >0 not stripped
-0 belong&0377777777 042000407 NetBSD/m68k4k
+0 belong&0377777777 042000407 a.out NetBSD/m68k4k
>0 byte &0x80 dynamically linked executable
>0 byte ^0x80
>>0 byte &0x40 position independent
>>20 belong !0 executable
>>20 belong =0 object file
>16 belong >0 not stripped
-0 belong&0377777777 042000507 NetBSD/m68k4k core
+0 belong&0377777777 042000507 a.out NetBSD/m68k4k core
>12 string >\0 from '%s'
>32 belong !0 (signal %d)
-0 belong&0377777777 042200413 NetBSD/ns32532 demand paged
+0 belong&0377777777 042200413 a.out NetBSD/ns32532 demand paged
>0 byte &0x80
>>20 lelong <4096 shared library
>>20 lelong =4096 dynamically linked executable
>>20 lelong >4096 dynamically linked executable
>0 byte ^0x80 executable
>16 lelong >0 not stripped
-0 belong&0377777777 042200410 NetBSD/ns32532 pure
+0 belong&0377777777 042200410 a.out NetBSD/ns32532 pure
>0 byte &0x80 dynamically linked executable
>0 byte ^0x80 executable
>16 lelong >0 not stripped
-0 belong&0377777777 042200407 NetBSD/ns32532
+0 belong&0377777777 042200407 a.out NetBSD/ns32532
>0 byte &0x80 dynamically linked executable
>0 byte ^0x80
>>0 byte &0x40 position independent
>>20 lelong !0 executable
>>20 lelong =0 object file
>16 lelong >0 not stripped
-0 belong&0377777777 042200507 NetBSD/ns32532 core
+0 belong&0377777777 042200507 a.out NetBSD/ns32532 core
>12 string >\0 from '%s'
>32 lelong !0 (signal %d)
-0 belong&0377777777 045200507 NetBSD/powerpc core
+0 belong&0377777777 045200507 a.out NetBSD/powerpc core
>12 string >\0 from '%s'
-0 belong&0377777777 042400413 NetBSD/sparc demand paged
+0 belong&0377777777 042400413 a.out NetBSD/sparc demand paged
>0 byte &0x80
>>20 belong <8192 shared library
>>20 belong =8192 dynamically linked executable
>>20 belong >8192 dynamically linked executable
>0 byte ^0x80 executable
>16 belong >0 not stripped
-0 belong&0377777777 042400410 NetBSD/sparc pure
+0 belong&0377777777 042400410 a.out NetBSD/sparc pure
>0 byte &0x80 dynamically linked executable
>0 byte ^0x80 executable
>16 belong >0 not stripped
-0 belong&0377777777 042400407 NetBSD/sparc
+0 belong&0377777777 042400407 a.out NetBSD/sparc
>0 byte &0x80 dynamically linked executable
>0 byte ^0x80
>>0 byte &0x40 position independent
>>20 belong !0 executable
>>20 belong =0 object file
>16 belong >0 not stripped
-0 belong&0377777777 042400507 NetBSD/sparc core
+0 belong&0377777777 042400507 a.out NetBSD/sparc core
>12 string >\0 from '%s'
>32 belong !0 (signal %d)
-0 belong&0377777777 042600413 NetBSD/pmax demand paged
+0 belong&0377777777 042600413 a.out NetBSD/pmax demand paged
>0 byte &0x80
>>20 lelong <4096 shared library
>>20 lelong =4096 dynamically linked executable
>>20 lelong >4096 dynamically linked executable
>0 byte ^0x80 executable
>16 lelong >0 not stripped
-0 belong&0377777777 042600410 NetBSD/pmax pure
+0 belong&0377777777 042600410 a.out NetBSD/pmax pure
>0 byte &0x80 dynamically linked executable
>0 byte ^0x80 executable
>16 lelong >0 not stripped
-0 belong&0377777777 042600407 NetBSD/pmax
+0 belong&0377777777 042600407 a.out NetBSD/pmax
>0 byte &0x80 dynamically linked executable
>0 byte ^0x80
>>0 byte &0x40 position independent
>>20 lelong !0 executable
>>20 lelong =0 object file
>16 lelong >0 not stripped
-0 belong&0377777777 042600507 NetBSD/pmax core
+0 belong&0377777777 042600507 a.out NetBSD/pmax core
>12 string >\0 from '%s'
>32 lelong !0 (signal %d)
-0 belong&0377777777 043000413 NetBSD/vax 1k demand paged
+0 belong&0377777777 043000413 a.out NetBSD/vax 1k demand paged
>0 byte &0x80
>>20 lelong <4096 shared library
>>20 lelong =4096 dynamically linked executable
>>20 lelong >4096 dynamically linked executable
>0 byte ^0x80 executable
>16 lelong >0 not stripped
-0 belong&0377777777 043000410 NetBSD/vax 1k pure
+0 belong&0377777777 043000410 a.out NetBSD/vax 1k pure
>0 byte &0x80 dynamically linked executable
>0 byte ^0x80 executable
>16 lelong >0 not stripped
-0 belong&0377777777 043000407 NetBSD/vax 1k
+0 belong&0377777777 043000407 a.out NetBSD/vax 1k
>0 byte &0x80 dynamically linked executable
>0 byte ^0x80
>>0 byte &0x40 position independent
>>20 lelong !0 executable
>>20 lelong =0 object file
>16 lelong >0 not stripped
-0 belong&0377777777 043000507 NetBSD/vax 1k core
+0 belong&0377777777 043000507 a.out NetBSD/vax 1k core
>12 string >\0 from '%s'
>32 lelong !0 (signal %d)
-0 belong&0377777777 045400413 NetBSD/vax 4k demand paged
+0 belong&0377777777 045400413 a.out NetBSD/vax 4k demand paged
>0 byte &0x80
>>20 lelong <4096 shared library
>>20 lelong =4096 dynamically linked executable
>>20 lelong >4096 dynamically linked executable
>0 byte ^0x80 executable
>16 lelong >0 not stripped
-0 belong&0377777777 045400410 NetBSD/vax 4k pure
+0 belong&0377777777 045400410 a.out NetBSD/vax 4k pure
>0 byte &0x80 dynamically linked executable
>0 byte ^0x80 executable
>16 lelong >0 not stripped
-0 belong&0377777777 045400407 NetBSD/vax 4k
+0 belong&0377777777 045400407 a.out NetBSD/vax 4k
>0 byte &0x80 dynamically linked executable
>0 byte ^0x80
>>0 byte &0x40 position independent
>>20 lelong !0 executable
>>20 lelong =0 object file
>16 lelong >0 not stripped
-0 belong&0377777777 045400507 NetBSD/vax 4k core
+0 belong&0377777777 045400507 a.out NetBSD/vax 4k core
>12 string >\0 from '%s'
>32 lelong !0 (signal %d)
@@ -195,44 +195,44 @@
0 lelong 0x00070185 ECOFF NetBSD/alpha binary
>10 leshort 0x0001 not stripped
>10 leshort 0x0000 stripped
-0 belong&0377777777 043200507 NetBSD/alpha core
+0 belong&0377777777 043200507 a.out NetBSD/alpha core
>12 string >\0 from '%s'
>32 lelong !0 (signal %d)
-0 belong&0377777777 043400413 NetBSD/mips demand paged
+0 belong&0377777777 043400413 a.out NetBSD/mips demand paged
>0 byte &0x80
>>20 belong <8192 shared library
>>20 belong =8192 dynamically linked executable
>>20 belong >8192 dynamically linked executable
>0 byte ^0x80 executable
>16 belong >0 not stripped
-0 belong&0377777777 043400410 NetBSD/mips pure
+0 belong&0377777777 043400410 a.out NetBSD/mips pure
>0 byte &0x80 dynamically linked executable
>0 byte ^0x80 executable
>16 belong >0 not stripped
-0 belong&0377777777 043400407 NetBSD/mips
+0 belong&0377777777 043400407 a.out NetBSD/mips
>0 byte &0x80 dynamically linked executable
>0 byte ^0x80
>>0 byte &0x40 position independent
>>20 belong !0 executable
>>20 belong =0 object file
>16 belong >0 not stripped
-0 belong&0377777777 043400507 NetBSD/mips core
+0 belong&0377777777 043400507 a.out NetBSD/mips core
>12 string >\0 from '%s'
>32 belong !0 (signal %d)
-0 belong&0377777777 043600413 NetBSD/arm32 demand paged
+0 belong&0377777777 043600413 a.out NetBSD/arm32 demand paged
>0 byte &0x80
>>20 lelong <4096 shared library
>>20 lelong =4096 dynamically linked executable
>>20 lelong >4096 dynamically linked executable
>0 byte ^0x80 executable
>16 lelong >0 not stripped
-0 belong&0377777777 043600410 NetBSD/arm32 pure
+0 belong&0377777777 043600410 a.out NetBSD/arm32 pure
>0 byte &0x80 dynamically linked executable
>0 byte ^0x80 executable
>16 lelong >0 not stripped
-0 belong&0377777777 043600407 NetBSD/arm32
+0 belong&0377777777 043600407 a.out NetBSD/arm32
>0 byte &0x80 dynamically linked executable
>0 byte ^0x80
>>0 byte &0x40 position independent
@@ -241,6 +241,6 @@
>16 lelong >0 not stripped
# NetBSD/arm26 has always used ELF objects, but it shares a core file
# format with NetBSD/arm32.
-0 belong&0377777777 043600507 NetBSD/arm core
+0 belong&0377777777 043600507 a.out NetBSD/arm core
>12 string >\0 from '%s'
>32 lelong !0 (signal %d)
diff --git a/contrib/file/Magdir/netscape b/contrib/file/Magdir/netscape
index eb4361c..f14227d 100644
--- a/contrib/file/Magdir/netscape
+++ b/contrib/file/Magdir/netscape
@@ -8,6 +8,9 @@
# Netscape Address book .nab
0 string \000\017\102\104\000\000\000\000\000\000\001\000\000\000\000\002\000\000\000\002\000\000\004\000 Netscape Address book
+# Netscape Communicator address book
+0 string \000\017\102\111 Netscape Communicator address book
+
# .snm Caches
0 string #\ Netscape\ folder\ cache Netscape folder cache
0 string \000\036\204\220\000 Netscape folder cache
diff --git a/contrib/file/Magdir/ocaml b/contrib/file/Magdir/ocaml
new file mode 100644
index 0000000..f8ba976
--- /dev/null
+++ b/contrib/file/Magdir/ocaml
@@ -0,0 +1,13 @@
+
+#------------------------------------------------------------------------------
+# ocaml: file(1) magic for Objective Caml files.
+0 string Caml1999 Objective caml
+>8 string X exec file
+>8 string I interface file (.cmi)
+>8 string O object file (.cmo)
+>8 string A library file (.cma)
+>8 string Y native object file (.cmx)
+>8 string Z native library file (.cmxa)
+>8 string M abstract syntax tree implementation file
+>8 string N abstract syntax tree interface file
+>9 string >\0 (Version %3.3s).
diff --git a/contrib/file/Magdir/os2 b/contrib/file/Magdir/os2
index 7ae67c7..e492031 100644
--- a/contrib/file/Magdir/os2
+++ b/contrib/file/Magdir/os2
@@ -11,16 +11,16 @@
# OS/2 URL objects
# Provided 1998/08/22 by
# David Mediavilla <davidme.news@REMOVEIFNOTSPAMusa.net>
-0 string http: OS/2 URL object text
->5 string >\ (WWW) <http:%s>
-0 string mailto: OS/2 URL object text
->7 string >\ (email) <%s>
-0 string news: OS/2 URL object text
->5 string >\ (Usenet) <%s>
-0 string ftp: OS/2 URL object text
->4 string >\ (FTP) <ftp:%s>
-0 string file: OS/2 URL object text
->5 string >\ (Local file) <%s>
+#0 string http: OS/2 URL object text
+#>5 string >\ (WWW) <http:%s>
+#0 string mailto: OS/2 URL object text
+#>7 string >\ (email) <%s>
+#0 string news: OS/2 URL object text
+#>5 string >\ (Usenet) <%s>
+#0 string ftp: OS/2 URL object text
+#>4 string >\ (FTP) <ftp:%s>
+#0 string file: OS/2 URL object text
+#>5 string >\ (Local file) <%s>
# >>>>> OS/2 INF/HLP <<<<< (source: Daniel Dissett ddissett@netcom.com)
# Carl Hauser (chauser.parc@xerox.com) and
diff --git a/contrib/file/Magdir/palm b/contrib/file/Magdir/palm
index 46bc632..79af1f0 100644
--- a/contrib/file/Magdir/palm
+++ b/contrib/file/Magdir/palm
@@ -13,3 +13,79 @@
# HACK
60 belong 0x4841434b HackMaster hack
>0 string >\0 "%s"
+
+# Variety of PalmOS document types
+# Michael-John Turner <mj@debian.org>
+# Thanks to Hasan Umit Ezerce <humit@tr-net.net.tr> for his DocType
+60 string BVokBDIC BDicty PalmOS document
+>0 string >\0 "%s"
+60 string DB99DBOS DB PalmOS document
+>0 string >\0 "%s"
+60 string vIMGView FireViewer/ImageViewer PalmOS document
+>0 string >\0 "%s"
+60 string PmDBPmDB HanDBase PalmOS document
+>0 string >\0 "%s"
+60 string InfoINDB InfoView PalmOS document
+>0 string >\0 "%s"
+60 string ToGoToGo iSilo PalmOS document
+>0 string >\0 "%s"
+60 string JfDbJBas JFile PalmOS document
+>0 string >\0 "%s"
+60 string JfDbJFil JFile Pro PalmOS document
+>0 string >\0 "%s"
+60 string DATALSdb List PalmOS document
+>0 string >\0 "%s"
+60 string Mdb1Mdb1 MobileDB PalmOS document
+>0 string >\0 "%s"
+60 string PNRdPPrs PeanutPress PalmOS document
+>0 string >\0 "%s"
+60 string DataPlkr Plucker PalmOS document
+>0 string >\0 "%s"
+60 string DataSprd QuickSheet PalmOS document
+>0 string >\0 "%s"
+60 string SM01SMem SuperMemo PalmOS document
+>0 string >\0 "%s"
+60 string DataTlPt TealDoc PalmOS document
+>0 string >\0 "%s"
+60 string InfoTlIf TealInfo PalmOS document
+>0 string >\0 "%s"
+60 string DataTlMl TealMeal PalmOS document
+>0 string >\0 "%s"
+60 string DataTlPt TealPaint PalmOS document
+>0 string >\0 "%s"
+60 string dataTDBP ThinkDB PalmOS document
+>0 string >\0 "%s"
+60 string TdatTide Tides PalmOS document
+>0 string >\0 "%s"
+60 string ToRaTRPW TomeRaider PalmOS document
+>0 string >\0 "%s"
+
+# A GutenPalm zTXT etext for use on Palm Pilots (http://gutenpalm.sf.net)
+# For version 1.xx zTXTs, outputs version and numbers of bookmarks and
+# annotations.
+# For other versions, just outputs version.
+#
+60 string zTXT A GutenPalm zTXT e-book
+>0 string >\0 "%s"
+>(0x4E.L) byte 0
+>>(0x4E.L+1) byte x (v0.%02d)
+>(0x4E.L) byte 1
+>>(0x4E.L+1) byte x (v1.%02d)
+>>>(0x4E.L+10) beshort >0
+>>>>(0x4E.L+10) beshort <2 - 1 bookmark
+>>>>(0x4E.L+10) beshort >1 - %d bookmarks
+>>>(0x4E.L+14) beshort >0
+>>>>(0x4E.L+14) beshort <2 - 1 annotation
+>>>>(0x4E.L+14) beshort >1 - %d annotations
+>(0x4E.L) byte >1 (v%d.
+>>(0x4E.L+1) byte x %02d)
+
+# Palm OS .prc file types
+60 string libr Palm OS dynamic library data
+>0 string >\0 "%s"
+60 string ptch Palm OS operating system patch data
+>0 string >\0 "%s"
+
+# Mobipocket (www.mobipocket.com), donated by Carl Witty
+60 string BOOKMOBI Mobipocket E-book
+>0 string >\0 "%s"
diff --git a/contrib/file/Magdir/perl b/contrib/file/Magdir/perl
index 28b6086..f70b8dc 100644
--- a/contrib/file/Magdir/perl
+++ b/contrib/file/Magdir/perl
@@ -11,6 +11,7 @@
0 string eval\ "exec\ /usr/bin/perl perl script text
0 string/b #!\ /usr/local/bin/perl perl script text
0 string eval\ "exec\ /usr/local/bin/perl perl script text executable
+0 string eval\ '(exit\ $?0)'\ &&\ eval\ 'exec perl script text
# a couple more, by me
# XXX: christos matches
diff --git a/contrib/file/Magdir/plan9 b/contrib/file/Magdir/plan9
new file mode 100644
index 0000000..b564fc8
--- /dev/null
+++ b/contrib/file/Magdir/plan9
@@ -0,0 +1,4 @@
+#------------------------------------------------------------------------------
+# plan9: file(1) magic for AT&T Bell Labs' Plan 9 executables
+#
+0 belong 0x000001EB Plan 9 executable
diff --git a/contrib/file/Magdir/printer b/contrib/file/Magdir/printer
index dfbd5b9..388facf 100644
--- a/contrib/file/Magdir/printer
+++ b/contrib/file/Magdir/printer
@@ -83,10 +83,34 @@
#
# Now magic for IMAGEN font files...
0 string Rast RST-format raster font data
->45 string >0 face %
+>45 string >0 face %s
# From Jukka Ukkonen
0 string \033[K\002\0\0\017\033(a\001\0\001\033(g Canon Bubble Jet BJC formatted data
# From <mike@flyn.org>
# These are the /etc/magic entries to decode data sent to an Epson printer.
0 string \x1B\x40\x1B\x28\x52\x08\x00\x00REMOTE1P Epson Stylus Color 460 data
+
+
+#------------------------------------------------------------------------------
+# zenographics: file(1) magic for Zenographics ZjStream printer data
+# Rick Richardson rickr@mn.rr.com
+0 string JZJZ
+>0x12 string ZZ Zenographics ZjStream printer data (big-endian)
+0 string ZJZJ
+>0x12 string ZZ Zenographics ZjStream printer data (little-endian)
+
+
+#------------------------------------------------------------------------------
+# Oak Technologies printer stream
+# Rick Richardson <rickr@mn.rr.com>
+0 string OAK
+>0x07 byte 0
+>0x0b byte 0 Oak Technologies printer stream
+
+# This would otherwise be recognized as PostScript - nick@debian.org
+0 string %!VMF SunClock's Vector Map Format data
+
+#------------------------------------------------------------------------------
+# HP LaserJet 1000 series downloadable firmware file
+0 string \xbe\xefABCDEFGH HP LaserJet 1000 series downloadable firmware
diff --git a/contrib/file/Magdir/psion b/contrib/file/Magdir/psion
new file mode 100644
index 0000000..5e6ab1a
--- /dev/null
+++ b/contrib/file/Magdir/psion
@@ -0,0 +1,43 @@
+
+#------------------------------------------------------------------------------
+# psion: file(1) magic for Psion handhelds data
+# from: Peter Breitenlohner <peb@mppmu.mpg.de>
+#
+0 lelong 0x10000037 Psion Series 5
+>4 lelong 0x10000039 font file
+>4 lelong 0x1000003A printer driver
+>4 lelong 0x1000003B clipboard
+>4 lelong 0x10000042 multi-bitmap image
+>4 lelong 0x1000006A application infomation file
+>4 lelong 0x1000006D
+>>8 lelong 0x1000007D sketch image
+>>8 lelong 0x1000007E voice note
+>>8 lelong 0x1000007F word file
+>>8 lelong 0x10000085 OPL program
+>>8 lelong 0x10000088 sheet file
+>>8 lelong 0x100001C4 EasyFax initialisation file
+>4 lelong 0x10000073 OPO module
+>4 lelong 0x10000074 OPL application
+>4 lelong 0x1000008A exported multi-bitmap image
+
+0 lelong 0x10000041 Psion Series 5 ROM multi-bitmap image
+
+0 lelong 0x10000050 Psion Series 5
+>4 lelong 0x1000006D database
+>4 lelong 0x100000E4 ini file
+
+0 lelong 0x10000079 Psion Series 5 binary:
+>4 lelong 0x00000000 DLL
+>4 lelong 0x10000049 comms hardware library
+>4 lelong 0x1000004A comms protocol library
+>4 lelong 0x1000005D OPX
+>4 lelong 0x1000006C application
+>4 lelong 0x1000008D DLL
+>4 lelong 0x100000AC logical device driver
+>4 lelong 0x100000AD physical device driver
+>4 lelong 0x100000E5 file transfer protocol
+>4 lelong 0x100000E5 file transfer protocol
+>4 lelong 0x10000140 printer defintion
+>4 lelong 0x10000141 printer defintion
+
+0 lelong 0x1000007A Psion Series 5 executable
diff --git a/contrib/file/Magdir/python b/contrib/file/Magdir/python
index 1932fd2..ec4c121 100644
--- a/contrib/file/Magdir/python
+++ b/contrib/file/Magdir/python
@@ -11,4 +11,4 @@
0 belong 0x87c60d0a python 2.0 byte-compiled
0 belong 0x2aeb0d0a python 2.1 byte-compiled
0 belong 0x2ded0d0a python 2.2 byte-compiled
-#0 belong 0x31f20d0a python 2.3 byte-compiled
+0 belong 0x3bf20d0a python 2.3 byte-compiled
diff --git a/contrib/file/Magdir/revision b/contrib/file/Magdir/revision
new file mode 100644
index 0000000..36a829b
--- /dev/null
+++ b/contrib/file/Magdir/revision
@@ -0,0 +1,5 @@
+
+#------------------------------------------------------------------------------
+# file(1) magic for revision control files
+# From Hendrik Scholz <hendrik@scholz.net>
+0 string /1\ :pserver: cvs password text file
diff --git a/contrib/file/Magdir/riff b/contrib/file/Magdir/riff
index a81eb93..a79dd66a 100644
--- a/contrib/file/Magdir/riff
+++ b/contrib/file/Magdir/riff
@@ -5,13 +5,7 @@
#
# http://www.seanet.com/users/matts/riffmci/riffmci.htm
#
-# and
-#
-# http://www.ora.com/centers/gff/formats/micriff/index.htm
-#
-# and
-#
-# http://www.jtauber.com/music/encoding/niff/spec/
+# AVI section extended by Patrik Rådman <patrik+file-magic@iki.fi>
#
0 string RIFF RIFF (little-endian) data
# RIFF Palette format
@@ -40,8 +34,8 @@
>>20 leshort 1 \b, Microsoft PCM
>>>34 leshort >0 \b, %d bit
>>20 leshort 2 \b, Microsoft ADPCM
->>20 leshort 6 \b, ITU G.711 a-law
->>20 leshort 7 \b, ITU G.711 u-law
+>>20 leshort 6 \b, ITU G.711 A-law
+>>20 leshort 7 \b, ITU G.711 mu-law
>>20 leshort 17 \b, IMA ADPCM
>>20 leshort 20 \b, ITU G.723 ADPCM (Yamaha)
>>20 leshort 49 \b, GSM 6.10
@@ -52,10 +46,124 @@
>>22 leshort =2 \b, stereo
>>22 leshort >2 \b, %d channels
>>24 lelong >0 %d Hz
+# Corel Draw Picture
+>8 string CDRA \b, Corel Draw Picture
# AVI == Audio Video Interleave
->8 string AVI\ \b, AVI
+>8 string AVI\040 \b, AVI
+>>12 string LIST
+>>>20 string hdrlavih
+>>>>&36 lelong x \b, %lu x
+>>>>&40 lelong x %lu,
+>>>>&4 lelong >1000000 <1 fps,
+>>>>&4 lelong 1000000 1.00 fps,
+>>>>&4 lelong 500000 2.00 fps,
+>>>>&4 lelong 333333 3.00 fps,
+>>>>&4 lelong 250000 4.00 fps,
+>>>>&4 lelong 200000 5.00 fps,
+>>>>&4 lelong 166667 6.00 fps,
+>>>>&4 lelong 142857 7.00 fps,
+>>>>&4 lelong 125000 8.00 fps,
+>>>>&4 lelong 111111 9.00 fps,
+>>>>&4 lelong 100000 10.00 fps,
+# ]9.9,10.1[
+>>>>&4 lelong <101010
+>>>>>&-4 lelong >99010
+>>>>>>&-4 lelong !100000 ~10 fps,
+>>>>&4 lelong 83333 12.00 fps,
+# ]11.9,12.1[
+>>>>&4 lelong <84034
+>>>>>&-4 lelong >82645
+>>>>>>&-4 lelong !83333 ~12 fps,
+>>>>&4 lelong 66667 15.00 fps,
+# ]14.9,15.1[
+>>>>&4 lelong <67114
+>>>>>&-4 lelong >66225
+>>>>>>&-4 lelong !66667 ~15 fps,
+>>>>&4 lelong 50000 20.00 fps,
+>>>>&4 lelong 41708 23.98 fps,
+>>>>&4 lelong 41667 24.00 fps,
+# ]23.9,24.1[
+>>>>&4 lelong <41841
+>>>>>&-4 lelong >41494
+>>>>>>&-4 lelong !41708
+>>>>>>>&-4 lelong !41667 ~24 fps,
+>>>>&4 lelong 40000 25.00 fps,
+# ]24.9,25.1[
+>>>>&4 lelong <40161
+>>>>>&-4 lelong >39841
+>>>>>>&-4 lelong !40000 ~25 fps,
+>>>>&4 lelong 33367 29.97 fps,
+>>>>&4 lelong 33333 30.00 fps,
+# ]29.9,30.1[
+>>>>&4 lelong <33445
+>>>>>&-4 lelong >33223
+>>>>>>&-4 lelong !33367
+>>>>>>>&-4 lelong !33333 ~30 fps,
+>>>>&4 lelong <32224 >30 fps,
+##>>>>&4 lelong x (%lu)
+##>>>>&20 lelong x %lu frames,
+# Note: The tests below assume that the AVI has 1 or 2 streams,
+# "vids" optionally followed by "auds".
+# (Should cover 99.9% of all AVIs.)
+# assuming avih length = 56
+>>>88 string LIST
+>>>>96 string strlstrh
+>>>>>108 string vids video:
+>>>>>>&0 lelong 0 uncompressed
+# skip past vids strh
+>>>>>>(104.l+108) string strf
+>>>>>>>(104.l+132) lelong 1 RLE 8bpp
+>>>>>>>(104.l+132) string/c cvid Cinepak
+>>>>>>>(104.l+132) string/c i263 Intel I.263
+>>>>>>>(104.l+132) string/c iv32 Indeo 3.2
+>>>>>>>(104.l+132) string/c iv41 Indeo 4.1
+>>>>>>>(104.l+132) string/c iv50 Indeo 5.0
+>>>>>>>(104.l+132) string/c mp42 Microsoft MPEG-4 v2
+>>>>>>>(104.l+132) string/c mp43 Microsoft MPEG-4 v3
+>>>>>>>(104.l+132) string/c mjpg Motion JPEG
+>>>>>>>(104.l+132) string/c div3 DivX 3
+>>>>>>>>112 string/c div3 Low-Motion
+>>>>>>>>112 string/c div4 Fast-Motion
+>>>>>>>(104.l+132) string/c divx DivX 4
+>>>>>>>(104.l+132) string/c dx50 DivX 5
+>>>>>>>(104.l+132) string/c xvid XviD
+>>>>>>>(104.l+132) lelong 0
+##>>>>>>>(104.l+132) string x (%.4s)
+# skip past first (video) LIST
+>>>>(92.l+96) string LIST
+>>>>>(92.l+104) string strlstrh
+>>>>>>(92.l+116) string auds \b, audio:
+# auds strh length = 56:
+>>>>>>>(92.l+172) string strf
+>>>>>>>>(92.l+180) leshort 0x0001 uncompressed PCM
+>>>>>>>>(92.l+180) leshort 0x0002 ADPCM
+>>>>>>>>(92.l+180) leshort 0x0055 MPEG-1 Layer 3
+>>>>>>>>(92.l+180) leshort 0x2000 Dolby AC3
+>>>>>>>>(92.l+180) leshort 0x0161 DivX
+##>>>>>>>>(92.l+180) leshort x (0x%.4x)
+>>>>>>>>(92.l+182) leshort 1 (mono,
+>>>>>>>>(92.l+182) leshort 2 (stereo,
+>>>>>>>>(92.l+182) leshort >2 (%d channels,
+>>>>>>>>(92.l+184) lelong x %d Hz)
+# auds strh length = 64:
+>>>>>>>(92.l+180) string strf
+>>>>>>>>(92.l+188) leshort 0x0001 uncompressed PCM
+>>>>>>>>(92.l+188) leshort 0x0002 ADPCM
+>>>>>>>>(92.l+188) leshort 0x0055 MPEG-1 Layer 3
+>>>>>>>>(92.l+188) leshort 0x2000 Dolby AC3
+>>>>>>>>(92.l+188) leshort 0x0161 DivX
+##>>>>>>>>(92.l+188) leshort x (0x%.4x)
+>>>>>>>>(92.l+190) leshort 1 (mono,
+>>>>>>>>(92.l+190) leshort 2 (stereo,
+>>>>>>>>(92.l+190) leshort >2 (%d channels,
+>>>>>>>>(92.l+192) lelong x %d Hz)
# Animated Cursor format
>8 string ACON \b, animated cursor
+# SoundFont 2 <mpruett@sgi.com>
+>8 string sfbk SoundFont/Bank
+# MPEG-1 wrapped in a RIFF, apparently
+>8 string CDXA \b, wrapped MPEG-1 (CDXA)
+>8 string 4XMV \b, 4X Movie file
#
# XXX - some of the below may only appear in little-endian form.
@@ -93,12 +201,13 @@
>>22 beshort =2 \b, stereo
>>22 beshort >2 \b, %d channels
>>24 belong >0 %d Hz
+# Corel Draw Picture
+>8 string CDRA \b, Corel Draw Picture
# AVI == Audio Video Interleave
->8 string AVI\ \b, AVI
+>8 string AVI\040 \b, AVI
# Animated Cursor format
>8 string ACON \b, animated cursor
# Notation Interchange File Format (big-endian only)
>8 string NIFF \b, Notation Interchange File Format
-
# SoundFont 2 <mpruett@sgi.com>
->8 string sfbk SoundFont 2
+>8 string sfbk SoundFont/Bank
diff --git a/contrib/file/Magdir/rpm b/contrib/file/Magdir/rpm
index 14ad6db..09ee51b 100644
--- a/contrib/file/Magdir/rpm
+++ b/contrib/file/Magdir/rpm
@@ -2,7 +2,7 @@
#
# RPM: file(1) magic for Red Hat Packages Erik Troan (ewt@redhat.com)
#
-0 beshort 0xedab
+0 beshort 0xedab
>2 beshort 0xeedb RPM
>>4 byte x v%d
>>6 beshort 0 bin
@@ -13,5 +13,10 @@
>>8 beshort 4 MIPS
>>8 beshort 5 PowerPC
>>8 beshort 6 68000
->>8 beshort 7 SGI
+>>8 beshort 7 SGI
+>>8 beshort 8 RS6000
+>>8 beshort 9 IA64
+>>8 beshort 10 Sparc64
+>>8 beshort 11 MIPSel
+>>8 beshort 12 ARM
>>10 string x %s
diff --git a/contrib/file/Magdir/sgi b/contrib/file/Magdir/sgi
index 1983f0d..23f182a 100644
--- a/contrib/file/Magdir/sgi
+++ b/contrib/file/Magdir/sgi
@@ -1,177 +1,59 @@
#------------------------------------------------------------------------------
-# sgi: file(1) magic for Silicon Graphics (MIPS, IRIS, IRIX, etc.)
-# Dec Ultrix (MIPS)
-# all of SGI's *current* machines and OSes run in big-endian mode on the
-# MIPS machines, as far as I know.
-#
-# XXX - what is the blank "-" line?
-#
-# kbd file definitions
-0 string kbd!map kbd map file
->8 byte >0 Ver %d:
->10 short >0 with %d table(s)
-0 belong 0407 old SGI 68020 executable
-0 belong 0410 old SGI 68020 pure executable
-0 beshort 0x8765 disk quotas file
-0 beshort 0x0506 IRIS Showcase file
->2 byte 0x49 -
->3 byte x - version %ld
-0 beshort 0x0226 IRIS Showcase template
->2 byte 0x63 -
->3 byte x - version %ld
-0 belong 0x5343464d IRIS Showcase file
->4 byte x - version %ld
-0 belong 0x5443464d IRIS Showcase template
->4 byte x - version %ld
-0 belong 0xdeadbabe IRIX Parallel Arena
->8 belong >0 - version %ld
-#
-0 beshort 0x0160 MIPSEB COFF executable
->20 beshort 0407 (impure)
->20 beshort 0410 (swapped)
->20 beshort 0413 (paged)
->8 belong >0 not stripped
->8 belong 0 stripped
->22 byte x - version %ld
->23 byte x .%ld
-#
-0 beshort 0x0162 MIPSEL COFF executable
->20 beshort 0407 (impure)
->20 beshort 0410 (swapped)
->20 beshort 0413 (paged)
->8 belong >0 not stripped
->8 belong 0 stripped
->23 byte x - version %d
->22 byte x .%ld
-#
-0 beshort 0x6001 MIPSEB-LE COFF executable
->20 beshort 03401 (impure)
->20 beshort 04001 (swapped)
->20 beshort 05401 (paged)
->8 belong >0 not stripped
->8 belong 0 stripped
->23 byte x - version %d
->22 byte x .%ld
-#
-0 beshort 0x6201 MIPSEL-LE COFF executable
->20 beshort 03401 (impure)
->20 beshort 04001 (swapped)
->20 beshort 05401 (paged)
->8 belong >0 not stripped
->8 belong 0 stripped
->23 byte x - version %ld
->22 byte x .%ld
-#
-# MIPS 2 additions
-#
-0 beshort 0x0163 MIPSEB MIPS-II COFF executable
->20 beshort 0407 (impure)
->20 beshort 0410 (swapped)
->20 beshort 0413 (paged)
->8 belong >0 not stripped
->8 belong 0 stripped
->22 byte x - version %ld
->23 byte x .%ld
-#
-0 beshort 0x0166 MIPSEL MIPS-II COFF executable
->20 beshort 0407 (impure)
->20 beshort 0410 (swapped)
->20 beshort 0413 (paged)
->8 belong >0 not stripped
->8 belong 0 stripped
->22 byte x - version %ld
->23 byte x .%ld
-#
-0 beshort 0x6301 MIPSEB-LE MIPS-II COFF executable
->20 beshort 03401 (impure)
->20 beshort 04001 (swapped)
->20 beshort 05401 (paged)
->8 belong >0 not stripped
->8 belong 0 stripped
->23 byte x - version %ld
->22 byte x .%ld
-#
-0 beshort 0x6601 MIPSEL-LE MIPS-II COFF executable
->20 beshort 03401 (impure)
->20 beshort 04001 (swapped)
->20 beshort 05401 (paged)
->8 belong >0 not stripped
->8 belong 0 stripped
->23 byte x - version %ld
->22 byte x .%ld
-#
-# MIPS 3 additions
-#
-0 beshort 0x0140 MIPSEB MIPS-III COFF executable
->20 beshort 0407 (impure)
->20 beshort 0410 (swapped)
->20 beshort 0413 (paged)
->8 belong >0 not stripped
->8 belong 0 stripped
->22 byte x - version %ld
->23 byte x .%ld
-#
-0 beshort 0x0142 MIPSEL MIPS-III COFF executable
->20 beshort 0407 (impure)
->20 beshort 0410 (swapped)
->20 beshort 0413 (paged)
->8 belong >0 not stripped
->8 belong 0 stripped
->22 byte x - version %ld
->23 byte x .%ld
-#
-0 beshort 0x4001 MIPSEB-LE MIPS-III COFF executable
->20 beshort 03401 (impure)
->20 beshort 04001 (swapped)
->20 beshort 05401 (paged)
->8 belong >0 not stripped
->8 belong 0 stripped
->23 byte x - version %ld
->22 byte x .%ld
-#
-0 beshort 0x4201 MIPSEL-LE MIPS-III COFF executable
->20 beshort 03401 (impure)
->20 beshort 04001 (swapped)
->20 beshort 05401 (paged)
->8 belong >0 not stripped
->8 belong 0 stripped
->23 byte x - version %ld
->22 byte x .%ld
-#
-0 beshort 0x180 MIPSEB Ucode
-0 beshort 0x182 MIPSEL Ucode
-# 32bit core file
-0 belong 0xdeadadb0 IRIX core dump
->4 belong 1 of
->16 string >\0 '%s'
-# 64bit core file
-0 belong 0xdeadad40 IRIX 64-bit core dump
->4 belong 1 of
->16 string >\0 '%s'
-# N32bit core file
-0 belong 0xbabec0bb IRIX N32 core dump
->4 belong 1 of
->16 string >\0 '%s'
-# New style crash dump file
-0 string \x43\x72\x73\x68\x44\x75\x6d\x70 IRIX vmcore dump of
->36 string >\0 '%s'
-# Trusted IRIX info
-0 string SGIAUDIT SGI Audit file
->8 byte x - version %d
->9 byte x .%ld
+# sgi: file(1) magic for Silicon Graphics applications
+
#
-0 string WNGZWZSC Wingz compiled script
-0 string WNGZWZSS Wingz spreadsheet
-0 string WNGZWZHP Wingz help file
#
-0 string \#Inventor V IRIS Inventor 1.0 file
-0 string \#Inventor V2 Open Inventor 2.0 file
-# GLF is OpenGL stream encoding
-0 string glfHeadMagic(); GLF_TEXT
-4 belong 0x7d000000 GLF_BINARY_LSB_FIRST
-4 belong 0x0000007d GLF_BINARY_MSB_FIRST
-# GLS is OpenGL stream encoding; GLS is the successor of GLF
-0 string glsBeginGLS( GLS_TEXT
-4 belong 0x10000000 GLS_BINARY_LSB_FIRST
-4 belong 0x00000010 GLS_BINARY_MSB_FIRST
+# Performance Co-Pilot file types
+0 string PmNs PCP compiled namespace (V.0)
+0 string PmN PCP compiled namespace
+>3 string >\0 (V.%1.1s)
+3 lelong 0x84500526 PCP archive
+>7 byte x (V.%d)
+>20 lelong -2 temporal index
+>20 lelong -1 metadata
+>20 lelong 0 log volume #0
+>20 lelong >0 log volume #%ld
+>24 string >\0 host: %s
+0 string PCPFolio PCP
+>9 string Version: Archive Folio
+>18 string >\0 (V.%s)
+0 string #pmchart PCP pmchart view
+>9 string Version
+>17 string >\0 (V%-3.3s)
+0 string pmview PCP pmview config
+>7 string Version
+>15 string >\0 (V%-3.3s)
+0 string #pmlogger PCP pmlogger config
+>10 string Version
+>18 string >\0 (V%1.1s)
+0 string PcPh PCP Help
+>4 string 1 Index
+>4 string 2 Text
+>5 string >\0 (V.%1.1s)
+0 string #pmieconf-rules PCP pmieconf rules
+>16 string >\0 (V.%1.1s)
+3 string pmieconf-pmie PCP pmie config
+>17 string >\0 (V.%1.1s)
+
+# SpeedShop data files
+0 lelong 0x13130303 SpeedShop data file
+
+# mdbm files
+0 lelong 0x01023962 mdbm file, version 0 (obsolete)
+0 string mdbm mdbm file,
+>5 byte x version %d,
+>6 byte x 2^%d pages,
+>7 byte x pagesize 2^%d,
+>17 byte x hash %d,
+>11 byte x dataformat %d
+
+# Alias|Wavefront Maya files
+0 string //Maya ASCII Alias|Wavefront Maya Ascii File,
+>13 string >\0 version %s
+8 string MAYAFOR4 Alias|Wavefront Maya Binary File,
+>32 string >\0 version %s scene
+8 string MayaFOR4 Alias|Wavefront Maya Binary File,
+>32 string >\0 version %s scene
+8 string CIMG Alias|Wavefront Maya Image File
+8 string DEEP Alias|Wavefront Maya Image File
diff --git a/contrib/file/Magdir/sgml b/contrib/file/Magdir/sgml
index 55b8301..9f33529 100644
--- a/contrib/file/Magdir/sgml
+++ b/contrib/file/Magdir/sgml
@@ -4,14 +4,21 @@
# HyperText Markup Language (HTML) is an SGML document type,
# from Daniel Quinlan (quinlan@yggdrasil.com)
# adapted to string extenstions by Anthon van der Neut <anthon@mnt.org)
-0 string/cB \<!doctype\ html HTML document text
+0 string/cB \<!DOCTYPE\ html HTML document text
0 string/cb \<head HTML document text
0 string/cb \<title HTML document text
0 string/cb \<html HTML document text
# Extensible markup language (XML), a subset of SGML
# from Marc Prud'hommeaux (marc@apocalypse.org)
-0 string/cb \<?xml XML document text
+0 string/cb \<?xml XML document text
+0 string \<?xml\ version " XML
+0 string \<?xml\ version=" XML
+>15 string >\0 %.3s document text
+>>23 string \<xsl:stylesheet (XSL stylesheet)
+>>24 string \<xsl:stylesheet (XSL stylesheet)
+0 string/b \<?xml XML document text
+0 string/cb \<?xml broken XML document text
# SGML, mostly from rph@sq
diff --git a/contrib/file/Magdir/sinclair b/contrib/file/Magdir/sinclair
new file mode 100644
index 0000000..702875e
--- /dev/null
+++ b/contrib/file/Magdir/sinclair
@@ -0,0 +1,126 @@
+
+#------------------------------------------------------------------------------
+# sinclair: file(1) sinclair QL
+
+# additions to /etc/magic by Thomas M. Ott (ThMO)
+
+# Sinclair QL floppy disk formats (ThMO)
+0 string =QL5 QL disk dump data,
+>3 string =A 720 KB,
+>3 string =B 1.44 MB,
+>3 string =C 3.2 MB,
+>4 string >\0 label:%.10s
+
+# Sinclair QL OS dump (ThMO)
+# (NOTE: if `file' would be able to use indirect references in a endian format
+# differing from the natural host format, this could be written more
+# reliably and faster...)
+#
+# we *can't* lookup QL OS code dumps, because `file' is UNABLE to read more
+# than the first 8K of a file... #-(
+#
+#0 belong =0x30000
+#>49124 belong <47104
+#>>49128 belong <47104
+#>>>49132 belong <47104
+#>>>>49136 belong <47104 QL OS dump data,
+#>>>>>49148 string >\0 type %.3s,
+#>>>>>49142 string >\0 version %.4s
+
+# Sinclair QL firmware executables (ThMO)
+0 string NqNqNq`\004 QL firmware executable (BCPL)
+
+# Sinclair QL libraries (ThMO)
+0 beshort =0xFB01 QL library archive data
+
+# Sinclair QL executbables (ThMO)
+6 beshort =0x4AFB QL executable,
+>10 string =\0 un-named
+>8 beshort =1
+>>10 string >\0 named: %.1s
+>8 beshort =2
+>>10 string >\0 named: %.2s
+>8 beshort =3
+>>10 string >\0 named: %.3s
+>8 beshort =4
+>>10 string >\0 named: %.4s
+>8 beshort =5
+>>10 string >\0 named: %.5s
+>8 beshort =6
+>>10 string >\0 named: %.6s
+>8 beshort =7
+>>10 string >\0 named: %.7s
+>8 beshort =8
+>>10 string >\0 named: %.8s
+>8 beshort =9
+>>10 string >\0 named: %.9s
+>8 beshort =10
+>>10 string >\0 named: %.10s
+>8 beshort =11
+>>10 string >\0 named: %.11s
+>8 beshort =12
+>>10 string >\0 named: %.12s
+>8 beshort =13
+>>10 string >\0 named: %.13s
+>8 beshort =14
+>>10 string >\0 named: %.14s
+>8 beshort =15
+>>10 string >\0 named: %.15s
+>8 beshort =16
+>>10 string >\0 named: %.16s
+>8 beshort =17
+>>10 string >\0 named: %.17s
+>8 beshort =18
+>>10 string >\0 named: %.18s
+>8 beshort =19
+>>10 string >\0 named: %.19s
+>8 beshort =20
+>>10 string >\0 named: %.20s
+>8 beshort >20
+>>10 string >\0 (truncated) named: %.20s
+
+# Sinclair QL rom (ThMO)
+0 belong =0x4AFB0001 QL plugin-ROM data,
+>10 string =\0 un-named
+>8 beshort =1
+>>10 string >\0 named: %.1s
+>8 beshort =2
+>>10 string >\0 named: %.2s
+>8 beshort =3
+>>10 string >\0 named: %.3s
+>8 beshort =4
+>>10 string >\0 named: %.4s
+>8 beshort =5
+>>10 string >\0 named: %.5s
+>8 beshort =6
+>>10 string >\0 named: %.6s
+>8 beshort =7
+>>10 string >\0 named: %.7s
+>8 beshort =8
+>>10 string >\0 named: %.8s
+>8 beshort =9
+>>10 string >\0 named: %.9s
+>8 beshort =10
+>>10 string >\0 named: %.10s
+>8 beshort =11
+>>10 string >\0 named: %.11s
+>8 beshort =12
+>>10 string >\0 named: %.12s
+>8 beshort =13
+>>10 string >\0 named: %.13s
+>8 beshort =14
+>>10 string >\0 named: %.14s
+>8 beshort =15
+>>10 string >\0 named: %.15s
+>8 beshort =16
+>>10 string >\0 named: %.16s
+>8 beshort =17
+>>10 string >\0 named: %.17s
+>8 beshort =18
+>>10 string >\0 named: %.18s
+>8 beshort =19
+>>10 string >\0 named: %.19s
+>8 beshort =20
+>>10 string >\0 named: %.20s
+>8 beshort >20
+>>10 string >\0 (truncated) named: %.20s
diff --git a/contrib/file/Magdir/sniffer b/contrib/file/Magdir/sniffer
index 626439e..b45b63e 100644
--- a/contrib/file/Magdir/sniffer
+++ b/contrib/file/Magdir/sniffer
@@ -9,23 +9,25 @@
# Microsoft Network Monitor 1.x capture files.
#
0 string RTSS NetMon capture file
->4 byte x - version %d
->5 byte x \b.%d
+>5 byte x - version %d
+>4 byte x \b.%d
>6 leshort 0 (Unknown)
>6 leshort 1 (Ethernet)
>6 leshort 2 (Token Ring)
>6 leshort 3 (FDDI)
+>6 leshort 4 (ATM)
#
# Microsoft Network Monitor 2.x capture files.
#
0 string GMBU NetMon capture file
->4 byte x - version %d
->5 byte x \b.%d
+>5 byte x - version %d
+>4 byte x \b.%d
>6 leshort 0 (Unknown)
>6 leshort 1 (Ethernet)
>6 leshort 2 (Token Ring)
>6 leshort 3 (FDDI)
+>6 leshort 4 (ATM)
#
# Network General Sniffer capture files.
@@ -58,6 +60,9 @@
>44 leshort 0 (Ethernet)
>44 leshort 1 (Token Ring)
>44 leshort 2 (FDDI)
+>44 leshort 3 (WAN)
+>44 leshort 8 (ATM)
+>44 leshort 9 (802.11)
#
# "libpcap" capture files.
@@ -75,7 +80,7 @@
>20 belong 4 (ProNET
>20 belong 5 (CHAOS
>20 belong 6 (Token Ring
->20 belong 7 (ARCNET
+>20 belong 7 (BSD ARCNET
>20 belong 8 (SLIP
>20 belong 9 (PPP
>20 belong 10 (FDDI
@@ -92,10 +97,21 @@
>20 belong 104 (BSD/OS Cisco HDLC
>20 belong 105 (802.11
>20 belong 106 (Linux Classical IP over ATM
+>20 belong 107 (Frame Relay
>20 belong 108 (OpenBSD loopback
->20 belong 109 (OpenBSD IPSEC encrypted
+>20 belong 109 (OpenBSD IPsec encrypted
+>20 belong 112 (Cisco HDLC
>20 belong 113 (Linux "cooked"
>20 belong 114 (LocalTalk
+>20 belong 117 (OpenBSD PFLOG
+>20 belong 119 (802.11 with Prism header
+>20 belong 123 (SunATM
+>20 belong 127 (802.11 with radiotap header
+>20 belong 129 (Linux ARCNET
+>20 belong 140 (MTP2
+>20 belong 141 (MTP3
+>20 belong 143 (DOCSIS
+>20 belong 144 (IrDA
>16 belong x \b, capture length %d)
0 ulelong 0xa1b2c3d4 tcpdump capture file (little-endian)
>4 leshort x - version %d
@@ -124,10 +140,21 @@
>20 lelong 104 (BSD/OS Cisco HDLC
>20 lelong 105 (802.11
>20 lelong 106 (Linux Classical IP over ATM
+>20 lelong 107 (Frame Relay
>20 lelong 108 (OpenBSD loopback
>20 lelong 109 (OpenBSD IPSEC encrypted
+>20 lelong 112 (Cisco HDLC
>20 lelong 113 (Linux "cooked"
>20 lelong 114 (LocalTalk
+>20 lelong 117 (OpenBSD PFLOG
+>20 lelong 119 (802.11 with Prism header
+>20 lelong 123 (SunATM
+>20 lelong 127 (802.11 with radiotap header
+>20 lelong 129 (Linux ARCNET
+>20 lelong 140 (MTP2
+>20 lelong 141 (MTP3
+>20 lelong 143 (DOCSIS
+>20 lelong 144 (IrDA
>16 lelong x \b, capture length %d)
#
@@ -178,6 +205,7 @@
#
# AIX "iptrace" capture files.
#
+0 string iptrace\ 1.0 "iptrace" capture file
0 string iptrace\ 2.0 "iptrace" capture file
#
diff --git a/contrib/file/Magdir/spec b/contrib/file/Magdir/spec
new file mode 100644
index 0000000..bfda306
--- /dev/null
+++ b/contrib/file/Magdir/spec
@@ -0,0 +1,20 @@
+
+#------------------------------------------------------------------------------
+# spec: file(1) magic for SPEC raw results (*.raw, *.rsf)
+#
+# Cloyce D. Spradling <cloyce@headgear.org>
+
+0 string spec SPEC
+>4 string .cpu CPU
+>>8 string <: \b%.4s
+>>12 string . raw result text
+
+17 string version=SPECjbb SPECjbb
+>32 string <: \b%.4s
+>>37 string <: v%.4s raw result text
+
+0 string BEGIN\040SPECWEB SPECweb
+>13 string <: \b%.2s
+>>15 string _SSL \b_SSL
+>>>20 string <: v%.4s raw result text
+>>16 string <: v%.4s raw result text
diff --git a/contrib/file/Magdir/spectrum b/contrib/file/Magdir/spectrum
index e7a5549..ab9fd04 100644
--- a/contrib/file/Magdir/spectrum
+++ b/contrib/file/Magdir/spectrum
@@ -26,3 +26,19 @@
>3 byte 2 - character array
>3 byte 3 - memory block
>>14 belong 0x001B0040 (screen)
+
+# The following three blocks are from pak21-spectrum@srcf.ucam.org
+# TZX tape images
+0 string ZXTape!\x1a Spectrum .TZX data
+>8 byte x version %d
+>9 byte x .%d
+
+# RZX input recording files
+0 string RZX! Spectrum .RZX data
+>4 byte x version %d
+>5 byte x .%d
+
+# And three sorts of disk image
+0 string MV\ -\ CPCEMU\ Disk-Fil Amstrad/Spectrum .DSK data
+0 string MV\ -\ CPC\ format\ Dis Amstrad/Spectrum DU54 .DSK data
+0 string EXTENDED\ CPC\ DSK\ Fil Amstrad/Spectrum Extended .DSK data
diff --git a/contrib/file/Magdir/sun b/contrib/file/Magdir/sun
index 10f30b4..4c43b27 100644
--- a/contrib/file/Magdir/sun
+++ b/contrib/file/Magdir/sun
@@ -101,7 +101,23 @@
>12 belong 7 (IBM channel-to-channel adapter)
>12 belong 8 (FDDI)
>12 belong 9 (Unknown)
+
+# Microsoft ICM color profile
+36 string acspMSFT Microsoft ICM Color Profile
# Sun KCMS
36 string acsp Kodak Color Management System, ICC Profile
+#---------------------------------------------------------------------------
+# The following entries have been tested by Duncan Laurie <duncan@sun.com> (a
+# lead Sun/Cobalt developer) who agrees that they are good and worthy of
+# inclusion.
+
+# Boot ROM images for Sun/Cobalt Linux server appliances
+0 string Cobalt\ Networks\ Inc.\nFirmware\ v Paged COBALT boot rom
+>38 string x V%.4s
+
+# New format for Sun/Cobalt boot ROMs is annoying, it stores the version code
+# at the very end where file(1) can't get it.
+0 string CRfs COBALT boot rom data (Flat boot rom or file system)
+
diff --git a/contrib/file/Magdir/sysex b/contrib/file/Magdir/sysex
index 9a3fe2e..e2a4bd8 100644
--- a/contrib/file/Magdir/sysex
+++ b/contrib/file/Magdir/sysex
@@ -4,13 +4,63 @@
#
0 byte 0xF0 SysEx File -
+# North American Group
+>1 byte 0x01 Sequential
+>1 byte 0x02 IDP
+>1 byte 0x03 OctavePlateau
+>1 byte 0x04 Moog
+>1 byte 0x05 Passport
+>1 byte 0x06 Lexicon
+>1 byte 0x07 Kurzweil
+>1 byte 0x08 Fender
+>1 byte 0x09 Gulbransen
+>1 byte 0x0a AKG
+>1 byte 0x0b Voyce
+>1 byte 0x0c Waveframe
+>1 byte 0x0d ADA
+>1 byte 0x0e Garfield
+>1 byte 0x0f Ensoniq
+>1 byte 0x10 Oberheim
+>1 byte 0x11 Apple
+>1 byte 0x12 GreyMatter
+>1 byte 0x14 PalmTree
+>1 byte 0x15 JLCooper
+>1 byte 0x16 Lowrey
+>1 byte 0x17 AdamsSmith
+>1 byte 0x18 E-mu
+>1 byte 0x19 Harmony
+>1 byte 0x1a ART
+>1 byte 0x1b Baldwin
+>1 byte 0x1c Eventide
+>1 byte 0x1d Inventronics
+>1 byte 0x1f Clarity
+
+# European Group
+>1 byte 0x21 SIEL
+>1 byte 0x22 Synthaxe
+>1 byte 0x24 Hohner
+>1 byte 0x25 Twister
+>1 byte 0x26 Solton
+>1 byte 0x27 Jellinghaus
+>1 byte 0x28 Southworth
+>1 byte 0x29 PPG
+>1 byte 0x2a JEN
+>1 byte 0x2b SSL
+>1 byte 0x2c AudioVertrieb
+
>1 byte 0x2f ELKA
>>3 byte 0x09 EK-44
+>1 byte 0x30 Dynacord
+>1 byte 0x33 Clavia
+>1 byte 0x39 Soundcraft
+
>1 byte 0x3e Waldorf
>>3 byte 0x7f Microwave I
+# Japanese Group
>1 byte 0x40 Kawai
+>>3 byte 0x20 K1
>>3 byte 0x22 K4
>1 byte 0x41 Roland
@@ -26,6 +76,7 @@
>1 byte 0x46 Kamiya
>1 byte 0x47 Akai
>1 byte 0x48 Victor
+>1 byte 0x49 Mesosha
>1 byte 0x4b Fujitsu
>1 byte 0x4c Sony
>1 byte 0x4e Teac
diff --git a/contrib/file/Magdir/ti-8x b/contrib/file/Magdir/ti-8x
index d740060..89e2204 100644
--- a/contrib/file/Magdir/ti-8x
+++ b/contrib/file/Magdir/ti-8x
@@ -1,36 +1,237 @@
# ------------------------------------------------------------------------
-# ti-8x: file(1) magic for the TI-8x and TI-92 Graphing Calculators.
+# ti-8x: file(1) magic for the TI-8x and TI-9x Graphing Calculators.
#
# From: Ryan McGuire (rmcguire@freenet.columbus.oh.us).
#
+# Update: Romain Lievin (roms@lpg.ticalc.org).
+#
# NOTE: This list is not complete.
+# Files for the TI-80 and TI-81 are pretty rare. I'm not going to put the
+# program/group magic numbers in here because I cannot find any.
+0 string **TI80** TI-80 Graphing Calculator File.
+0 string **TI81** TI-81 Graphing Calculator File.
+#
+# Magic Numbers for the TI-73
#
+0 string **TI73** TI-73 Graphing Calculator
+>0x00003B byte 0x00 (real number)
+>0x00003B byte 0x01 (list)
+>0x00003B byte 0x02 (matrix)
+>0x00003B byte 0x03 (equation)
+>0x00003B byte 0x04 (string)
+>0x00003B byte 0x05 (program)
+>0x00003B byte 0x06 (assembly program)
+>0x00003B byte 0x07 (picture)
+>0x00003B byte 0x08 (gdb)
+>0x00003B byte 0x0C (complex number)
+>0x00003B byte 0x0F (window settings)
+>0x00003B byte 0x10 (zoom)
+>0x00003B byte 0x11 (table setup)
+>0x00003B byte 0x13 (backup)
+
# Magic Numbers for the TI-82
#
-0 string **TI82** TI-82 Graphing Calculator
->0x000037 byte 0x0B TI-BASIC Group/Program File.
+0 string **TI82** TI-82 Graphing Calculator
+>0x00003B byte 0x00 (real)
+>0x00003B byte 0x01 (list)
+>0x00003B byte 0x02 (matrix)
+>0x00003B byte 0x03 (Y-variable)
+>0x00003B byte 0x05 (program)
+>0x00003B byte 0x06 (protected prgm)
+>0x00003B byte 0x07 (picture)
+>0x00003B byte 0x08 (gdb)
+>0x00003B byte 0x0B (window settings)
+>0x00003B byte 0x0C (window settings)
+>0x00003B byte 0x0D (table setup)
+>0x00003B byte 0x0E (screenshot)
+>0x00003B byte 0x0F (backup)
#
# Magic Numbers for the TI-83
#
-0 string **TI83** TI-83 Graphing Calculator
->0x000037 byte 0x0B TI-BASIC Group/Program File.
+0 string **TI83** TI-83 Graphing Calculator
+>0x00003B byte 0x00 (real)
+>0x00003B byte 0x01 (list)
+>0x00003B byte 0x02 (matrix)
+>0x00003B byte 0x03 (Y-variable)
+>0x00003B byte 0x04 (string)
+>0x00003B byte 0x05 (program)
+>0x00003B byte 0x06 (protected prgm)
+>0x00003B byte 0x07 (picture)
+>0x00003B byte 0x08 (gdb)
+>0x00003B byte 0x0B (window settings)
+>0x00003B byte 0x0C (window settings)
+>0x00003B byte 0x0D (table setup)
+>0x00003B byte 0x0E (screenshot)
+>0x00003B byte 0x13 (backup)
+#
+# Magic Numbers for the TI-83+
+#
+0 string **TI83F* TI-83+ Graphing Calculator
+>0x00003B byte 0x00 (real number)
+>0x00003B byte 0x01 (list)
+>0x00003B byte 0x02 (matrix)
+>0x00003B byte 0x03 (equation)
+>0x00003B byte 0x04 (string)
+>0x00003B byte 0x05 (program)
+>0x00003B byte 0x06 (assembly program)
+>0x00003B byte 0x07 (picture)
+>0x00003B byte 0x08 (gdb)
+>0x00003B byte 0x0C (complex number)
+>0x00003B byte 0x0F (window settings)
+>0x00003B byte 0x10 (zoom)
+>0x00003B byte 0x11 (table setup)
+>0x00003B byte 0x13 (backup)
+>0x00003B byte 0x15 (application variable)
+>0x00003B byte 0x17 (group of variable)
+
#
# Magic Numbers for the TI-85
#
-0 string **TI85** TI-85 Graphing Calculator
->11 string Backup Backup File.
->0x000032 string ZS4 - ZShell Version 4 File.
->0x000032 string ZS3 - ZShell Version 3 File.
->0x00000B string GDatabase Graphics Database.
->0x00003B byte 0x12 TI-BASIC Group/Program File.
+0 string **TI85** TI-85 Graphing Calculator
+>0x00003B byte 0x00 (real number)
+>0x00003B byte 0x01 (complex number)
+>0x00003B byte 0x02 (real vector)
+>0x00003B byte 0x03 (complex vector)
+>0x00003B byte 0x04 (real list)
+>0x00003B byte 0x05 (complex list)
+>0x00003B byte 0x06 (real matrix)
+>0x00003B byte 0x07 (complex matrix)
+>0x00003B byte 0x08 (real constant)
+>0x00003B byte 0x09 (complex constant)
+>0x00003B byte 0x0A (equation)
+>0x00003B byte 0x0C (string)
+>0x00003B byte 0x0D (function GDB)
+>0x00003B byte 0x0E (polar GDB)
+>0x00003B byte 0x0F (parametric GDB)
+>0x00003B byte 0x10 (diffeq GDB)
+>0x00003B byte 0x11 (picture)
+>0x00003B byte 0x12 (program)
+>0x00003B byte 0x13 (range)
+>0x00003B byte 0x17 (window settings)
+>0x00003B byte 0x18 (window settings)
+>0x00003B byte 0x19 (window settings)
+>0x00003B byte 0x1A (window settings)
+>0x00003B byte 0x1B (zoom)
+>0x00003B byte 0x1D (backup)
+>0x00003B byte 0x1E (unknown)
+>0x00003B byte 0x2A (equation)
+>0x000032 string ZS4 - ZShell Version 4 File.
+>0x000032 string ZS3 - ZShell Version 3 File.
+#
+# Magic Numbers for the TI-86
+#
+0 string **TI86** TI-86 Graphing Calculator
+>0x00003B byte 0x00 (real number)
+>0x00003B byte 0x01 (complex number)
+>0x00003B byte 0x02 (real vector)
+>0x00003B byte 0x03 (complex vector)
+>0x00003B byte 0x04 (real list)
+>0x00003B byte 0x05 (complex list)
+>0x00003B byte 0x06 (real matrix)
+>0x00003B byte 0x07 (complex matrix)
+>0x00003B byte 0x08 (real constant)
+>0x00003B byte 0x09 (complex constant)
+>0x00003B byte 0x0A (equation)
+>0x00003B byte 0x0C (string)
+>0x00003B byte 0x0D (function GDB)
+>0x00003B byte 0x0E (polar GDB)
+>0x00003B byte 0x0F (parametric GDB)
+>0x00003B byte 0x10 (diffeq GDB)
+>0x00003B byte 0x11 (picture)
+>0x00003B byte 0x12 (program)
+>0x00003B byte 0x13 (range)
+>0x00003B byte 0x17 (window settings)
+>0x00003B byte 0x18 (window settings)
+>0x00003B byte 0x19 (window settings)
+>0x00003B byte 0x1A (window settings)
+>0x00003B byte 0x1B (zoom)
+>0x00003B byte 0x1D (backup)
+>0x00003B byte 0x1E (unknown)
+>0x00003B byte 0x2A (equation)
+#
+# Magic Numbers for the TI-89
+#
+0 string **TI89** TI-89 Graphing Calculator
+>0x000048 byte 0x00 (expression)
+>0x000048 byte 0x04 (list)
+>0x000048 byte 0x06 (matrix)
+>0x000048 byte 0x0A (data)
+>0x000048 byte 0x0B (text)
+>0x000048 byte 0x0C (string)
+>0x000048 byte 0x0D (graphic data base)
+>0x000048 byte 0x0E (figure)
+>0x000048 byte 0x10 (picture)
+>0x000048 byte 0x12 (program)
+>0x000048 byte 0x13 (function)
+>0x000048 byte 0x14 (macro)
+>0x000048 byte 0x1C (zipped)
+>0x000048 byte 0x21 (assembler)
#
# Magic Numbers for the TI-92
#
-0 string **TI92** TI-92 Graphing Calculator
->0x000058 byte 0x12 TI-BASIC Group File.
->0x000012 string Function Function.
->0x000048 byte 0x12 TI-BASIC Program.
-# Files for the TI-80 and TI-81 are pretty rare. I'm not going to put the
-# program/group magic numbers in here because I cannot find any.
-0 string **TI80** TI-80 Graphing Calculator File.
-0 string **TI81** TI-81 Graphing Calculator File.
+0 string **TI92** TI-92 Graphing Calculator
+>0x000048 byte 0x00 (expression)
+>0x000048 byte 0x04 (list)
+>0x000048 byte 0x06 (matrix)
+>0x000048 byte 0x0A (data)
+>0x000048 byte 0x0B (text)
+>0x000048 byte 0x0C (string)
+>0x000048 byte 0x0D (graphic data base)
+>0x000048 byte 0x0E (figure)
+>0x000048 byte 0x10 (picture)
+>0x000048 byte 0x12 (program)
+>0x000048 byte 0x13 (function)
+>0x000048 byte 0x14 (macro)
+>0x000048 byte 0x1D (backup)
+#
+# Magic Numbers for the TI-92+/V200
+#
+0 string **TI92P* TI-92+/V200 Graphing Calculator
+>0x000048 byte 0x00 (expression)
+>0x000048 byte 0x04 (list)
+>0x000048 byte 0x06 (matrix)
+>0x000048 byte 0x0A (data)
+>0x000048 byte 0x0B (text)
+>0x000048 byte 0x0C (string)
+>0x000048 byte 0x0D (graphic data base)
+>0x000048 byte 0x0E (figure)
+>0x000048 byte 0x10 (picture)
+>0x000048 byte 0x12 (program)
+>0x000048 byte 0x13 (function)
+>0x000048 byte 0x14 (macro)
+>0x000048 byte 0x1C (zipped)
+>0x000048 byte 0x21 (assembler)
+#
+# Magic Numbers for the TI-73/83+/89/92+/V200 FLASH upgrades
+#
+0x0000016 string Advanced TI-XX Graphing Calculator (FLASH)
+0 string **TIFL** TI-XX Graphing Calculator (FLASH)
+>8 byte >0 - Revision %d
+>>9 byte x \b.%d,
+>12 byte >0 Revision date %02x
+>>13 byte x \b/%02x
+>>14 beshort x \b/%04x,
+>17 string >/0 name: '%s',
+>48 byte 0x74 device: TI-73,
+>48 byte 0x73 device: TI-83+,
+>48 byte 0x98 device: TI-89,
+>48 byte 0x88 device: TI-92+,
+>49 byte 0x23 type: OS upgrade,
+>49 byte 0x24 type: application,
+>49 byte 0x25 type: certificate,
+>49 byte 0x3e type: license,
+>74 lelong >0 size: %ld bytes
+
+# VTi & TiEmu skins (TI Graphing Calculators).
+# From: Romain Lievin (roms@lpg.ticalc.org).
+# Magic Numbers for the VTi skins
+0 string VTI Virtual TI skin
+>3 string v - Version
+>>4 byte >0 \b %c
+>>6 byte x \b.%c
+# Magic Numbers for the TiEmu skins
+0 string TiEmu TiEmu skin
+>6 string v - Version
+>>7 byte >0 \b %c
+>>9 byte x \b.%c
+>>10 byte x \b%c
diff --git a/contrib/file/Magdir/unknown b/contrib/file/Magdir/unknown
index 843dc293..910cea4 100644
--- a/contrib/file/Magdir/unknown
+++ b/contrib/file/Magdir/unknown
@@ -15,7 +15,7 @@
# 0x10B is 0413; that's VAX demand-paged, but this is a short, not a
# long, as it would be on a VAX.
#
-# 0x10C is 0414, 0x10D is 0415, and 0x10E is 416; those *are* unknown.
+# 0x10C is 0414 and 0x10E is 416; those *are* unknown.
#
0 short 0x107 unknown machine executable
>8 short >0 not stripped
@@ -31,6 +31,4 @@
>15 byte >0 - version %ld
0 long 0x10c unknown demand paged pure executable
>16 long >0 not stripped
-0 long 0x10d unknown demand paged pure executable
->16 long >0 not stripped
0 long 0x10e unknown readable demand paged pure executable
diff --git a/contrib/file/Magdir/varied.out b/contrib/file/Magdir/varied.out
index 76322dd..537c5af 100644
--- a/contrib/file/Magdir/varied.out
+++ b/contrib/file/Magdir/varied.out
@@ -28,5 +28,8 @@
>4 long x - version %ld
# From: Dave Pearson <davep@davep.org>
# Harbour <URL:http://www.harbour-project.org/> HRB files.
-0 string \xc0HRB Harbour HRB file
->4 short x version %d
+0 string \xc0HRB Harbour HRB file
+>4 short x version %d
+
+# From: "Stefan A. Haubenthal" <polluks@web.de>
+0 belong 0x000001EB Plan 9 executable
diff --git a/contrib/file/Magdir/varied.script b/contrib/file/Magdir/varied.script
new file mode 100644
index 0000000..a3e0972
--- /dev/null
+++ b/contrib/file/Magdir/varied.script
@@ -0,0 +1,12 @@
+#------------------------------------------------------------------------------
+# varied.script: file(1) magic for various interpreter scripts
+
+0 string #!\ / a
+>3 string >\0 %s script text executable
+0 string #!\ / a
+>3 string >\0 %s script text executable
+0 string #!/ a
+>2 string >\0 %s script text executable
+0 string #!\ script text executable
+>3 string >\0 for %s
+
diff --git a/contrib/file/Magdir/vmware b/contrib/file/Magdir/vmware
index 857a4a9..6af543c 100644
--- a/contrib/file/Magdir/vmware
+++ b/contrib/file/Magdir/vmware
@@ -3,10 +3,10 @@
# VMware specific files (deducted from version 1.1 and log file entries)
# Anthon van der Neut (anthon@mnt.org)
0 belong 0x4d52564e VMware nvram
-0 belong 0x434f5744
->8 byte 3 VMware virtual disk
+0 belong 0x434f5744 VMware
+>4 byte 3 virtual disk
>>32 lelong x (%d/
>>36 lelong x \b%d/
>>40 lelong x \b%d)
->8 byte 2 VMware undoable disk
+>4 byte 2 undoable disk
>>32 string >\0 (%s)
diff --git a/contrib/file/Magdir/vorbis b/contrib/file/Magdir/vorbis
index 8977845..5957ea0 100644
--- a/contrib/file/Magdir/vorbis
+++ b/contrib/file/Magdir/vorbis
@@ -17,6 +17,18 @@
##>4 byte 0 revision 0
>4 byte 0
##>>14 lelong x (Serial %lX)
+# non-Vorbis content: FLAC (Free Lossless Audio Codec, http://flac.sourceforge.net)
+>>28 string fLaC \b, FLAC audio
+# non-Vorbis content: Theora
+>>28 string \x80theora \b, Theora video
+# non-Vorbis content: Speex
+>>28 string Speex\ \ \ \b, Speex audio
+# non-Vorbis content: OGM
+>>28 string \x01video\0\0\0 \b, OGM video
+>>>37 string/c div3 (DivX 3)
+>>>37 string/c divx (DivX 4)
+>>>37 string/c dx50 (DivX 5)
+>>>37 string/c xvid (XviD)
# --- First vorbis packet - general header ---
>>28 string \x01vorbis \b, Vorbis audio,
>>>35 lelong !0 UNKNOWN VERSION %lu,
@@ -29,19 +41,19 @@
# Minimal, nominal and maximal bitrates specified when encoding
>>>>48 string <\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff \b,
# The above tests if at least one of these is specified:
->>>>>44 lelong !-1
+>>>>>52 lelong !-1
# Vorbis RC2 has a bug which puts -1000 in the min/max bitrate fields
# instead of -1.
# Vorbis 1.0 uses 0 instead of -1.
->>>>>>44 lelong !-1000
->>>>>>>44 lelong !0
->>>>>>>>44 lelong x >%lu
->>>>>48 lelong !-1
->>>>>>48 lelong x ~%lu
->>>>>52 lelong !-1
>>>>>>52 lelong !0
>>>>>>>52 lelong !-1000
>>>>>>>>52 lelong x <%lu
+>>>>>48 lelong !-1
+>>>>>>48 lelong x ~%lu
+>>>>>44 lelong !-1
+>>>>>>44 lelong !-1000
+>>>>>>>44 lelong !0
+>>>>>>>>44 lelong x >%lu
>>>>>48 string <\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff bps
# -- Second vorbis header packet - the comments
# A kludge to read the vendor string. It's a counted string, not a
@@ -52,28 +64,30 @@
# in a different place, so we must use an indirect offset.
>>>(84.b+85) string \x03vorbis
>>>>(84.b+96) string/c Xiphophorus\ libVorbis\ I \b, created by: Xiphophorus libVorbis I
->>>>>(84.b+120) string >00000000 %.8s
+>>>>>(84.b+120) string >00000000
# Map to beta version numbers:
->>>>>>(84.b+120) string <20000508 (<beta1 - prepublic)
->>>>>>(84.b+120) string 20000508 (beta1/2)
+>>>>>>(84.b+120) string <20000508 (<beta1, prepublic)
+>>>>>>(84.b+120) string 20000508 (1.0 beta 1 or beta 2)
>>>>>>(84.b+120) string >20000508
>>>>>>>(84.b+120) string <20001031 (beta2-3)
->>>>>>(84.b+120) string 20001031 (beta3)
+>>>>>>(84.b+120) string 20001031 (1.0 beta 3)
>>>>>>(84.b+120) string >20001031
>>>>>>>(84.b+120) string <20010225 (beta3-4)
->>>>>>(84.b+120) string 20010225 (beta4)
+>>>>>>(84.b+120) string 20010225 (1.0 beta 4)
>>>>>>(84.b+120) string >20010225
>>>>>>>(84.b+120) string <20010615 (beta4-RC1)
->>>>>>(84.b+120) string 20010615 (RC1)
->>>>>>(84.b+120) string 20010813 (RC2)
+>>>>>>(84.b+120) string 20010615 (1.0 RC1)
+>>>>>>(84.b+120) string 20010813 (1.0 RC2)
>>>>>>(84.b+120) string 20010816 (RC2 - Garf tuned v1)
>>>>>>(84.b+120) string 20011014 (RC2 - Garf tuned v2)
->>>>>>(84.b+120) string 20011217 (pre-RC3 CVS)
->>>>>>(84.b+120) string 20011231 (RC3)
+>>>>>>(84.b+120) string 20011217 (1.0 RC3)
+>>>>>>(84.b+120) string 20011231 (1.0 RC3)
# Some pre-1.0 CVS snapshots still had "Xiphphorus"...
>>>>>>(84.b+120) string >20011231 (pre-1.0 CVS)
# For the 1.0 release, Xiphophorus is replaced by Xiph.Org
>>>>(84.b+96) string/c Xiph.Org\ libVorbis\ I \b, created by: Xiph.Org libVorbis I
->>>>>(84.b+117) string >00000000 %.8s
+>>>>>(84.b+117) string >00000000
>>>>>>(84.b+117) string <20020717 (pre-1.0 CVS)
>>>>>>(84.b+117) string 20020717 (1.0)
+>>>>>>(84.b+117) string 20030909 (1.0.1)
+>>>>>>(84.b+117) string 20040629 (1.1.0 RC1)
diff --git a/contrib/file/Magdir/wordprocessors b/contrib/file/Magdir/wordprocessors
new file mode 100644
index 0000000..9b122c1
--- /dev/null
+++ b/contrib/file/Magdir/wordprocessors
@@ -0,0 +1,111 @@
+
+#------------------------------------------------------------------------------
+# wordprocessors: file(1) magic fo word processors.
+#
+####### PWP file format used on Smith Corona Personal Word Processors:
+2 string \040\040\040\040\040\040\040\040\040\040\040ML4D\040\'92 Smith Corona PWP
+>24 byte 2 \b, single spaced
+>24 byte 3 \b, 1.5 spaced
+>24 byte 4 \b, double spaced
+>25 byte 0x42 \b, letter
+>25 byte 0x54 \b, legal
+>26 byte 0x46 \b, A4
+
+#WordPerfect type files Version 1.6 - PLEASE DO NOT REMOVE THIS LINE
+0 string \377WPC\020\000\000\000\022\012\001\001\000\000\000\000 (WP) loadable text
+>15 byte 0 Optimized for Intel
+>15 byte 1 Optimized for Non-Intel
+1 string WPC (Corel/WP)
+>8 short 257 WordPerfect macro
+>8 short 258 WordPerfect help file
+>8 short 259 WordPerfect keyboard file
+>8 short 266 WordPerfect document
+>8 short 267 WordPerfect dictionary
+>8 short 268 WordPerfect thesaurus
+>8 short 269 WordPerfect block
+>8 short 270 WordPerfect rectangular block
+>8 short 271 WordPerfect column block
+>8 short 272 WordPerfect printer data
+>8 short 275 WordPerfect printer data
+>8 short 276 WordPerfect driver resource data
+>8 short 279 WordPerfect hyphenation code
+>8 short 280 WordPerfect hyphenation data
+>8 short 281 WordPerfect macro resource data
+>8 short 283 WordPerfect hyphenation lex
+>8 short 285 WordPerfect wordlist
+>8 short 286 WordPerfect equation resource data
+>8 short 289 WordPerfect spell rules
+>8 short 290 WordPerfect dictionary rules
+>8 short 295 WordPerfect spell rules (Microlytics)
+>8 short 299 WordPerfect settings file
+>8 short 301 WordPerfect 4.2 document
+>8 short 325 WordPerfect dialog file
+>8 short 332 WordPerfect button bar
+>8 short 513 Shell macro
+>8 short 522 Shell definition
+>8 short 769 Notebook macro
+>8 short 770 Notebook help file
+>8 short 771 Notebook keyboard file
+>8 short 778 Notebook definition
+>8 short 1026 Calculator help file
+>8 short 1538 Calendar help file
+>8 short 1546 Calendar data file
+>8 short 1793 Editor macro
+>8 short 1794 Editor help file
+>8 short 1795 Editor keyboard file
+>8 short 1817 Editor macro resource file
+>8 short 2049 Macro editor macro
+>8 short 2050 Macro editor help file
+>8 short 2051 Macro editor keyboard file
+>8 short 2305 PlanPerfect macro
+>8 short 2306 PlanPerfect help file
+>8 short 2307 PlanPerfect keyboard file
+>8 short 2314 PlanPerfect worksheet
+>8 short 2319 PlanPerfect printer definition
+>8 short 2322 PlanPerfect graphic definition
+>8 short 2323 PlanPerfect data
+>8 short 2324 PlanPerfect temporary printer
+>8 short 2329 PlanPerfect macro resource data
+>8 byte 11 Mail
+>8 short 2818 help file
+>8 short 2821 distribution list
+>8 short 2826 out box
+>8 short 2827 in box
+>8 short 2836 users archived mailbox
+>8 short 2837 archived message database
+>8 short 2838 archived attachments
+>8 short 3083 Printer temporary file
+>8 short 3330 Scheduler help file
+>8 short 3338 Scheduler in file
+>8 short 3339 Scheduler out file
+>8 short 3594 GroupWise settings file
+>8 short 3601 GroupWise directory services
+>8 short 3627 GroupWise settings file
+>8 short 4362 Terminal resource data
+>8 short 4363 Terminal resource data
+>8 short 4395 Terminal resource data
+>8 short 4619 GUI loadable text
+>8 short 4620 graphics resource data
+>8 short 4621 printer settings file
+>8 short 4622 port definition file
+>8 short 4623 print queue parameters
+>8 short 4624 compressed file
+>8 short 5130 Network service msg file
+>8 short 5131 Network service msg file
+>8 short 5132 Async gateway login msg
+>8 short 5134 GroupWise message file
+>8 short 7956 GroupWise admin domain database
+>8 short 7957 GroupWise admin host database
+>8 short 7959 GroupWise admin remote host database
+>8 short 7960 GroupWise admin ADS deferment data file
+>8 short 8458 IntelliTAG (SGML) compiled DTD
+>8 long 18219264 WordPerfect graphic image (1.0)
+>8 long 18219520 WordPerfect graphic image (2.0)
+#end of WordPerfect type files Version 1.6 - PLEASE DO NOT REMOVE THIS LINE
+
+# Hangul (Korean) Word Processor File
+0 string HWP\ Document\ File Hangul (Korean) Word Processor File
+
+# CosmicBook, from Benoît Rouits
+0 string CSBK Ted Neslson's CosmicBook hypertext file
+
diff --git a/contrib/file/Magdir/xwindows b/contrib/file/Magdir/xwindows
new file mode 100644
index 0000000..1805d45
--- /dev/null
+++ b/contrib/file/Magdir/xwindows
@@ -0,0 +1,25 @@
+
+#------------------------------------------------------------------------------
+# xwindows: file(1) magic for various X/Window system file formats.
+
+# Compiled X Keymap
+# XKM (compiled X keymap) files (including version and byte ordering)
+1 string mkx Compiled XKB Keymap: lsb,
+>0 byte >0 version %d
+>0 byte =0 obsolete
+0 string xkm Compiled XKB Keymap: msb,
+>3 byte >0 version %d
+>0 byte =0 obsolete
+
+# xfsdump archive
+0 string xFSdump0 xfsdump archive
+>8 long x (version %d)
+
+# Jaleo XFS files
+0 long 395726 Jaleo XFS file
+>4 long x - version %ld
+>8 long x - [%ld -
+>20 long x %ldx
+>24 long x %ldx
+>28 long 1008 YUV422]
+>28 long 1000 RGB24]
diff --git a/contrib/file/Makefile.am b/contrib/file/Makefile.am
index 8e868cd..0c716df 100644
--- a/contrib/file/Makefile.am
+++ b/contrib/file/Makefile.am
@@ -1,29 +1,8 @@
-# don't enforce GNU packaging standards
-AUTOMAKE_OPTIONS = foreign no-dependencies
+pkgdata_DATA = magic magic.mime magic.mgc magic.mime.mgc
-bin_PROGRAMS = file
+EXTRA_DIST = magic2mime Localstuff Header magic.mime $(magic_FRAGMENTS)
-data_DATA = magic magic.mime magic.mgc magic.mime.mgc
-
-MAGIC = @datadir@/magic
-CPPFLAGS = -DMAGIC='"$(MAGIC)"'
-
-if FSECT5
-man_MAGIC = magic.5
-else
-man_MAGIC = magic.4
-endif
-fsect = @fsect@
-man_MANS = file.1 $(man_MAGIC)
-
-file_SOURCES = file.c apprentice.c fsmagic.c softmagic.c ascmagic.c \
- compress.c is_tar.c readelf.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.mgc magic.mime.mgc
+CLEANFILES = magic magic.mgc magic.mime.mgc
magic: Header Localstuff $(magic_FRAGMENTS)
cat $(srcdir)/Header $(srcdir)/Localstuff > $@
@@ -36,25 +15,11 @@ magic: Header Localstuff $(magic_FRAGMENTS)
cat $$f; \
done >> $@
-magic.mgc: magic file
- ./file -C -m magic
+magic.mgc: magic
+ $(top_builddir)/src/file -C -m magic
-magic.mime.mgc: magic.mime file
- ./file -C -m $(srcdir)/magic.mime
-
-file.1: Makefile file.man
- @rm -f $@
- sed -e s@__CSECTION__@1@g \
- -e s@__FSECTION__@${fsect}@g \
- -e s@__VERSION__@${VERSION}@g \
- -e s@__MAGIC__@${MAGIC}@g $(srcdir)/file.man > $@
-
-magic.${fsect}: Makefile magic.man
- @rm -f $@
- sed -e s@__CSECTION__@1@g \
- -e s@__FSECTION__@${fsect}@g \
- -e s@__VERSION__@${VERSION}@g \
- -e s@__MAGIC__@${MAGIC}@g $(srcdir)/magic.man > $@
+magic.mime.mgc: magic.mime
+ $(top_builddir)/src/file -C -m $(srcdir)/magic.mime
magic_FRAGMENTS = \
Magdir/acorn \
@@ -73,22 +38,29 @@ Magdir/archive \
Magdir/asterix \
Magdir/att3b \
Magdir/audio \
+Magdir/bFLT \
Magdir/blender \
Magdir/blit \
+Magdir/bout \
Magdir/bsdi \
+Magdir/cad \
Magdir/c-lang \
+Magdir/c64 \
Magdir/cddb \
Magdir/chi \
+Magdir/chord \
Magdir/cisco \
Magdir/citrus \
Magdir/claris \
Magdir/clipper \
+Magdir/spec \
Magdir/commands \
+Magdir/communications \
Magdir/compress \
Magdir/console \
Magdir/convex \
Magdir/ctags \
-Magdir/cvs \
+Magdir/dact \
Magdir/database \
Magdir/diamond \
Magdir/diff \
@@ -100,12 +72,16 @@ Magdir/editors \
Magdir/elf \
Magdir/encore \
Magdir/epoc \
+Magdir/fcs \
Magdir/filesystems \
Magdir/flash \
Magdir/fonts \
Magdir/frame \
Magdir/freebsd \
Magdir/fsav \
+Magdir/games \
+Magdir/geos \
+Magdir/gcc \
Magdir/gimp \
Magdir/gnu \
Magdir/grace \
@@ -113,6 +89,7 @@ Magdir/gringotts \
Magdir/hdf \
Magdir/hitachi-sh \
Magdir/hp \
+Magdir/human68k \
Magdir/ibm370 \
Magdir/ibm6000 \
Magdir/iff \
@@ -135,13 +112,15 @@ Magdir/magic \
Magdir/mail.news \
Magdir/maple \
Magdir/mathematica \
+Magdir/matroska \
Magdir/mcrypt \
Magdir/mime \
Magdir/mips \
Magdir/mirage \
+Magdir/misctools \
Magdir/mkid \
-Magdir/mmdf \
Magdir/mlssa \
+Magdir/mmdf \
Magdir/modem \
Magdir/motorola \
Magdir/msdos \
@@ -152,6 +131,7 @@ Magdir/netbsd \
Magdir/netscape \
Magdir/news \
Magdir/nitpicker \
+Magdir/ocaml \
Magdir/octave \
Magdir/olf \
Magdir/os2 \
@@ -165,13 +145,16 @@ Magdir/pdp \
Magdir/perl \
Magdir/pgp \
Magdir/pkgadd \
+Magdir/plan9 \
Magdir/plus5 \
Magdir/printer \
Magdir/project \
Magdir/psdbms \
+Magdir/psion \
Magdir/pulsar \
Magdir/pyramid \
Magdir/python \
+Magdir/revision \
Magdir/riff \
Magdir/rpm \
Magdir/rtf \
@@ -179,8 +162,10 @@ Magdir/sc \
Magdir/sccs \
Magdir/sendmail \
Magdir/sequent \
+Magdir/sgi \
Magdir/sgml \
Magdir/sharc \
+Magdir/sinclair \
Magdir/sketch \
Magdir/smalltalk \
Magdir/sniffer \
@@ -201,6 +186,7 @@ Magdir/typeset \
Magdir/unknown \
Magdir/uuencode \
Magdir/varied.out \
+Magdir/varied.script \
Magdir/vax \
Magdir/vicar \
Magdir/visx \
@@ -208,8 +194,9 @@ Magdir/vms \
Magdir/vmware \
Magdir/vorbis \
Magdir/vxl \
-Magdir/wordperfect \
+Magdir/wordprocessors \
Magdir/xdelta \
Magdir/xenix \
+Magdir/xwindows \
Magdir/zilog \
Magdir/zyxel
diff --git a/contrib/file/Makefile.in b/contrib/file/Makefile.in
index 70dfd5e..3931a6a 100644
--- a/contrib/file/Makefile.in
+++ b/contrib/file/Makefile.in
@@ -1,6 +1,8 @@
-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
+# Makefile.in generated by automake 1.7.9 from Makefile.am.
+# @configure_input@
-# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# 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.
@@ -10,84 +12,121 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
-# don't enforce GNU packaging standards
-
-
-SHELL = @SHELL@
+@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
-prefix = @prefix@
-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 = ..
-top_builddir = .
-
-ACLOCAL = @ACLOCAL@
-AUTOCONF = @AUTOCONF@
-AUTOMAKE = @AUTOMAKE@
-AUTOHEADER = @AUTOHEADER@
-
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-transform = @program_transform_name@
-
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
+host_triplet = @host@
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FSECT5_FALSE = @FSECT5_FALSE@
+FSECT5_TRUE = @FSECT5_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
VERSION = @VERSION@
-
-AUTOMAKE_OPTIONS = foreign no-dependencies
-
-bin_PROGRAMS = file
-
-data_DATA = magic magic.mime magic.mgc magic.mime.mgc
-
-MAGIC = @datadir@/magic
-CPPFLAGS = -DMAGIC='"$(MAGIC)"'
-@FSECT5_TRUE@man_MAGIC = @FSECT5_TRUE@magic.5
-@FSECT5_FALSE@man_MAGIC = @FSECT5_FALSE@magic.4
+ac_ct_CC = @ac_ct_CC@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
fsect = @fsect@
-man_MANS = file.1 $(man_MAGIC)
-
-file_SOURCES = file.c apprentice.c fsmagic.c softmagic.c ascmagic.c \
- compress.c is_tar.c readelf.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
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+pkgdata_DATA = magic magic.mime magic.mgc magic.mime.mgc
+EXTRA_DIST = magic2mime Localstuff Header magic.mime $(magic_FRAGMENTS)
-CLEANFILES = $(man_MANS) magic magic.mgc magic.mime.mgc
+CLEANFILES = magic magic.mgc magic.mime.mgc
magic_FRAGMENTS = \
Magdir/acorn \
@@ -106,22 +145,29 @@ Magdir/archive \
Magdir/asterix \
Magdir/att3b \
Magdir/audio \
+Magdir/bFLT \
Magdir/blender \
Magdir/blit \
+Magdir/bout \
Magdir/bsdi \
+Magdir/cad \
Magdir/c-lang \
+Magdir/c64 \
Magdir/cddb \
Magdir/chi \
+Magdir/chord \
Magdir/cisco \
Magdir/citrus \
Magdir/claris \
Magdir/clipper \
+Magdir/spec \
Magdir/commands \
+Magdir/communications \
Magdir/compress \
Magdir/console \
Magdir/convex \
Magdir/ctags \
-Magdir/cvs \
+Magdir/dact \
Magdir/database \
Magdir/diamond \
Magdir/diff \
@@ -133,12 +179,16 @@ Magdir/editors \
Magdir/elf \
Magdir/encore \
Magdir/epoc \
+Magdir/fcs \
Magdir/filesystems \
Magdir/flash \
Magdir/fonts \
Magdir/frame \
Magdir/freebsd \
Magdir/fsav \
+Magdir/games \
+Magdir/geos \
+Magdir/gcc \
Magdir/gimp \
Magdir/gnu \
Magdir/grace \
@@ -146,6 +196,7 @@ Magdir/gringotts \
Magdir/hdf \
Magdir/hitachi-sh \
Magdir/hp \
+Magdir/human68k \
Magdir/ibm370 \
Magdir/ibm6000 \
Magdir/iff \
@@ -168,13 +219,15 @@ Magdir/magic \
Magdir/mail.news \
Magdir/maple \
Magdir/mathematica \
+Magdir/matroska \
Magdir/mcrypt \
Magdir/mime \
Magdir/mips \
Magdir/mirage \
+Magdir/misctools \
Magdir/mkid \
-Magdir/mmdf \
Magdir/mlssa \
+Magdir/mmdf \
Magdir/modem \
Magdir/motorola \
Magdir/msdos \
@@ -185,6 +238,7 @@ Magdir/netbsd \
Magdir/netscape \
Magdir/news \
Magdir/nitpicker \
+Magdir/ocaml \
Magdir/octave \
Magdir/olf \
Magdir/os2 \
@@ -198,13 +252,16 @@ Magdir/pdp \
Magdir/perl \
Magdir/pgp \
Magdir/pkgadd \
+Magdir/plan9 \
Magdir/plus5 \
Magdir/printer \
Magdir/project \
Magdir/psdbms \
+Magdir/psion \
Magdir/pulsar \
Magdir/pyramid \
Magdir/python \
+Magdir/revision \
Magdir/riff \
Magdir/rpm \
Magdir/rtf \
@@ -212,8 +269,10 @@ Magdir/sc \
Magdir/sccs \
Magdir/sendmail \
Magdir/sequent \
+Magdir/sgi \
Magdir/sgml \
Magdir/sharc \
+Magdir/sinclair \
Magdir/sketch \
Magdir/smalltalk \
Magdir/sniffer \
@@ -234,6 +293,7 @@ Magdir/typeset \
Magdir/unknown \
Magdir/uuencode \
Magdir/varied.out \
+Magdir/varied.script \
Magdir/vax \
Magdir/vicar \
Magdir/visx \
@@ -241,428 +301,181 @@ Magdir/vms \
Magdir/vmware \
Magdir/vorbis \
Magdir/vxl \
-Magdir/wordperfect \
+Magdir/wordprocessors \
Magdir/xdelta \
Magdir/xenix \
+Magdir/xwindows \
Magdir/zilog \
Magdir/zyxel
+subdir = magic
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_HEADER = config.h
-CONFIG_CLEAN_FILES =
-PROGRAMS = $(bin_PROGRAMS)
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+DATA = $(pkgdata_DATA)
+DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
+all: all-am
-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 print.o
-file_LDADD = $(LDADD)
-file_DEPENDENCIES =
-file_LDFLAGS =
-CFLAGS = @CFLAGS@
-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
-man5dir = $(mandir)/man5
-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 = gtar
-GZIP_ENV = --best
-SOURCES = $(file_SOURCES)
-OBJECTS = $(file_OBJECTS)
-
-all: all-redirect
.SUFFIXES:
-.SUFFIXES: .S .c .o .s
-$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
- cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile
-
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- 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)/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)/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)
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu magic/Makefile
+Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+pkgdataDATA_INSTALL = $(INSTALL_DATA)
+install-pkgdataDATA: $(pkgdata_DATA)
@$(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; \
+ $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
+ @list='$(pkgdata_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(pkgdataDATA_INSTALL) $$d$$p $(DESTDIR)$(pkgdatadir)/$$f"; \
+ $(pkgdataDATA_INSTALL) $$d$$p $(DESTDIR)$(pkgdatadir)/$$f; \
done
-uninstall-binPROGRAMS:
+uninstall-pkgdataDATA:
@$(NORMAL_UNINSTALL)
- list='$(bin_PROGRAMS)'; for p in $$list; do \
- rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+ @list='$(pkgdata_DATA)'; for p in $$list; do \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " rm -f $(DESTDIR)$(pkgdatadir)/$$f"; \
+ rm -f $(DESTDIR)$(pkgdatadir)/$$f; \
done
+tags: TAGS
+TAGS:
-.c.o:
- $(COMPILE) -c $<
-
-.s.o:
- $(COMPILE) -c $<
-
-.S.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-man5:
- $(mkinstalldirs) $(DESTDIR)$(man5dir)
- @list='$(man5_MANS)'; \
- l2='$(man_MANS)'; for i in $$l2; do \
- case "$$i" in \
- *.5*) 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)$(man5dir)/$$inst"; \
- $(INSTALL_DATA) $$file $(DESTDIR)$(man5dir)/$$inst; \
- done
-
-uninstall-man5:
- @list='$(man5_MANS)'; \
- l2='$(man_MANS)'; for i in $$l2; do \
- case "$$i" in \
- *.5*) 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)$(man5dir)/$$inst"; \
- rm -f $(DESTDIR)$(man5dir)/$$inst; \
- done
-install-man: $(MANS)
- @$(NORMAL_INSTALL)
- $(MAKE) $(AM_MAKEFLAGS) install-man1 install-man4 install-man5
-uninstall-man:
- @$(NORMAL_UNINSTALL)
- $(MAKE) $(AM_MAKEFLAGS) uninstall-man1 uninstall-man4 uninstall-man5
-
-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
+ctags: CTAGS
+CTAGS:
-uninstall-dataDATA:
- @$(NORMAL_UNINSTALL)
- list='$(data_DATA)'; for p in $$list; do \
- rm -f $(DESTDIR)$(datadir)/$$p; \
- done
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-tags: TAGS
+top_distdir = ..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
-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)
$(mkinstalldirs) $(distdir)/Magdir
- @for file in $(DISTFILES); do \
- d=$(srcdir); \
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkinstalldirs) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
if test -d $$d/$$file; then \
- cp -pr $$d/$$file $(distdir)/$$file; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
- || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
- || cp -p $$d/$$file $(distdir)/$$file || :; \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
fi; \
done
-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
+all-am: Makefile $(DATA)
-install-exec-am: install-binPROGRAMS
+installdirs:
+ $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
+install: install-am
install-exec: install-exec-am
-
-install-data-am: install-man install-dataDATA
install-data: install-data-am
+uninstall: uninstall-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)$(mandir)/man5 \
- $(DESTDIR)$(datadir)
-
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
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]*
+ -rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
-mostlyclean-am: mostlyclean-hdr mostlyclean-binPROGRAMS \
- mostlyclean-compile mostlyclean-tags \
- mostlyclean-generic
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
-mostlyclean: mostlyclean-am
+clean-am: clean-generic clean-libtool mostlyclean-am
-clean-am: clean-hdr clean-binPROGRAMS clean-compile clean-tags \
- clean-generic mostlyclean-am
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
-clean: clean-am
+dvi: dvi-am
-distclean-am: distclean-hdr distclean-binPROGRAMS distclean-compile \
- distclean-tags distclean-generic clean-am
+dvi-am:
-distclean: distclean-am
- -rm -f config.status
+info: info-am
-maintainer-clean-am: maintainer-clean-hdr maintainer-clean-binPROGRAMS \
- maintainer-clean-compile maintainer-clean-tags \
- 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."
+info-am:
+
+install-data-am: install-pkgdataDATA
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
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-man5 uninstall-man5 install-man uninstall-man \
-uninstall-dataDATA install-dataDATA tags mostlyclean-tags \
-distclean-tags clean-tags maintainer-clean-tags distdir 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
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-pkgdataDATA
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-pkgdataDATA install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+ uninstall-info-am uninstall-pkgdataDATA
magic: Header Localstuff $(magic_FRAGMENTS)
@@ -676,26 +489,11 @@ magic: Header Localstuff $(magic_FRAGMENTS)
cat $$f; \
done >> $@
-magic.mgc: magic file
- ./file -C -m magic
-
-magic.mime.mgc: magic.mime file
- ./file -C -m $(srcdir)/magic.mime
-
-file.1: Makefile file.man
- @rm -f $@
- sed -e s@__CSECTION__@1@g \
- -e s@__FSECTION__@${fsect}@g \
- -e s@__VERSION__@${VERSION}@g \
- -e s@__MAGIC__@${MAGIC}@g $(srcdir)/file.man > $@
-
-magic.${fsect}: Makefile magic.man
- @rm -f $@
- sed -e s@__CSECTION__@1@g \
- -e s@__FSECTION__@${fsect}@g \
- -e s@__VERSION__@${VERSION}@g \
- -e s@__MAGIC__@${MAGIC}@g $(srcdir)/magic.man > $@
+magic.mgc: magic
+ $(top_builddir)/src/file -C -m magic
+magic.mime.mgc: magic.mime
+ $(top_builddir)/src/file -C -m $(srcdir)/magic.mime
# 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/contrib/file/README b/contrib/file/README
index 0d16503..0e97732 100644
--- a/contrib/file/README
+++ b/contrib/file/README
@@ -1,10 +1,16 @@
** README for file(1) Command **
-@(#) $Id: README,v 1.29 2003/02/27 20:47:46 christos Exp $
+@(#) $Id: README,v 1.33 2003/05/23 21:31:56 christos Exp $
-This is Release 3.x of Ian Darwin's (copyright but distributable)
+This is Release 4.x of Ian Darwin's (copyright but distributable)
file(1) command. This version is the standard "file" command for Linux,
*BSD, and other systems. (See "patchlevel.h" for the exact release number).
+The major feature of 4.x is the refactoring of the code into a library,
+and the re-write of the file command in terms of that library. The library
+itself, libmagic can be used by 3rd party programs that wish to identify
+file types without having to fork() and exec() file. The prime contributor
+for 4.0 was M\xe5ns Rullg\xe5rd.
+
UNIX is a trademark of UNIX System Laboratories.
The prime contributor to Release 3.8 was Guy Harris, who put in megachanges
@@ -33,7 +39,7 @@ In addition, the /etc/magic file is built from a subdirectory
for easier(?) maintenance. I will act as a clearinghouse for
magic numbers assigned to all sorts of data files that
are in reasonable circulation. Send your magic numbers,
-in magic(4) format please, to the maintainer, Christos Zoulas.
+in magic(5) format please, to the maintainer, Christos Zoulas.
LEGAL.NOTICE - read this first.
README - read this second (you are currently reading this file).
@@ -83,15 +89,14 @@ E-mail: christos@astron.com
Phone: Do not even think of telephoning me about this program. Send cash first!
-Parts of this software were developed at SoftQuad Inc., 56 Aberfoyle
-Cres, # 810, Toronto, Ontario CANADA M8X 2W4. Phone: 416-239-4801 or
-800-387-2777. Email: mail@sq.com. Call for information on SGML editing
-and browsing, Unix text processing, and customised products on Unix,
-DOS and Mac.
+Parts of this software were developed at SoftQuad Inc., developers
+of SGML/HTML/XML publishing software, in Toronto, Canada.
+SoftQuad was swallowed up by Corel in 2002
+and does not exist any longer.
From: Kees Zeelenberg
-An MS-Windows (Win32) port of File-3.41 is available from
+An MS-Windows (Win32) port of File-3.36 is available from
http://gnuwin32.sourceforge.net/
File is an implementation of the Unix File(1) command.
It knows the 'magic number' of several thousands of file types.
diff --git a/contrib/file/acinclude.m4 b/contrib/file/acinclude.m4
index 79ecb0e..4c27a4b 100644
--- a/contrib/file/acinclude.m4
+++ b/contrib/file/acinclude.m4
@@ -252,3 +252,33 @@ AC_DEFUN([AC_FUNC_FSEEKO],
[Define if fseeko (and presumably ftello) exists and is declared.])
fi])
+# serial 9
+
+# From Paul Eggert.
+
+# BeOS 5 has <wchar.h> but does not define mbstate_t,
+# so you can't declare an object of that type.
+# Check for this incompatibility with Standard C.
+
+# Include stdlib.h first, because otherwise this test would fail on Linux
+# (at least glibc-2.1.3) because the "_XOPEN_SOURCE 500" definition elicits
+# a syntax error in wchar.h due to the use of undefined __int32_t.
+AC_DEFUN([AC_MBSTATE_T],
+ [
+ AC_CHECK_HEADERS(stdlib.h)
+
+ AC_CACHE_CHECK([for mbstate_t], ac_cv_type_mbstate_t,
+ [AC_TRY_COMPILE([
+#if HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+#include <wchar.h>],
+ [mbstate_t x; return sizeof x;],
+ ac_cv_type_mbstate_t=yes,
+ ac_cv_type_mbstate_t=no)])
+ if test $ac_cv_type_mbstate_t = no; then
+ AC_DEFINE(mbstate_t, int,
+ [Define to a type if <wchar.h> does not define.])
+ fi])
+
+
diff --git a/contrib/file/aclocal.m4 b/contrib/file/aclocal.m4
index 8c89201..2098982 100644
--- a/contrib/file/aclocal.m4
+++ b/contrib/file/aclocal.m4
@@ -1,14 +1,15 @@
-dnl aclocal.m4 generated automatically by aclocal 1.4-p5
+# generated automatically by aclocal 1.7.9 -*- Autoconf -*-
-dnl Copyright (C) 1994, 1995-8, 1999, 2001 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.
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
+# Free Software Foundation, Inc.
+# This file 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.
-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.
+# 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.
dnl cloned from autoconf 2.13 acspecific.m4
AC_DEFUN([AC_C_LONG_LONG],
@@ -264,62 +265,279 @@ AC_DEFUN([AC_FUNC_FSEEKO],
[Define if fseeko (and presumably ftello) exists and is declared.])
fi])
+# serial 9
-# 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.
+# From Paul Eggert.
-# serial 1
+# BeOS 5 has <wchar.h> but does not define mbstate_t,
+# so you can't declare an object of that type.
+# Check for this incompatibility with Standard C.
+
+# Include stdlib.h first, because otherwise this test would fail on Linux
+# (at least glibc-2.1.3) because the "_XOPEN_SOURCE 500" definition elicits
+# a syntax error in wchar.h due to the use of undefined __int32_t.
+AC_DEFUN([AC_MBSTATE_T],
+ [
+ AC_CHECK_HEADERS(stdlib.h)
+
+ AC_CACHE_CHECK([for mbstate_t], ac_cv_type_mbstate_t,
+ [AC_TRY_COMPILE([
+#if HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+#include <wchar.h>],
+ [mbstate_t x; return sizeof x;],
+ ac_cv_type_mbstate_t=yes,
+ ac_cv_type_mbstate_t=no)])
+ if test $ac_cv_type_mbstate_t = no; then
+ AC_DEFINE(mbstate_t, int,
+ [Define to a type if <wchar.h> does not define.])
+ fi])
+
+
+
+# Do all the work for Automake. -*- Autoconf -*-
+
+# 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.
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
-dnl Usage:
-dnl AM_INIT_AUTOMAKE(package,version, [no-define])
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 10
+
+AC_PREREQ([2.54])
+
+# Autoconf 2.50 wants to disallow AM_ names. We explicitly allow
+# the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out. PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition. After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
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_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+ AC_REQUIRE([AC_PROG_INSTALL])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])])
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_MISSING_PROG(AMTAR, tar)
+AM_PROG_INSTALL_SH
+AM_PROG_INSTALL_STRIP
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+ [_AM_DEPENDENCIES(CC)],
+ [define([AC_PROG_CC],
+ defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [_AM_DEPENDENCIES(CXX)],
+ [define([AC_PROG_CXX],
+ defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+])
+])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated. The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $1 | $1:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
+
+# Copyright 2002 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.7"])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION so it can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+ [AM_AUTOMAKE_VERSION([1.7.9])])
+
+# Helper functions for option handling. -*- Autoconf -*-
+
+# Copyright 2001, 2002 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 2
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME. Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
#
# Check to make sure that the build environment is sane.
#
+# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 3
+
+# AM_SANITY_CHECK
+# ---------------
AC_DEFUN([AM_SANITY_CHECK],
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
-echo timestamp > conftestfile
+echo timestamp > conftest.file
# 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
+ set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+ if test "$[*]" = "X"; then
# -L didn't work.
- set X `ls -t $srcdir/configure conftestfile`
+ set X `ls -t $srcdir/configure conftest.file`
fi
- if test "[$]*" != "X $srcdir/configure conftestfile" \
- && test "[$]*" != "X conftestfile $srcdir/configure"; then
+ rm -f conftest.file
+ if test "$[*]" != "X $srcdir/configure conftest.file" \
+ && test "$[*]" != "X conftest.file $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
@@ -329,7 +547,7 @@ if (
alias in your environment])
fi
- test "[$]2" = conftestfile
+ test "$[2]" = conftest.file
)
then
# Ok.
@@ -338,58 +556,1462 @@ 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.
+# -*- Autoconf -*-
+
+
+# Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 3
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
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)
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
else
- $1="$3/missing $2"
- AC_MSG_RESULT(missing)
+ am_missing_run=
+ AC_MSG_WARN([`missing' script is too old or 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>>, <<[^ ]>>, <<>>), <<>>,
-<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
-<<am_indx=1
-for am_file in <<$1>>; 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([,]))])
+# AM_AUX_DIR_EXPAND
-# Define a conditional.
+# Copyright 2001 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory. The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run. This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+# fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+# fails if $ac_aux_dir is absolute,
+# fails when called from a subdirectory in a VPATH build with
+# a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir. In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
+# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+# MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH. The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+# Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])
+
+AC_DEFUN([AM_AUX_DIR_EXPAND], [
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+
+# Copyright 2001 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+AC_SUBST(install_sh)])
+
+# AM_PROG_INSTALL_STRIP
+
+# Copyright 2001 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries. This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+ AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# -*- Autoconf -*-
+# Copyright (C) 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 1
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot. For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# serial 5 -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery. Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
+ [$1], CXX, [depcc="$CXX" am_compiler_list=],
+ [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+ [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
+ [depcc="$$1" am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+ [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_$1_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ : > sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode=$depmode \
+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored.
+ if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else
+ am_cv_$1_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[ --disable-dependency-tracking Speeds up one-time builds
+ --enable-dependency-tracking Do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])
+])
+
+# Generate code to set up dependency tracking. -*- Autoconf -*-
+
+# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+#serial 2
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[for mf in $CONFIG_FILES; do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named `Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # So let's grep whole file.
+ if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+ dirpart=`AS_DIRNAME("$mf")`
+ else
+ continue
+ fi
+ grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue
+ # Extract the definition of DEP_FILES from the Makefile without
+ # running `make'.
+ DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n -e '/^U = / s///p' < "$mf"`
+ test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
+ # We invoke sed twice because it is the simplest approach to
+ # changing $(DEPDIR) to its actual value in the expansion.
+ for file in `sed -n -e '
+ /^DEP_FILES = .*\\\\$/ {
+ s/^DEP_FILES = //
+ :loop
+ s/\\\\$//
+ p
+ n
+ /\\\\$/ b loop
+ p
+ }
+ /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`AS_DIRNAME(["$file"])`
+ AS_MKDIR_P([$dirpart/$fdir])
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+done
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled. FIXME. This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+ [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+ [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Check to see how 'make' treats includes. -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 2
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+ am__include=include
+ am__quote=
+ _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ fi
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# AM_CONDITIONAL -*- Autoconf -*-
+
+# Copyright 1997, 2000, 2001 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 5
+
+AC_PREREQ(2.52)
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
AC_DEFUN([AM_CONDITIONAL],
-[AC_SUBST($1_TRUE)
-AC_SUBST($1_FALSE)
+[ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])
+AC_SUBST([$1_FALSE])
if $2; then
$1_TRUE=
$1_FALSE='#'
else
$1_TRUE='#'
$1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+ AC_MSG_ERROR([conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.])
+fi])])
+
+# Like AC_CONFIG_HEADER, but automatically create stamp file. -*- Autoconf -*-
+
+# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+AC_PREREQ([2.52])
+
+# serial 6
+
+# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS.
+AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
+
+# Add --enable-maintainer-mode option to configure.
+# From Jim Meyering
+
+# Copyright 1996, 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 2
+
+AC_DEFUN([AM_MAINTAINER_MODE],
+[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
+ dnl maintainer-mode is disabled by default
+ AC_ARG_ENABLE(maintainer-mode,
+[ --enable-maintainer-mode enable make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer],
+ USE_MAINTAINER_MODE=$enableval,
+ USE_MAINTAINER_MODE=no)
+ AC_MSG_RESULT([$USE_MAINTAINER_MODE])
+ AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes])
+ MAINT=$MAINTAINER_MODE_TRUE
+ AC_SUBST(MAINT)dnl
+]
+)
+
+AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
+
+
+# serial 46 AC_PROG_LIBTOOL
+AC_DEFUN([AC_PROG_LIBTOOL],
+[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl
+dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX
+dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX.
+ AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [AC_LIBTOOL_CXX],
+ [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX
+])])
+
+dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly.
+dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run
+dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both.
+ AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+ [AC_LIBTOOL_GCJ],
+ [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+ [AC_LIBTOOL_GCJ],
+ [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],
+ [AC_LIBTOOL_GCJ],
+ [ifdef([AC_PROG_GCJ],
+ [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ
+])])
+ ifdef([A][M_PROG_GCJ],
+ [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ
+])])
+ ifdef([LT_AC_PROG_GCJ],
+ [define([LT_AC_PROG_GCJ], defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ
+])])])])])])
+
+AC_DEFUN([_AC_PROG_LIBTOOL],
+[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl
+
+# Save cache, so that ltconfig can load it
+AC_CACHE_SAVE
+
+# Actually configure libtool. ac_aux_dir is where install-sh is found.
+AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
+MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
+AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
+objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
+deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
+$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \
+|| AC_MSG_ERROR([libtool configure failed])
+
+# Reload cache, that may have been modified by ltconfig
+AC_CACHE_LOAD
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+# Redirect the config.log output again, so that the ltconfig log is not
+# clobbered by the next message.
+exec 5>>./config.log
+])
+
+AC_DEFUN([AC_LIBTOOL_SETUP],
+[AC_PREREQ(2.13)dnl
+AC_REQUIRE([AC_ENABLE_SHARED])dnl
+AC_REQUIRE([AC_ENABLE_STATIC])dnl
+AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_LD])dnl
+AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
+AC_REQUIRE([AC_PROG_NM])dnl
+AC_REQUIRE([AC_PROG_LN_S])dnl
+AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+AC_REQUIRE([AC_OBJEXT])dnl
+AC_REQUIRE([AC_EXEEXT])dnl
+dnl
+
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ AC_PATH_MAGIC
+ fi
+ ;;
+esac
+
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+AC_CHECK_TOOL(STRIP, strip, :)
+
+# Check for any special flags to pass to ltconfig.
+libtool_flags="--cache-file=$cache_file"
+test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
+test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
+test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
+test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc"
+test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
+ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
+[libtool_flags="$libtool_flags --enable-dlopen"])
+ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
+[libtool_flags="$libtool_flags --enable-win32-dll"])
+AC_ARG_ENABLE(libtool-lock,
+ [ --disable-libtool-lock avoid locking (might break parallel builds)])
+test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
+test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
+
+AC_ARG_WITH(pic,
+ [ --with-pic try to use only PIC/non-PIC objects [default=use both]],
+ pic_mode="$withval", pic_mode=default)
+test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic"
+test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+ [AC_LANG_SAVE
+ AC_LANG_C
+ AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+ AC_LANG_RESTORE])
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+
+ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
+[*-*-cygwin* | *-*-mingw* | *-*-pw32*)
+ AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+ AC_CHECK_TOOL(AS, as, false)
+ AC_CHECK_TOOL(OBJDUMP, objdump, false)
+
+ # recent cygwin and mingw systems supply a stub DllMain which the user
+ # can override, but on older systems we have to supply one
+ AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain,
+ [AC_TRY_LINK([],
+ [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*);
+ DllMain (0, 0, 0);],
+ [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])])
+
+ case $host/$CC in
+ *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*)
+ # old mingw systems require "-dll" to link a DLL, while more recent ones
+ # require "-mdll"
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -mdll"
+ AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch,
+ [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])])
+ CFLAGS="$SAVE_CFLAGS" ;;
+ *-*-cygwin* | *-*-pw32*)
+ # cygwin systems need to pass --dll to the linker, and not link
+ # crt.o which will require a WinMain@16 definition.
+ lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;;
+ esac
+ ;;
+ ])
+esac
+])
+
+# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
+AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
+
+# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
+AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
+
+# AC_ENABLE_SHARED - implement the --enable-shared flag
+# Usage: AC_ENABLE_SHARED[(DEFAULT)]
+# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+# `yes'.
+AC_DEFUN([AC_ENABLE_SHARED],
+[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(shared,
+changequote(<<, >>)dnl
+<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case $enableval in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
+])
+
+# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
+AC_DEFUN([AC_DISABLE_SHARED], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_SHARED(no)])
+
+# AC_ENABLE_STATIC - implement the --enable-static flag
+# Usage: AC_ENABLE_STATIC[(DEFAULT)]
+# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+# `yes'.
+AC_DEFUN([AC_ENABLE_STATIC],
+[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(static,
+changequote(<<, >>)dnl
+<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case $enableval in
+yes) enable_static=yes ;;
+no) enable_static=no ;;
+*)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
+])
+
+# AC_DISABLE_STATIC - set the default static flag to --disable-static
+AC_DEFUN([AC_DISABLE_STATIC],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_STATIC(no)])
+
+
+# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
+# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
+# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+# `yes'.
+AC_DEFUN([AC_ENABLE_FAST_INSTALL],
+[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(fast-install,
+changequote(<<, >>)dnl
+<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case $enableval in
+yes) enable_fast_install=yes ;;
+no) enable_fast_install=no ;;
+*)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
+])
+
+# AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install
+AC_DEFUN([AC_DISABLE_FAST_INSTALL],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_FAST_INSTALL(no)])
+
+# AC_LIBTOOL_PICMODE - implement the --with-pic flag
+# Usage: AC_LIBTOOL_PICMODE[(MODE)]
+# Where MODE is either `yes' or `no'. If omitted, it defaults to
+# `both'.
+AC_DEFUN([AC_LIBTOOL_PICMODE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+pic_mode=ifelse($#,1,$1,default)])
+
+
+# AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library
+AC_DEFUN([AC_PATH_TOOL_PREFIX],
+[AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+ /*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+ ?:/*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
+ ;;
+ *)
+ ac_save_MAGIC_CMD="$MAGIC_CMD"
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word. This closes a longstanding sh security hole.
+ ac_dummy="ifelse([$2], , $PATH, [$2])"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$1; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ egrep "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ MAGIC_CMD="$ac_save_MAGIC_CMD"
+ ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ AC_MSG_RESULT($MAGIC_CMD)
+else
+ AC_MSG_RESULT(no)
+fi
+])
+
+
+# AC_PATH_MAGIC - find a file program which can recognise a shared library
+AC_DEFUN([AC_PATH_MAGIC],
+[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl
+AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+ if test -n "$ac_tool_prefix"; then
+ AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH)
+ else
+ MAGIC_CMD=:
+ fi
+fi
+])
+
+
+# AC_PROG_LD - find the path to the GNU or non-GNU linker
+AC_DEFUN([AC_PROG_LD],
+[AC_ARG_WITH(gnu-ld,
+[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
+test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ AC_MSG_CHECKING([for ld used by GCC])
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [[\\/]* | [A-Za-z]:[\\/]*)]
+ re_direlt=['/[^/][^/]*/\.\./']
+ # Canonicalize the path of ld
+ ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ AC_MSG_CHECKING([for GNU ld])
+else
+ AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ lt_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some GNU ld's only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+ test "$with_gnu_ld" != no && break
+ else
+ test "$with_gnu_ld" != yes && break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ AC_MSG_RESULT($LD)
+else
+ AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_PROG_LD_GNU
+])
+
+AC_DEFUN([AC_PROG_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+ lt_cv_prog_gnu_ld=yes
+else
+ lt_cv_prog_gnu_ld=no
+fi])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])
+
+# AC_PROG_LD_RELOAD_FLAG - find reload flag for linker
+# -- PORTME Some linkers may need a different reload flag.
+AC_DEFUN([AC_PROG_LD_RELOAD_FLAG],
+[AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag,
+[lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+test -n "$reload_flag" && reload_flag=" $reload_flag"
+])
+
+# AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies
+# -- PORTME fill in with the dynamic library characteristics
+AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
+[AC_CACHE_CHECK([how to recognise dependant libraries],
+lt_cv_deplibs_check_method,
+[lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [regex]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given egrep regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+beos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+bsdi4*)
+ lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)']
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ ;;
+
+cygwin* | mingw* |pw32*)
+ lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ ;;
+
+darwin* | rhapsody*)
+ lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ case "$host_os" in
+ rhapsody* | darwin1.[012])
+ lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System'
+ ;;
+ *) # Darwin 1.3 on
+ lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
+ ;;
+ esac
+ ;;
+
+freebsd* )
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ case $host_cpu in
+ i*86 )
+ # Not sure whether the presence of OpenBSD here was a mistake.
+ # Let's accept both of them until this is cleared up.
+ lt_cv_deplibs_check_method=['file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library']
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+ ;;
+ esac
+ else
+ lt_cv_deplibs_check_method=pass_all
+ fi
+ ;;
+
+gnu*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+hpux10.20*|hpux11*)
+ lt_cv_deplibs_check_method=['file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library']
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libc.sl
+ ;;
+
+irix5* | irix6*)
+ case $host_os in
+ irix5*)
+ # this will be overridden with pass_all, but let us keep it just in case
+ lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
+ ;;
+ *)
+ case $LD in
+ *-32|*"-32 ") libmagic=32-bit;;
+ *-n32|*"-n32 ") libmagic=N32;;
+ *-64|*"-64 ") libmagic=64-bit;;
+ *) libmagic=never-match;;
+ esac
+ # this will be overridden with pass_all, but let us keep it just in case
+ lt_cv_deplibs_check_method=["file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"]
+ ;;
+ esac
+ lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+ case $host_cpu in
+ alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* )
+ lt_cv_deplibs_check_method=pass_all ;;
+ *)
+ # glibc up to 2.1.1 does not perform some relocations on ARM
+ lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'] ;;
+ esac
+ lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+ ;;
+
+netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$']
+ else
+ [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$']
+ fi
+ ;;
+
+newsos6)
+ [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)']
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libnls.so
+ ;;
+
+osf3* | osf4* | osf5*)
+ # this will be overridden with pass_all, but let us keep it just in case
+ lt_cv_deplibs_check_method='file_magic COFF format alpha shared library'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sco3.2v5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+solaris*)
+ lt_cv_deplibs_check_method=pass_all
+ lt_cv_file_magic_test_file=/lib/libc.so
+ ;;
+
+[sysv5uw[78]* | sysv4*uw2*)]
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ case $host_vendor in
+ ncr)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ motorola)
+ lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]']
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+ ;;
+ esac
+ ;;
+esac
+])
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+])
+
+
+# AC_PROG_NM - find the path to a BSD-compatible name lister
+AC_DEFUN([AC_PROG_NM],
+[AC_MSG_CHECKING([for BSD-compatible nm])
+AC_CACHE_VAL(lt_cv_path_NM,
+[if test -n "$NM"; then
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm=$ac_dir/${ac_tool_prefix}nm
+ if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ # Tru64's nm complains that /dev/null is an invalid object file
+ if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+ else
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
fi])
+NM="$lt_cv_path_NM"
+AC_MSG_RESULT([$NM])
+])
+
+# AC_CHECK_LIBM - check for math library
+AC_DEFUN([AC_CHECK_LIBM],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cygwin* | *-*-pw32*)
+ # These system don't have libm
+ ;;
+*-ncr-sysv4.3*)
+ AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+ AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
+ ;;
+*)
+ AC_CHECK_LIB(m, main, LIBM="-lm")
+ ;;
+esac
+])
+
+# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
+# the libltdl convenience library and INCLTDL to the include flags for
+# the libltdl header and adds --enable-ltdl-convenience to the
+# configure arguments. Note that LIBLTDL and INCLTDL are not
+# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not
+# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed
+# with '${top_builddir}/' and INCLTDL will be prefixed with
+# '${top_srcdir}/' (note the single quotes!). If your package is not
+# flat and you're not using automake, define top_builddir and
+# top_srcdir appropriately in the Makefiles.
+AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+ case $enable_ltdl_convenience in
+ no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
+ "") enable_ltdl_convenience=yes
+ ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
+ esac
+ LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
+ INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+])
+
+# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
+# the libltdl installable library and INCLTDL to the include flags for
+# the libltdl header and adds --enable-ltdl-install to the configure
+# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is
+# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed
+# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will
+# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed
+# with '${top_srcdir}/' (note the single quotes!). If your package is
+# not flat and you're not using automake, define top_builddir and
+# top_srcdir appropriately in the Makefiles.
+# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
+AC_DEFUN([AC_LIBLTDL_INSTALLABLE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+ AC_CHECK_LIB(ltdl, main,
+ [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
+ [if test x"$enable_ltdl_install" = xno; then
+ AC_MSG_WARN([libltdl not installed, but installation disabled])
+ else
+ enable_ltdl_install=yes
+ fi
+ ])
+ if test x"$enable_ltdl_install" = x"yes"; then
+ ac_configure_args="$ac_configure_args --enable-ltdl-install"
+ LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
+ INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+ else
+ ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
+ LIBLTDL="-lltdl"
+ INCLTDL=
+ fi
+])
+
+# If this macro is not defined by Autoconf, define it here.
+ifdef([AC_PROVIDE_IFELSE],
+ [],
+ [define([AC_PROVIDE_IFELSE],
+ [ifdef([AC_PROVIDE_$1],
+ [$2], [$3])])])
+
+# AC_LIBTOOL_CXX - enable support for C++ libraries
+AC_DEFUN([AC_LIBTOOL_CXX], [AC_REQUIRE([_AC_LIBTOOL_CXX])])
+
+AC_DEFUN([_AC_LIBTOOL_CXX],
+[AC_REQUIRE([AC_PROG_CXX])
+AC_REQUIRE([AC_PROG_CXXCPP])
+LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-cxx.sh"
+lt_save_CC="$CC"
+lt_save_CFLAGS="$CFLAGS"
+dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC
+dnl is set to the C++ compiler.
+AR="$AR" LTCC="$CC" CC="$CXX" CXX="$CXX" CFLAGS="$CXXFLAGS" CPPFLAGS="$CPPFLAGS" \
+MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
+AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
+objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
+deplibs_check_method="$deplibs_check_method" \
+file_magic_cmd="$file_magic_cmd" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \
+--build="$build" --add-tag=CXX $ac_aux_dir/ltcf-cxx.sh $host \
+|| AC_MSG_ERROR([libtool tag configuration failed])
+CC="$lt_save_CC"
+CFLAGS="$lt_save_CFLAGS"
+
+# Redirect the config.log output again, so that the ltconfig log is not
+# clobbered by the next message.
+exec 5>>./config.log
+])
+
+# AC_LIBTOOL_GCJ - enable support for GCJ libraries
+AC_DEFUN([AC_LIBTOOL_GCJ],[AC_REQUIRE([_AC_LIBTOOL_GCJ])])
+
+AC_DEFUN([_AC_LIBTOOL_GCJ],
+[AC_REQUIRE([AC_PROG_LIBTOOL])
+AC_PROVIDE_IFELSE([AC_PROG_GCJ],[],
+ [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[],
+ [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[],
+ [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])],
+ [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])],
+ [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])])
+LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-gcj.sh"
+lt_save_CC="$CC"
+lt_save_CFLAGS="$CFLAGS"
+dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC
+dnl is set to the C++ compiler.
+AR="$AR" LTCC="$CC" CC="$GCJ" CFLAGS="$GCJFLAGS" CPPFLAGS="$CPPFLAGS" \
+MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
+AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
+objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
+deplibs_check_method="$deplibs_check_method" \
+file_magic_cmd="$file_magic_cmd" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \
+--build="$build" --add-tag=GCJ $ac_aux_dir/ltcf-gcj.sh $host \
+|| AC_MSG_ERROR([libtool tag configuration failed])
+CC="$lt_save_CC"
+CFLAGS="$lt_save_CFLAGS"
+
+# Redirect the config.log output again, so that the ltconfig log is not
+# clobbered by the next message.
+exec 5>>./config.log
+])
+
+dnl old names
+AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL])
+AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
+AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
+AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+AC_DEFUN([AM_PROG_LD], [AC_PROG_LD])
+AC_DEFUN([AM_PROG_NM], [AC_PROG_NM])
+
+dnl This is just to silence aclocal about the macro not being used
+ifelse([AC_DISABLE_FAST_INSTALL])dnl
+
+AC_DEFUN([LT_AC_PROG_GCJ],
+[AC_CHECK_TOOL(GCJ, gcj, no)
+ test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+ AC_SUBST(GCJFLAGS)
+])
diff --git a/contrib/file/apprentice.c b/contrib/file/apprentice.c
index 575bad6..531c791 100644
--- a/contrib/file/apprentice.c
+++ b/contrib/file/apprentice.c
@@ -1,31 +1,41 @@
/*
+ * Copyright (c) Ian F. Darwin 1986-1995.
+ * Software written by Ian F. Darwin and others;
+ * maintained 1995-present by Christos Zoulas and others.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice immediately at the beginning of the file, without modification,
+ * this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Ian F. Darwin and others.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+/*
* apprentice - make one pass through /etc/magic, learning its secrets.
- *
- * Copyright (c) Ian F. Darwin, 1987.
- * Written by Ian F. Darwin.
- *
- * 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.
*/
#include "file.h"
+#include "magic.h"
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
@@ -33,12 +43,14 @@
#include <string.h>
#include <ctype.h>
#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/param.h>
#ifdef QUICK
#include <sys/mman.h>
#endif
#ifndef lint
-FILE_RCSID("@(#)$Id: apprentice.c,v 1.50 2003/02/27 20:47:46 christos Exp $")
+FILE_RCSID("@(#)$Id: apprentice.c,v 1.78 2004/07/24 20:38:56 christos Exp $")
#endif /* lint */
#define EATAB {while (isascii((unsigned char) *l) && \
@@ -63,36 +75,33 @@ FILE_RCSID("@(#)$Id: apprentice.c,v 1.50 2003/02/27 20:47:46 christos Exp $")
#define MAP_FILE 0
#endif
-#ifdef __EMX__
- char PATHSEP=';';
-#else
- char PATHSEP=':';
+#ifndef MAXPATHLEN
+#define MAXPATHLEN 1024
#endif
-
-static int getvalue(struct magic *, char **);
-static int hextoint(int);
-static char *getstr(char *, char *, int, int *);
-static int parse(struct magic **, uint32_t *, char *, int);
-static void eatsize(char **);
-static int apprentice_1(const char *, int);
-static int apprentice_file(struct magic **, uint32_t *, const char *, int);
-static void byteswap(struct magic *, uint32_t);
-static void bs1(struct magic *);
-static uint16_t swap2(uint16_t);
-static uint32_t swap4(uint32_t);
-static char *mkdbname(const char *);
-static int apprentice_map(struct magic **, uint32_t *, const char *, int);
-static int apprentice_compile(struct magic **, uint32_t *, const char *, int);
-
-static int maxmagic = 0;
-
-struct mlist mlist;
+private int getvalue(struct magic_set *ms, struct magic *, char **);
+private int hextoint(int);
+private char *getstr(struct magic_set *, char *, char *, int, int *);
+private int parse(struct magic_set *, struct magic **, uint32_t *, char *, int);
+private void eatsize(char **);
+private int apprentice_1(struct magic_set *, const char *, int, struct mlist *);
+private int apprentice_file(struct magic_set *, struct magic **, uint32_t *,
+ const char *, int);
+private void byteswap(struct magic *, uint32_t);
+private void bs1(struct magic *);
+private uint16_t swap2(uint16_t);
+private uint32_t swap4(uint32_t);
+private char *mkdbname(const char *, char *, size_t);
+private int apprentice_map(struct magic_set *, struct magic **, uint32_t *,
+ const char *);
+private int apprentice_compile(struct magic_set *, struct magic **, uint32_t *,
+ const char *);
+private int check_format(struct magic *);
+
+private size_t maxmagic = 0;
+private size_t magicsize = sizeof(struct magic);
#ifdef COMPILE_ONLY
-const char *magicfile;
-char *progname;
-int lineno;
int main(int, char *[]);
@@ -100,6 +109,8 @@ int
main(int argc, char *argv[])
{
int ret;
+ struct magic_set *ms;
+ char *progname;
if ((progname = strrchr(argv[0], '/')) != NULL)
progname++;
@@ -107,12 +118,19 @@ main(int argc, char *argv[])
progname = argv[0];
if (argc != 2) {
- (void)fprintf(stderr, "usage: %s file\n", progname);
- exit(1);
+ (void)fprintf(stderr, "Usage: %s file\n", progname);
+ return 1;
}
- magicfile = argv[1];
- exit(apprentice(magicfile, COMPILE));
+ if ((ms = magic_open(MAGIC_CHECK)) == NULL) {
+ (void)fprintf(stderr, "%s: %s\n", progname, strerror(errno));
+ return 1;
+ }
+ ret = magic_compile(ms, argv[1]) == -1 ? 1 : 0;
+ if (ret == 1)
+ (void)fprintf(stderr, "%s: %s\n", progname, magic_error(ms));
+ magic_close(ms);
+ return ret;
}
#endif /* COMPILE_ONLY */
@@ -120,140 +138,200 @@ main(int argc, char *argv[])
/*
* Handle one file.
*/
-static int
-apprentice_1(const char *fn, int action)
+private int
+apprentice_1(struct magic_set *ms, const char *fn, int action,
+ struct mlist *mlist)
{
struct magic *magic = NULL;
uint32_t nmagic = 0;
struct mlist *ml;
int rv = -1;
+ int mapped;
- if (action == COMPILE) {
- rv = apprentice_file(&magic, &nmagic, fn, action);
- if (rv == 0)
- return apprentice_compile(&magic, &nmagic, fn, action);
- else
- return rv;
+ if (magicsize != FILE_MAGICSIZE) {
+ file_error(ms, 0, "magic element size %lu != %lu",
+ (unsigned long)sizeof(*magic),
+ (unsigned long)FILE_MAGICSIZE);
+ return -1;
}
-#ifndef COMPILE_ONLY
- if ((rv = apprentice_map(&magic, &nmagic, fn, action)) != 0)
- (void)fprintf(stderr, "%s: Using regular magic file `%s'\n",
- progname, fn);
-
- if (rv != 0)
- rv = apprentice_file(&magic, &nmagic, fn, action);
-
- if (rv != 0)
+
+ if (action == FILE_COMPILE) {
+ rv = apprentice_file(ms, &magic, &nmagic, fn, action);
+ if (rv != 0)
+ return -1;
+ rv = apprentice_compile(ms, &magic, &nmagic, fn);
+ free(magic);
return rv;
-
- if ((ml = malloc(sizeof(*ml))) == NULL) {
- (void) fprintf(stderr, "%s: Out of memory (%s).\n", progname,
- strerror(errno));
- if (action == CHECK)
+ }
+#ifndef COMPILE_ONLY
+ if ((rv = apprentice_map(ms, &magic, &nmagic, fn)) == -1) {
+ if (ms->flags & MAGIC_CHECK)
+ file_magwarn("using regular magic file `%s'", fn);
+ rv = apprentice_file(ms, &magic, &nmagic, fn, action);
+ if (rv != 0)
return -1;
+ mapped = 0;
}
- if (magic == NULL || nmagic == 0)
+ if (rv == -1)
return rv;
+ mapped = rv;
+
+ if (magic == NULL || nmagic == 0) {
+ file_delmagic(magic, mapped, nmagic);
+ return -1;
+ }
+
+ if ((ml = malloc(sizeof(*ml))) == NULL) {
+ file_delmagic(magic, mapped, nmagic);
+ file_oomem(ms);
+ return -1;
+ }
ml->magic = magic;
ml->nmagic = nmagic;
+ ml->mapped = mapped;
- mlist.prev->next = ml;
- ml->prev = mlist.prev;
- ml->next = &mlist;
- mlist.prev = ml;
+ mlist->prev->next = ml;
+ ml->prev = mlist->prev;
+ ml->next = mlist;
+ mlist->prev = ml;
- return rv;
+ return 0;
#endif /* COMPILE_ONLY */
}
+protected void
+file_delmagic(struct magic *p, int type, size_t entries)
+{
+ if (p == NULL)
+ return;
+ switch (type) {
+ case 2:
+ p--;
+ (void)munmap((void *)p, sizeof(*p) * (entries + 1));
+ break;
+ case 1:
+ p--;
+ /*FALLTHROUGH*/
+ case 0:
+ free(p);
+ break;
+ default:
+ abort();
+ }
+}
+
/* const char *fn: list of magic files */
-int
-apprentice(const char *fn, int action)
+protected struct mlist *
+file_apprentice(struct magic_set *ms, const char *fn, int action)
{
- char *p, *mfn;
+ char *p, *mfn, *afn = NULL;
int file_err, errs = -1;
+ struct mlist *mlist;
- mlist.next = mlist.prev = &mlist;
- mfn = malloc(strlen(fn)+1);
- if (mfn == NULL) {
- (void) fprintf(stderr, "%s: Out of memory (%s).\n", progname,
- strerror(errno));
- if (action == CHECK)
- return -1;
- else
- exit(1);
+ if (fn == NULL)
+ fn = getenv("MAGIC");
+ if (fn == NULL)
+ fn = MAGIC;
+
+ if ((fn = mfn = strdup(fn)) == NULL) {
+ file_oomem(ms);
+ return NULL;
}
- fn = strcpy(mfn, fn);
-
+
+ if ((mlist = malloc(sizeof(*mlist))) == NULL) {
+ free(mfn);
+ file_oomem(ms);
+ return NULL;
+ }
+ mlist->next = mlist->prev = mlist;
+
while (fn) {
p = strchr(fn, PATHSEP);
if (p)
*p++ = '\0';
- file_err = apprentice_1(fn, action);
+ if (*fn == '\0')
+ break;
+ if (ms->flags & MAGIC_MIME) {
+ if ((afn = malloc(strlen(fn) + 5 + 1)) == NULL) {
+ free(mfn);
+ free(mlist);
+ file_oomem(ms);
+ return NULL;
+ }
+ (void)strcpy(afn, fn);
+ (void)strcat(afn, ".mime");
+ fn = afn;
+ }
+ file_err = apprentice_1(ms, fn, action, mlist);
if (file_err > errs)
errs = file_err;
+ if (afn) {
+ free(afn);
+ afn = NULL;
+ }
fn = p;
}
- if (errs == -1)
- (void) fprintf(stderr, "%s: couldn't find any magic files!\n",
- progname);
- if (action == CHECK && errs)
- exit(1);
-
+ if (errs == -1) {
+ free(mfn);
+ free(mlist);
+ mlist = NULL;
+ file_error(ms, 0, "could not find any magic files!");
+ return NULL;
+ }
free(mfn);
- return errs;
+ return mlist;
}
/*
* parse from a file
* const char *fn: name of magic file
*/
-static int
-apprentice_file(struct magic **magicp, uint32_t *nmagicp, const char *fn,
- int action)
+private int
+apprentice_file(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp,
+ const char *fn, int action)
{
- static const char hdr[] =
+ private const char hdr[] =
"cont\toffset\ttype\topcode\tmask\tvalue\tdesc";
FILE *f;
char line[BUFSIZ+1];
+ int lineno;
int errs = 0;
f = fopen(fn, "r");
if (f == NULL) {
if (errno != ENOENT)
- (void) fprintf(stderr,
- "%s: can't read magic file %s (%s)\n",
- progname, fn, strerror(errno));
+ file_error(ms, errno, "cannot read magic file `%s'",
+ fn);
return -1;
}
maxmagic = MAXMAGIS;
*magicp = (struct magic *) calloc(maxmagic, sizeof(struct magic));
if (*magicp == NULL) {
- (void) fprintf(stderr, "%s: Out of memory (%s).\n", progname,
- strerror(errno));
- if (action == CHECK)
- return -1;
+ (void)fclose(f);
+ file_oomem(ms);
+ return -1;
}
- /* parse it */
- if (action == CHECK) /* print silly verbose header for USG compat. */
- (void) printf("%s\n", hdr);
+ /* print silly verbose header for USG compat. */
+ if (action == FILE_CHECK)
+ (void)fprintf(stderr, "%s\n", hdr);
- for (lineno = 1;fgets(line, BUFSIZ, f) != NULL; lineno++) {
+ /* parse it */
+ for (lineno = 1; fgets(line, BUFSIZ, f) != NULL; lineno++) {
if (line[0]=='#') /* comment, do not parse */
continue;
if (strlen(line) <= (unsigned)1) /* null line, garbage, etc */
continue;
line[strlen(line)-1] = '\0'; /* delete newline */
- if (parse(magicp, nmagicp, line, action) != 0)
+ if (parse(ms, magicp, nmagicp, line, action) != 0)
errs = 1;
}
- (void) fclose(f);
+ (void)fclose(f);
if (errs) {
free(*magicp);
*magicp = NULL;
@@ -265,8 +343,8 @@ apprentice_file(struct magic **magicp, uint32_t *nmagicp, const char *fn,
/*
* extend the sign bit if the comparison is to be signed
*/
-uint32_t
-signextend(struct magic *m, uint32_t v)
+protected uint32_t
+file_signextend(struct magic_set *ms, struct magic *m, uint32_t v)
{
if (!(m->flag & UNSIGNED))
switch(m->type) {
@@ -275,34 +353,35 @@ signextend(struct magic *m, uint32_t v)
* vital. When later compared with the data,
* the sign extension must have happened.
*/
- case BYTE:
+ case FILE_BYTE:
v = (char) v;
break;
- case SHORT:
- case BESHORT:
- case LESHORT:
+ case FILE_SHORT:
+ case FILE_BESHORT:
+ case FILE_LESHORT:
v = (short) v;
break;
- case DATE:
- case BEDATE:
- case LEDATE:
- case LDATE:
- case BELDATE:
- case LELDATE:
- case LONG:
- case BELONG:
- case LELONG:
+ case FILE_DATE:
+ case FILE_BEDATE:
+ case FILE_LEDATE:
+ case FILE_LDATE:
+ case FILE_BELDATE:
+ case FILE_LELDATE:
+ case FILE_LONG:
+ case FILE_BELONG:
+ case FILE_LELONG:
v = (int32_t) v;
break;
- case STRING:
- case PSTRING:
+ case FILE_STRING:
+ case FILE_PSTRING:
break;
- case REGEX:
+ case FILE_REGEX:
break;
default:
- magwarn("can't happen: m->type=%d\n",
- m->type);
- return -1;
+ if (ms->flags & MAGIC_CHECK)
+ file_magwarn("cannot happen: m->type=%d\n",
+ m->type);
+ return ~0U;
}
return v;
}
@@ -310,26 +389,25 @@ signextend(struct magic *m, uint32_t v)
/*
* parse one line from magic file, put into magic[index++] if valid
*/
-static int
-parse(struct magic **magicp, uint32_t *nmagicp, char *l, int action)
+private int
+parse(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, char *l,
+ int action)
{
int i = 0;
struct magic *m;
char *t;
+ private const char *fops = FILE_OPS;
+ uint32_t val;
#define ALLOC_INCR 200
if (*nmagicp + 1 >= maxmagic){
maxmagic += ALLOC_INCR;
if ((m = (struct magic *) realloc(*magicp,
sizeof(struct magic) * maxmagic)) == NULL) {
- (void) fprintf(stderr, "%s: Out of memory (%s).\n",
- progname, strerror(errno));
+ file_oomem(ms);
if (*magicp)
free(*magicp);
- if (action == CHECK)
- return -1;
- else
- exit(1);
+ return -1;
}
*magicp = m;
memset(&(*magicp)[*nmagicp], 0, sizeof(struct magic)
@@ -354,13 +432,14 @@ parse(struct magic **magicp, uint32_t *nmagicp, char *l, int action)
}
/* get offset, then skip over it */
- m->offset = (int) strtoul(l,&t,0);
+ m->offset = (uint32_t)strtoul(l, &t, 0);
if (l == t)
- magwarn("offset %s invalid", l);
+ if (ms->flags & MAGIC_CHECK)
+ file_magwarn("offset %s invalid", l);
l = t;
if (m->flag & INDIR) {
- m->in_type = LONG;
+ m->in_type = FILE_LONG;
m->in_offset = 0;
/*
* read [.lbs][+-]nnnnn)
@@ -369,75 +448,79 @@ parse(struct magic **magicp, uint32_t *nmagicp, char *l, int action)
l++;
switch (*l) {
case 'l':
- m->in_type = LELONG;
+ m->in_type = FILE_LELONG;
break;
case 'L':
- m->in_type = BELONG;
+ m->in_type = FILE_BELONG;
break;
case 'h':
case 's':
- m->in_type = LESHORT;
+ m->in_type = FILE_LESHORT;
break;
case 'H':
case 'S':
- m->in_type = BESHORT;
+ m->in_type = FILE_BESHORT;
break;
case 'c':
case 'b':
case 'C':
case 'B':
- m->in_type = BYTE;
+ m->in_type = FILE_BYTE;
break;
default:
- magwarn("indirect offset type %c invalid", *l);
+ if (ms->flags & MAGIC_CHECK)
+ file_magwarn(
+ "indirect offset type %c invalid",
+ *l);
break;
}
l++;
}
if (*l == '~') {
- m->in_op = OPINVERSE;
+ m->in_op = FILE_OPINVERSE;
l++;
}
switch (*l) {
case '&':
- m->in_op |= OPAND;
+ m->in_op |= FILE_OPAND;
l++;
break;
case '|':
- m->in_op |= OPOR;
+ m->in_op |= FILE_OPOR;
l++;
break;
case '^':
- m->in_op |= OPXOR;
+ m->in_op |= FILE_OPXOR;
l++;
break;
case '+':
- m->in_op |= OPADD;
+ m->in_op |= FILE_OPADD;
l++;
break;
case '-':
- m->in_op |= OPMINUS;
+ m->in_op |= FILE_OPMINUS;
l++;
break;
case '*':
- m->in_op |= OPMULTIPLY;
+ m->in_op |= FILE_OPMULTIPLY;
l++;
break;
case '/':
- m->in_op |= OPDIVIDE;
+ m->in_op |= FILE_OPDIVIDE;
l++;
break;
case '%':
- m->in_op |= OPMODULO;
+ m->in_op |= FILE_OPMODULO;
l++;
break;
}
if (isdigit((unsigned char)*l))
- m->in_offset = strtoul(l, &t, 0);
+ m->in_offset = (uint32_t)strtoul(l, &t, 0);
else
t = l;
if (*t++ != ')')
- magwarn("missing ')' in indirect offset");
+ if (ms->flags & MAGIC_CHECK)
+ file_magwarn("missing ')' in indirect offset");
l = t;
}
@@ -470,119 +553,80 @@ parse(struct magic **magicp, uint32_t *nmagicp, char *l, int action)
/* get type, skip it */
if (strncmp(l, "char", NBYTE)==0) { /* HP/UX compat */
- m->type = BYTE;
+ m->type = FILE_BYTE;
l += NBYTE;
} else if (strncmp(l, "byte", NBYTE)==0) {
- m->type = BYTE;
+ m->type = FILE_BYTE;
l += NBYTE;
} else if (strncmp(l, "short", NSHORT)==0) {
- m->type = SHORT;
+ m->type = FILE_SHORT;
l += NSHORT;
} else if (strncmp(l, "long", NLONG)==0) {
- m->type = LONG;
+ m->type = FILE_LONG;
l += NLONG;
} else if (strncmp(l, "string", NSTRING)==0) {
- m->type = STRING;
+ m->type = FILE_STRING;
l += NSTRING;
} else if (strncmp(l, "date", NDATE)==0) {
- m->type = DATE;
+ m->type = FILE_DATE;
l += NDATE;
} else if (strncmp(l, "beshort", NBESHORT)==0) {
- m->type = BESHORT;
+ m->type = FILE_BESHORT;
l += NBESHORT;
} else if (strncmp(l, "belong", NBELONG)==0) {
- m->type = BELONG;
+ m->type = FILE_BELONG;
l += NBELONG;
} else if (strncmp(l, "bedate", NBEDATE)==0) {
- m->type = BEDATE;
+ m->type = FILE_BEDATE;
l += NBEDATE;
} else if (strncmp(l, "leshort", NLESHORT)==0) {
- m->type = LESHORT;
+ m->type = FILE_LESHORT;
l += NLESHORT;
} else if (strncmp(l, "lelong", NLELONG)==0) {
- m->type = LELONG;
+ m->type = FILE_LELONG;
l += NLELONG;
} else if (strncmp(l, "ledate", NLEDATE)==0) {
- m->type = LEDATE;
+ m->type = FILE_LEDATE;
l += NLEDATE;
} else if (strncmp(l, "pstring", NPSTRING)==0) {
- m->type = PSTRING;
+ m->type = FILE_PSTRING;
l += NPSTRING;
} else if (strncmp(l, "ldate", NLDATE)==0) {
- m->type = LDATE;
+ m->type = FILE_LDATE;
l += NLDATE;
} else if (strncmp(l, "beldate", NBELDATE)==0) {
- m->type = BELDATE;
+ m->type = FILE_BELDATE;
l += NBELDATE;
} else if (strncmp(l, "leldate", NLELDATE)==0) {
- m->type = LELDATE;
+ m->type = FILE_LELDATE;
l += NLELDATE;
} else if (strncmp(l, "regex", NREGEX)==0) {
- m->type = REGEX;
+ m->type = FILE_REGEX;
l += sizeof("regex");
} else {
- magwarn("type %s invalid", l);
+ if (ms->flags & MAGIC_CHECK)
+ file_magwarn("type %s invalid", l);
return -1;
}
/* New-style anding: "0 byte&0x80 =0x80 dynamically linked" */
/* New and improved: ~ & | ^ + - * / % -- exciting, isn't it? */
if (*l == '~') {
- if (STRING != m->type && PSTRING != m->type)
- m->mask_op = OPINVERSE;
+ if (FILE_STRING != m->type && FILE_PSTRING != m->type)
+ m->mask_op = FILE_OPINVERSE;
++l;
}
- switch (*l) {
- case '&':
- m->mask_op |= OPAND;
- ++l;
- m->mask = signextend(m, strtoul(l, &l, 0));
- eatsize(&l);
- break;
- case '|':
- m->mask_op |= OPOR;
- ++l;
- m->mask = signextend(m, strtoul(l, &l, 0));
- eatsize(&l);
- break;
- case '^':
- m->mask_op |= OPXOR;
- ++l;
- m->mask = signextend(m, strtoul(l, &l, 0));
- eatsize(&l);
- break;
- case '+':
- m->mask_op |= OPADD;
- ++l;
- m->mask = signextend(m, strtoul(l, &l, 0));
- eatsize(&l);
- break;
- case '-':
- m->mask_op |= OPMINUS;
- ++l;
- m->mask = signextend(m, strtoul(l, &l, 0));
- eatsize(&l);
- break;
- case '*':
- m->mask_op |= OPMULTIPLY;
- ++l;
- m->mask = signextend(m, strtoul(l, &l, 0));
- eatsize(&l);
- break;
- case '%':
- m->mask_op |= OPMODULO;
- ++l;
- m->mask = signextend(m, strtoul(l, &l, 0));
- eatsize(&l);
- break;
- case '/':
- if (STRING != m->type && PSTRING != m->type) {
- m->mask_op |= OPDIVIDE;
+ if ((t = strchr(fops, *l)) != NULL) {
+ uint32_t op = (uint32_t)(t - fops);
+ if (op != FILE_OPDIVIDE ||
+ (FILE_STRING != m->type && FILE_PSTRING != m->type)) {
++l;
- m->mask = signextend(m, strtoul(l, &l, 0));
+ m->mask_op |= op;
+ val = (uint32_t)strtoul(l, &l, 0);
+ m->mask = file_signextend(ms, m, val);
eatsize(&l);
} else {
m->mask = 0L;
- while (!isspace(*++l)) {
+ while (!isspace((unsigned char)*++l)) {
switch (*l) {
case CHAR_IGNORE_LOWERCASE:
m->mask |= STRING_IGNORE_LOWERCASE;
@@ -595,16 +639,19 @@ parse(struct magic **magicp, uint32_t *nmagicp, char *l, int action)
STRING_COMPACT_OPTIONAL_BLANK;
break;
default:
- magwarn("string extension %c invalid",
- *l);
+ if (ms->flags & MAGIC_CHECK)
+ file_magwarn(
+ "string extension %c invalid",
+ *l);
return -1;
}
}
}
- break;
}
- /* We used to set mask to all 1's here, instead let's just not do anything
- if mask = 0 (unless you have a better idea) */
+ /*
+ * We used to set mask to all 1's here, instead let's just not do
+ * anything if mask = 0 (unless you have a better idea)
+ */
EATAB;
switch (*l) {
@@ -622,12 +669,12 @@ parse(struct magic **magicp, uint32_t *nmagicp, char *l, int action)
}
break;
case '!':
- if (m->type != STRING && m->type != PSTRING) {
+ if (m->type != FILE_STRING && m->type != FILE_PSTRING) {
m->reln = *l;
++l;
break;
}
- /* FALL THROUGH */
+ /*FALLTHROUGH*/
default:
if (*l == 'x' && isascii((unsigned char)l[1]) &&
isspace((unsigned char)l[1])) {
@@ -640,7 +687,7 @@ parse(struct magic **magicp, uint32_t *nmagicp, char *l, int action)
}
EATAB;
- if (getvalue(m, &l))
+ if (getvalue(ms, m, &l))
return -1;
/*
* TODO finish this macro and start using it!
@@ -662,37 +709,104 @@ GetDesc:
m->nospflag = 1;
} else
m->nospflag = 0;
- while ((m->desc[i++] = *l++) != '\0' && i<MAXDESC)
+ while ((m->desc[i++] = *l++) != '\0' && i < MAXDESC)
/* NULLBODY */;
+ if (ms->flags & MAGIC_CHECK) {
+ if (!check_format(m))
+ return -1;
+ }
#ifndef COMPILE_ONLY
- if (action == CHECK) {
- mdump(m);
+ if (action == FILE_CHECK) {
+ file_mdump(m);
}
#endif
++(*nmagicp); /* make room for next */
return 0;
}
+/*
+ * Check that the optional printf format in description matches
+ * the type of the magic.
+ */
+private int
+check_format(struct magic *m)
+{
+ static const char *formats[] = { FILE_FORMAT_STRING };
+ static const char *names[] = { FILE_FORMAT_NAME };
+ char *ptr;
+
+ for (ptr = m->desc; *ptr; ptr++)
+ if (*ptr == '%')
+ break;
+ if (*ptr == '\0') {
+ /* No format string; ok */
+ return 1;
+ }
+ if (m->type >= sizeof(formats)/sizeof(formats[0])) {
+ file_magwarn("Internal error inconsistency between m->type"
+ " and format strings");
+ return 0;
+ }
+ if (formats[m->type] == NULL) {
+ file_magwarn("No format string for `%s' with description `%s'",
+ m->desc, names[m->type]);
+ return 0;
+ }
+ for (; *ptr; ptr++) {
+ if (*ptr == 'l' || *ptr == 'h') {
+ /* XXX: we should really fix this one day */
+ continue;
+ }
+ if (islower((unsigned char)*ptr) || *ptr == 'X')
+ break;
+ }
+ if (*ptr == '\0') {
+ /* Missing format string; bad */
+ file_magwarn("Invalid format `%s' for type `%s'",
+ m->desc, names[m->type]);
+ return 0;
+ }
+ if (strchr(formats[m->type], *ptr) == NULL) {
+ file_magwarn("Printf format `%c' is not valid for type `%s'"
+ " in description `%s'",
+ *ptr, names[m->type], m->desc);
+ return 0;
+ }
+ return 1;
+}
+
/*
* Read a numeric value from a pointer, into the value union of a magic
* pointer, according to the magic type. Update the string pointer to point
* just after the number read. Return 0 for success, non-zero for failure.
*/
-static int
-getvalue(struct magic *m, char **p)
+private int
+getvalue(struct magic_set *ms, struct magic *m, char **p)
{
int slen;
- if (m->type == STRING || m->type == PSTRING || m->type == REGEX) {
- *p = getstr(*p, m->value.s, sizeof(m->value.s), &slen);
+ switch (m->type) {
+ case FILE_STRING:
+ case FILE_PSTRING:
+ case FILE_REGEX:
+ *p = getstr(ms, *p, m->value.s, sizeof(m->value.s), &slen);
+ if (*p == NULL) {
+ if (ms->flags & MAGIC_CHECK)
+ file_magwarn("cannot get string from `%s'",
+ m->value.s);
+ return -1;
+ }
m->vallen = slen;
- } else
+ return 0;
+ default:
if (m->reln != 'x') {
- m->value.l = signextend(m, strtoul(*p, p, 0));
+ m->value.l = file_signextend(ms, m,
+ (uint32_t)strtoul(*p, p, 0));
eatsize(p);
}
- return 0;
+ return 0;
+ }
}
/*
@@ -701,8 +815,8 @@ getvalue(struct magic *m, char **p)
* Copy the converted version to "p", returning its length in *slen.
* Return updated scan pointer as function result.
*/
-static char *
-getstr(char *s, char *p, int plen, int *slen)
+private char *
+getstr(struct magic_set *ms, char *s, char *p, int plen, int *slen)
{
char *origs = s, *origp = p;
char *pmax = p + plen - 1;
@@ -713,8 +827,8 @@ getstr(char *s, char *p, int plen, int *slen)
if (isspace((unsigned char) c))
break;
if (p >= pmax) {
- fprintf(stderr, "String too long: %s\n", origs);
- break;
+ file_error(ms, 0, "string too long: `%s'", origs);
+ return NULL;
}
if(c == '\\') {
switch(c = *s++) {
@@ -801,7 +915,7 @@ out:
/* Single hex char to int; -1 if not a hex char. */
-static int
+private int
hextoint(int c)
{
if (!isascii((unsigned char) c))
@@ -819,14 +933,14 @@ hextoint(int c)
/*
* Print a string containing C character escapes.
*/
-void
-showstr(FILE *fp, const char *s, int len)
+protected void
+file_showstr(FILE *fp, const char *s, size_t len)
{
char c;
for (;;) {
c = *s++;
- if (len == -1) {
+ if (len == ~0U) {
if (c == '\0')
break;
}
@@ -875,7 +989,7 @@ showstr(FILE *fp, const char *s, int len)
/*
* eatsize(): Eat the size spec from a number [eg. 10UL]
*/
-static void
+private void
eatsize(char **p)
{
char *l = *p;
@@ -901,17 +1015,18 @@ eatsize(char **p)
/*
* handle a compiled file.
*/
-static int
-apprentice_map(struct magic **magicp, uint32_t *nmagicp, const char *fn,
- int action)
+private int
+apprentice_map(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp,
+ const char *fn)
{
int fd;
struct stat st;
uint32_t *ptr;
uint32_t version;
int needsbyteswap;
- char *dbname = mkdbname(fn);
- void *mm;
+ char buf[MAXPATHLEN];
+ char *dbname = mkdbname(fn, buf, sizeof(buf));
+ void *mm = NULL;
if (dbname == NULL)
return -1;
@@ -920,38 +1035,39 @@ apprentice_map(struct magic **magicp, uint32_t *nmagicp, const char *fn,
return -1;
if (fstat(fd, &st) == -1) {
- (void)fprintf(stderr, "%s: Cannot stat `%s' (%s)\n",
- progname, dbname, strerror(errno));
+ file_error(ms, errno, "cannot stat `%s'", dbname);
+ goto error;
+ }
+ if (st.st_size < 16) {
+ file_error(ms, 0, "file `%s' is too small", dbname);
goto error;
}
#ifdef QUICK
if ((mm = mmap(0, (size_t)st.st_size, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FILE, fd, (off_t)0)) == MAP_FAILED) {
- (void)fprintf(stderr, "%s: Cannot map `%s' (%s)\n",
- progname, dbname, strerror(errno));
+ file_error(ms, errno, "cannot map `%s'", dbname);
goto error;
}
+#define RET 2
#else
if ((mm = malloc((size_t)st.st_size)) == NULL) {
- (void) fprintf(stderr, "%s: Out of memory (%s).\n", progname,
- strerror(errno));
+ file_oomem(ms);
goto error;
}
if (read(fd, mm, (size_t)st.st_size) != (size_t)st.st_size) {
- (void) fprintf(stderr, "%s: Read failed (%s).\n", progname,
- strerror(errno));
+ file_badread(ms);
goto error;
}
+#define RET 1
#endif
*magicp = mm;
(void)close(fd);
fd = -1;
- ptr = (uint32_t *) *magicp;
+ ptr = (uint32_t *)(void *)*magicp;
if (*ptr != MAGICNO) {
if (swap4(*ptr) != MAGICNO) {
- (void)fprintf(stderr, "%s: Bad magic in `%s'\n",
- progname, dbname);
+ file_error(ms, 0, "bad magic in `%s'");
goto error;
}
needsbyteswap = 1;
@@ -962,23 +1078,22 @@ apprentice_map(struct magic **magicp, uint32_t *nmagicp, const char *fn,
else
version = ptr[1];
if (version != VERSIONNO) {
- (void)fprintf(stderr,
- "%s: version mismatch (%d != %d) in `%s'\n",
- progname, version, VERSIONNO, dbname);
+ file_error(ms, 0, "version mismatch (%d != %d) in `%s'",
+ version, VERSIONNO, dbname);
goto error;
}
- *nmagicp = (st.st_size / sizeof(struct magic)) - 1;
+ *nmagicp = (uint32_t)(st.st_size / sizeof(struct magic)) - 1;
(*magicp)++;
if (needsbyteswap)
byteswap(*magicp, *nmagicp);
- return 0;
+ return RET;
error:
if (fd != -1)
(void)close(fd);
if (mm) {
#ifdef QUICK
- (void)munmap(mm, (size_t)st.st_size);
+ (void)munmap((void *)mm, (size_t)st.st_size);
#else
free(mm);
#endif
@@ -989,44 +1104,42 @@ error:
return -1;
}
+private const uint32_t ar[] = {
+ MAGICNO, VERSIONNO
+};
/*
* handle an mmaped file.
*/
-static int
-apprentice_compile(struct magic **magicp, uint32_t *nmagicp, const char *fn,
- int action)
+private int
+apprentice_compile(struct magic_set *ms, struct magic **magicp,
+ uint32_t *nmagicp, const char *fn)
{
int fd;
- char *dbname = mkdbname(fn);
- static const uint32_t ar[] = {
- MAGICNO, VERSIONNO
- };
+ char buf[MAXPATHLEN];
+ char *dbname = mkdbname(fn, buf, sizeof(buf));
if (dbname == NULL)
return -1;
if ((fd = open(dbname, O_WRONLY|O_CREAT|O_TRUNC, 0644)) == -1) {
- (void)fprintf(stderr, "%s: Cannot open `%s' (%s)\n",
- progname, dbname, strerror(errno));
+ file_error(ms, errno, "cannot open `%s'", dbname);
return -1;
}
- if (write(fd, ar, sizeof(ar)) != sizeof(ar)) {
- (void)fprintf(stderr, "%s: error writing `%s' (%s)\n",
- progname, dbname, strerror(errno));
+ if (write(fd, ar, sizeof(ar)) != (ssize_t)sizeof(ar)) {
+ file_error(ms, errno, "error writing `%s'", dbname);
return -1;
}
- if (lseek(fd, sizeof(struct magic), SEEK_SET) != sizeof(struct magic)) {
- (void)fprintf(stderr, "%s: error seeking `%s' (%s)\n",
- progname, dbname, strerror(errno));
+ if (lseek(fd, (off_t)sizeof(struct magic), SEEK_SET)
+ != sizeof(struct magic)) {
+ file_error(ms, errno, "error seeking `%s'", dbname);
return -1;
}
- if (write(fd, *magicp, sizeof(struct magic) * *nmagicp)
- != sizeof(struct magic) * *nmagicp) {
- (void)fprintf(stderr, "%s: error writing `%s' (%s)\n",
- progname, dbname, strerror(errno));
+ if (write(fd, *magicp, (sizeof(struct magic) * *nmagicp))
+ != (ssize_t)(sizeof(struct magic) * *nmagicp)) {
+ file_error(ms, errno, "error writing `%s'", dbname);
return -1;
}
@@ -1034,33 +1147,26 @@ apprentice_compile(struct magic **magicp, uint32_t *nmagicp, const char *fn,
return 0;
}
+private const char ext[] = ".mgc";
/*
* make a dbname
*/
-char *
-mkdbname(const char *fn)
+private char *
+mkdbname(const char *fn, char *buf, size_t bufsiz)
{
- static const char ext[] = ".mgc";
- static char *buf = NULL;
- size_t len = strlen(fn) + sizeof(ext) + 1;
- if (buf == NULL)
- buf = malloc(len);
- else
- buf = realloc(buf, len);
- if (buf == NULL) {
- (void) fprintf(stderr, "%s: Out of memory (%s).\n", progname,
- strerror(errno));
- return NULL;
- }
- (void)strcpy(buf, fn);
- (void)strcat(buf, ext);
+#ifdef notdef
+ const char *p;
+ if ((p = strrchr(fn, '/')) != NULL)
+ fn = ++p;
+#endif
+ (void)snprintf(buf, bufsiz, "%s%s", fn, ext);
return buf;
}
/*
* Byteswap an mmap'ed file if needed
*/
-static void
+private void
byteswap(struct magic *magic, uint32_t nmagic)
{
uint32_t i;
@@ -1071,12 +1177,12 @@ byteswap(struct magic *magic, uint32_t nmagic)
/*
* swap a short
*/
-static uint16_t
+private uint16_t
swap2(uint16_t sv)
{
uint16_t rv;
- uint8_t *s = (uint8_t *) &sv;
- uint8_t *d = (uint8_t *) &rv;
+ uint8_t *s = (uint8_t *)(void *)&sv;
+ uint8_t *d = (uint8_t *)(void *)&rv;
d[0] = s[1];
d[1] = s[0];
return rv;
@@ -1085,12 +1191,12 @@ swap2(uint16_t sv)
/*
* swap an int
*/
-static uint32_t
+private uint32_t
swap4(uint32_t sv)
{
uint32_t rv;
- uint8_t *s = (uint8_t *) &sv;
- uint8_t *d = (uint8_t *) &rv;
+ uint8_t *s = (uint8_t *)(void *)&sv;
+ uint8_t *d = (uint8_t *)(void *)&rv;
d[0] = s[3];
d[1] = s[2];
d[2] = s[1];
@@ -1101,13 +1207,13 @@ swap4(uint32_t sv)
/*
* byteswap a single magic entry
*/
-static
-void bs1(struct magic *m)
+private void
+bs1(struct magic *m)
{
m->cont_level = swap2(m->cont_level);
- m->offset = swap4(m->offset);
- m->in_offset = swap4(m->in_offset);
- if (m->type != STRING)
+ m->offset = swap4((uint32_t)m->offset);
+ m->in_offset = swap4((uint32_t)m->in_offset);
+ if (m->type != FILE_STRING)
m->value.l = swap4(m->value.l);
m->mask = swap4(m->mask);
}
diff --git a/contrib/file/apptype.c b/contrib/file/apptype.c
new file mode 100644
index 0000000..73b0687
--- /dev/null
+++ b/contrib/file/apptype.c
@@ -0,0 +1,170 @@
+/*
+ * Adapted from: apptype.c, Written by Eberhard Mattes and put into the
+ * public domain
+ *
+ * Notes: 1. Qualify the filename so that DosQueryAppType does not do extraneous
+ * searches.
+ *
+ * 2. DosQueryAppType will return FAPPTYP_DOS on a file ending with ".com"
+ * (other than an OS/2 exe or Win exe with this name). Eberhard Mattes
+ * remarks Tue, 6 Apr 93: Moreover, it reports the type of the (new and very
+ * bug ridden) Win Emacs as "OS/2 executable".
+ *
+ * 3. apptype() uses the filename if given, otherwise a tmp file is created with
+ * the contents of buf. If buf is not the complete file, apptype can
+ * incorrectly identify the exe type. The "-z" option of "file" is the reason
+ * for this ugly code.
+ */
+
+/*
+ * amai: Darrel Hankerson did the changes described here.
+ *
+ * It remains to check the validity of comments (2.) since it's referred to an
+ * "old" OS/2 version.
+ *
+ */
+
+#include "file.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+#ifndef lint
+FILE_RCSID("@(#)$Id: apptype.c,v 1.6 2003/11/11 20:01:45 christos Exp $")
+#endif /* lint */
+
+#ifdef __EMX__
+#include <io.h>
+#define INCL_DOSSESMGR
+#define INCL_DOSERRORS
+#define INCL_DOSFILEMGR
+#include <os2.h>
+typedef ULONG APPTYPE;
+
+protected int
+file_os2_apptype(struct magic_set *ms, const char *fn, const void *buf,
+ size_t nb)
+{
+ APPTYPE rc, type;
+ char path[_MAX_PATH], drive[_MAX_DRIVE], dir[_MAX_DIR],
+ fname[_MAX_FNAME], ext[_MAX_EXT];
+ char *filename;
+ FILE *fp;
+
+ if (fn)
+ filename = strdup(fn);
+ else if ((filename = tempnam("./", "tmp")) == NULL) {
+ file_error(ms, errno, "cannot create tempnam");
+ return -1;
+ }
+ /* qualify the filename to prevent extraneous searches */
+ _splitpath(filename, drive, dir, fname, ext);
+ (void)sprintf(path, "%s%s%s%s", drive,
+ (*dir == '\0') ? "./" : dir,
+ fname,
+ (*ext == '\0') ? "." : ext);
+
+ if (fn == NULL) {
+ if ((fp = fopen(path, "wb")) == NULL) {
+ file_error(ms, errno, "cannot open tmp file `%s'", path);
+ return -1;
+ }
+ if (fwrite(buf, 1, nb, fp) != nb) {
+ file_error(ms, errno, "cannot write tmp file `%s'",
+ path);
+ return -1;
+ }
+ (void)fclose(fp);
+ }
+ rc = DosQueryAppType(path, &type);
+
+ if (fn == NULL) {
+ unlink(path);
+ free(filename);
+ }
+#if 0
+ if (rc == ERROR_INVALID_EXE_SIGNATURE)
+ printf("%s: not an executable file\n", fname);
+ else if (rc == ERROR_FILE_NOT_FOUND)
+ printf("%s: not found\n", fname);
+ else if (rc == ERROR_ACCESS_DENIED)
+ printf("%s: access denied\n", fname);
+ else if (rc != 0)
+ printf("%s: error code = %lu\n", fname, rc);
+ else
+#else
+
+ /*
+ * for our purpose here it's sufficient to just ignore the error and
+ * return w/o success (=0)
+ */
+
+ if (rc)
+ return (0);
+
+#endif
+
+ if (type & FAPPTYP_32BIT)
+ if (file_printf(ms, "32-bit ") == -1)
+ return -1;
+ if (type & FAPPTYP_PHYSDRV) {
+ if (file_printf(ms, "physical device driver") == -1)
+ return -1;
+ } else if (type & FAPPTYP_VIRTDRV) {
+ if (file_printf(ms, "virtual device driver") == -1)
+ return -1;
+ } else if (type & FAPPTYP_DLL) {
+ if (type & FAPPTYP_PROTDLL)
+ if (file_printf(ms, "protected ") == -1)
+ return -1;
+ if (file_printf(ms, "DLL") == -1)
+ return -1;
+ } else if (type & (FAPPTYP_WINDOWSREAL | FAPPTYP_WINDOWSPROT)) {
+ if (file_printf(ms, "Windows executable") == -1)
+ return -1;
+ } else if (type & FAPPTYP_DOS) {
+ /*
+ * The API routine is partially broken on filenames ending
+ * ".com".
+ */
+ if (stricmp(ext, ".com") == 0)
+ if (strncmp((const char *)buf, "MZ", 2))
+ return (0);
+ if (file_printf(ms, "DOS executable") == -1)
+ return -1;
+ /* ---------------------------------------- */
+ /* Might learn more from the magic(4) entry */
+ if (file_printf(ms, ", magic(4)-> ") == -1)
+ return -1;
+ return (0);
+ /* ---------------------------------------- */
+ } else if (type & FAPPTYP_BOUND) {
+ if (file_printf(ms, "bound executable") == -1)
+ return -1;
+ } else if ((type & 7) == FAPPTYP_WINDOWAPI) {
+ if (file_printf(ms, "PM executable") == -1)
+ return -1;
+ } else if (file_printf(ms, "OS/2 executable") == -1)
+ return -1;
+
+ switch (type & (FAPPTYP_NOTWINDOWCOMPAT |
+ FAPPTYP_WINDOWCOMPAT |
+ FAPPTYP_WINDOWAPI)) {
+ case FAPPTYP_NOTWINDOWCOMPAT:
+ if (file_printf(ms, " [NOTWINDOWCOMPAT]") == -1)
+ return -1;
+ break;
+ case FAPPTYP_WINDOWCOMPAT:
+ if (file_printf(ms, " [WINDOWCOMPAT]") == -1)
+ return -1;
+ break;
+ case FAPPTYP_WINDOWAPI:
+ if (file_printf(ms, " [WINDOWAPI]") == -1)
+ return -1;
+ break;
+ }
+ return 1;
+}
+#endif
diff --git a/contrib/file/ascmagic.c b/contrib/file/ascmagic.c
index 8217f19..3df6aaa 100644
--- a/contrib/file/ascmagic.c
+++ b/contrib/file/ascmagic.c
@@ -1,10 +1,39 @@
/*
+ * Copyright (c) Ian F. Darwin 1986-1995.
+ * Software written by Ian F. Darwin and others;
+ * maintained 1995-present by Christos Zoulas and others.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice immediately at the beginning of the file, without modification,
+ * this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Ian F. Darwin and others.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+/*
* ASCII magic -- file types that we know based on keywords
* that can appear anywhere in the file.
*
- * Copyright (c) Ian F. Darwin, 1987.
- * Written by Ian F. Darwin.
- *
* Extensively modified by Eric Fischer <enf@pobox.com> in July, 2000,
* to handle character codes other than ASCII on a unified basis.
*
@@ -12,29 +41,9 @@
* international characters, now subsumed into this file.
*/
-/*
- * 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.
- */
-
#include "file.h"
+#include "magic.h"
+#include <stdio.h>
#include <string.h>
#include <memory.h>
#include <ctype.h>
@@ -45,7 +54,7 @@
#include "names.h"
#ifndef lint
-FILE_RCSID("@(#)$Id: ascmagic.c,v 1.33 2003/02/08 18:33:53 christos Exp $")
+FILE_RCSID("@(#)$Id: ascmagic.c,v 1.40 2003/11/20 00:25:39 christos Exp $")
#endif /* lint */
typedef unsigned long unichar;
@@ -54,29 +63,29 @@ typedef unsigned long unichar;
#define ISSPC(x) ((x) == ' ' || (x) == '\t' || (x) == '\r' || (x) == '\n' \
|| (x) == 0x85 || (x) == '\f')
-static int looks_ascii(const unsigned char *, int, unichar *, int *);
-static int looks_utf8(const unsigned char *, int, unichar *, int *);
-static int looks_unicode(const unsigned char *, int, unichar *, int *);
-static int looks_latin1(const unsigned char *, int, unichar *, int *);
-static int looks_extended(const unsigned char *, int, unichar *, int *);
-static void from_ebcdic(const unsigned char *, int, unsigned char *);
-static int ascmatch(const unsigned char *, const unichar *, int);
-
-/* int nbytes: size actually read */
-int
-ascmagic(unsigned char *buf, int nbytes)
+private int looks_ascii(const unsigned char *, size_t, unichar *, size_t *);
+private int looks_utf8(const unsigned char *, size_t, unichar *, size_t *);
+private int looks_unicode(const unsigned char *, size_t, unichar *, size_t *);
+private int looks_latin1(const unsigned char *, size_t, unichar *, size_t *);
+private int looks_extended(const unsigned char *, size_t, unichar *, size_t *);
+private void from_ebcdic(const unsigned char *, size_t, unsigned char *);
+private int ascmatch(const unsigned char *, const unichar *, size_t);
+
+
+protected int
+file_ascmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes)
{
- int i;
+ size_t i;
unsigned char nbuf[HOWMANY+1]; /* one extra for terminating '\0' */
unichar ubuf[HOWMANY+1]; /* one extra for terminating '\0' */
- int ulen;
+ size_t ulen;
struct names *p;
- char *code = NULL;
- char *code_mime = NULL;
- char *type = NULL;
- char *subtype = NULL;
- char *subtype_mime = NULL;
+ const char *code = NULL;
+ const char *code_mime = NULL;
+ const char *type = NULL;
+ const char *subtype = NULL;
+ const char *subtype_mime = NULL;
int has_escapes = 0;
int has_backspace = 0;
@@ -90,20 +99,6 @@ ascmagic(unsigned char *buf, int nbytes)
int has_long_lines = 0;
/*
- * Do the tar test first, because if the first file in the tar
- * archive starts with a dot, we can confuse it with an nroff file.
- */
- switch (is_tar(buf, nbytes)) {
- case 1:
- ckfputs(iflag ? "application/x-tar" : "tar archive", stdout);
- return 1;
- case 2:
- ckfputs(iflag ? "application/x-tar, POSIX"
- : "POSIX tar archive", stdout);
- return 1;
- }
-
- /*
* Undo the NUL-termination kindly provided by process()
* but leave at least one byte to look at
*/
@@ -111,6 +106,10 @@ ascmagic(unsigned char *buf, int nbytes)
while (nbytes > 1 && buf[nbytes - 1] == '\0')
nbytes--;
+ /* nbuf and ubuf relies on this */
+ if (nbytes > HOWMANY)
+ nbytes = HOWMANY;
+
/*
* Then try to determine whether it's any character code we can
* identify. Each of these tests, if it succeeds, will leave
@@ -125,7 +124,7 @@ ascmagic(unsigned char *buf, int nbytes)
code = "UTF-8 Unicode";
code_mime = "utf-8";
type = "text";
- } else if ((i = looks_unicode(buf, nbytes, ubuf, &ulen))) {
+ } else if ((i = looks_unicode(buf, nbytes, ubuf, &ulen)) != 0) {
if (i == 1)
code = "Little-endian UTF-16 Unicode";
else
@@ -171,8 +170,10 @@ ascmagic(unsigned char *buf, int nbytes)
while (ISSPC(*tp))
++tp; /* skip leading whitespace */
if ((tp[0] == '\\' && tp[1] == '\"') ||
- (isascii(tp[0]) && isalnum(tp[0]) &&
- isascii(tp[1]) && isalnum(tp[1]) &&
+ (isascii((unsigned char)tp[0]) &&
+ isalnum((unsigned char)tp[0]) &&
+ isascii((unsigned char)tp[1]) &&
+ isalnum((unsigned char)tp[1]) &&
ISSPC(tp[2]))) {
subtype_mime = "text/troff";
subtype = "troff or preprocessor input";
@@ -190,7 +191,7 @@ ascmagic(unsigned char *buf, int nbytes)
i = 0;
while (i < ulen) {
- int end;
+ size_t end;
/*
* skip past any leading space
@@ -211,7 +212,7 @@ ascmagic(unsigned char *buf, int nbytes)
* compare the word thus isolated against the token list
*/
for (p = names; p < names + NNAMES; p++) {
- if (ascmatch((unsigned char *)p->name, ubuf + i,
+ if (ascmatch((const unsigned char *)p->name, ubuf + i,
end - i)) {
subtype = types[p->type].human;
subtype_mime = types[p->type].mime;
@@ -244,7 +245,7 @@ subtype_identified:
n_cr++;
last_line_end = i;
}
- if (ubuf[i] == '\n' && (i - 1 < 0 || ubuf[i - 1] != '\r')) {
+ if (ubuf[i] == '\n' && ((int)i - 1 < 0 || ubuf[i - 1] != '\r')){
n_lf++;
last_line_end = i;
}
@@ -254,29 +255,40 @@ subtype_identified:
}
}
- if (iflag) {
- if (subtype_mime)
- ckfputs(subtype_mime, stdout);
- else
- ckfputs("text/plain", stdout);
+ if ((ms->flags & MAGIC_MIME)) {
+ if (subtype_mime) {
+ if (file_printf(ms, subtype_mime) == -1)
+ return -1;
+ } else {
+ if (file_printf(ms, "text/plain") == -1)
+ return -1;
+ }
if (code_mime) {
- ckfputs("; charset=", stdout);
- ckfputs(code_mime, stdout);
+ if (file_printf(ms, "; charset=") == -1)
+ return -1;
+ if (file_printf(ms, code_mime) == -1)
+ return -1;
}
} else {
- ckfputs(code, stdout);
+ if (file_printf(ms, code) == -1)
+ return -1;
if (subtype) {
- ckfputs(" ", stdout);
- ckfputs(subtype, stdout);
+ if (file_printf(ms, " ") == -1)
+ return -1;
+ if (file_printf(ms, subtype) == -1)
+ return -1;
}
- ckfputs(" ", stdout);
- ckfputs(type, stdout);
+ if (file_printf(ms, " ") == -1)
+ return -1;
+ if (file_printf(ms, type) == -1)
+ return -1;
if (has_long_lines)
- ckfputs(", with very long lines", stdout);
+ if (file_printf(ms, ", with very long lines") == -1)
+ return -1;
/*
* Only report line terminators if we find one other than LF,
@@ -284,44 +296,56 @@ subtype_identified:
*/
if ((n_crlf == 0 && n_cr == 0 && n_nel == 0 && n_lf == 0) ||
(n_crlf != 0 || n_cr != 0 || n_nel != 0)) {
- ckfputs(", with", stdout);
+ if (file_printf(ms, ", with") == -1)
+ return -1;
- if (n_crlf == 0 && n_cr == 0 && n_nel == 0 && n_lf == 0)
- ckfputs(" no", stdout);
- else {
+ if (n_crlf == 0 && n_cr == 0 && n_nel == 0 && n_lf == 0) {
+ if (file_printf(ms, " no") == -1)
+ return -1;
+ } else {
if (n_crlf) {
- ckfputs(" CRLF", stdout);
+ if (file_printf(ms, " CRLF") == -1)
+ return -1;
if (n_cr || n_lf || n_nel)
- ckfputs(",", stdout);
+ if (file_printf(ms, ",") == -1)
+ return -1;
}
if (n_cr) {
- ckfputs(" CR", stdout);
+ if (file_printf(ms, " CR") == -1)
+ return -1;
if (n_lf || n_nel)
- ckfputs(",", stdout);
+ if (file_printf(ms, ",") == -1)
+ return -1;
}
if (n_lf) {
- ckfputs(" LF", stdout);
+ if (file_printf(ms, " LF") == -1)
+ return -1;
if (n_nel)
- ckfputs(",", stdout);
+ if (file_printf(ms, ",") == -1)
+ return -1;
}
if (n_nel)
- ckfputs(" NEL", stdout);
+ if (file_printf(ms, " NEL") == -1)
+ return -1;
}
- ckfputs(" line terminators", stdout);
+ if (file_printf(ms, " line terminators") == -1)
+ return -1;
}
if (has_escapes)
- ckfputs(", with escape sequences", stdout);
+ if (file_printf(ms, ", with escape sequences") == -1)
+ return -1;
if (has_backspace)
- ckfputs(", with overstriking", stdout);
+ if (file_printf(ms, ", with overstriking") == -1)
+ return -1;
}
return 1;
}
-static int
-ascmatch(const unsigned char *s, const unichar *us, int ulen)
+private int
+ascmatch(const unsigned char *s, const unichar *us, size_t ulen)
{
size_t i;
@@ -393,7 +417,7 @@ ascmatch(const unsigned char *s, const unichar *us, int ulen)
#define I 2 /* character appears in ISO-8859 text */
#define X 3 /* character appears in non-ISO extended ASCII (Mac, IBM PC) */
-static char text_chars[256] = {
+private char text_chars[256] = {
/* BEL BS HT LF FF CR */
F, F, F, F, F, F, F, T, T, T, T, F, T, T, F, F, /* 0x0X */
/* ESC */
@@ -415,8 +439,9 @@ static char text_chars[256] = {
I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I /* 0xfX */
};
-static int
-looks_ascii(const unsigned char *buf, int nbytes, unichar *ubuf, int *ulen)
+private int
+looks_ascii(const unsigned char *buf, size_t nbytes, unichar *ubuf,
+ size_t *ulen)
{
int i;
@@ -434,8 +459,8 @@ looks_ascii(const unsigned char *buf, int nbytes, unichar *ubuf, int *ulen)
return 1;
}
-static int
-looks_latin1(const unsigned char *buf, int nbytes, unichar *ubuf, int *ulen)
+private int
+looks_latin1(const unsigned char *buf, size_t nbytes, unichar *ubuf, size_t *ulen)
{
int i;
@@ -453,8 +478,9 @@ looks_latin1(const unsigned char *buf, int nbytes, unichar *ubuf, int *ulen)
return 1;
}
-static int
-looks_extended(const unsigned char *buf, int nbytes, unichar *ubuf, int *ulen)
+private int
+looks_extended(const unsigned char *buf, size_t nbytes, unichar *ubuf,
+ size_t *ulen)
{
int i;
@@ -472,8 +498,8 @@ looks_extended(const unsigned char *buf, int nbytes, unichar *ubuf, int *ulen)
return 1;
}
-int
-looks_utf8(const unsigned char *buf, int nbytes, unichar *ubuf, int *ulen)
+private int
+looks_utf8(const unsigned char *buf, size_t nbytes, unichar *ubuf, size_t *ulen)
{
int i, n;
unichar c;
@@ -534,8 +560,9 @@ done:
return gotone; /* don't claim it's UTF-8 if it's all 7-bit */
}
-static int
-looks_unicode(const unsigned char *buf, int nbytes, unichar *ubuf, int *ulen)
+private int
+looks_unicode(const unsigned char *buf, size_t nbytes, unichar *ubuf,
+ size_t *ulen)
{
int bigend;
int i;
@@ -562,7 +589,8 @@ looks_unicode(const unsigned char *buf, int nbytes, unichar *ubuf, int *ulen)
if (ubuf[*ulen - 1] == 0xfffe)
return 0;
- if (ubuf[*ulen - 1] < 128 && text_chars[ubuf[*ulen - 1]] != T)
+ if (ubuf[*ulen - 1] < 128 &&
+ text_chars[(size_t)ubuf[*ulen - 1]] != T)
return 0;
}
@@ -596,7 +624,7 @@ looks_unicode(const unsigned char *buf, int nbytes, unichar *ubuf, int *ulen)
* between old-style and internationalized examples of text.
*/
-unsigned char ebcdic_to_ascii[] = {
+private unsigned char ebcdic_to_ascii[] = {
0, 1, 2, 3, 156, 9, 134, 127, 151, 141, 142, 11, 12, 13, 14, 15,
16, 17, 18, 19, 157, 133, 8, 135, 24, 25, 146, 143, 28, 29, 30, 31,
128, 129, 130, 131, 132, 10, 23, 27, 136, 137, 138, 139, 140, 5, 6, 7,
@@ -615,6 +643,7 @@ unsigned char ebcdic_to_ascii[] = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 250, 251, 252, 253, 254, 255
};
+#ifdef notdef
/*
* The following EBCDIC-to-ASCII table may relate more closely to reality,
* or at least to modern reality. It comes from
@@ -629,7 +658,7 @@ unsigned char ebcdic_to_ascii[] = {
* cases for the NEL character can be taken out of the code.
*/
-unsigned char ebcdic_1047_to_8859[] = {
+private unsigned char ebcdic_1047_to_8859[] = {
0x00,0x01,0x02,0x03,0x9C,0x09,0x86,0x7F,0x97,0x8D,0x8E,0x0B,0x0C,0x0D,0x0E,0x0F,
0x10,0x11,0x12,0x13,0x9D,0x0A,0x08,0x87,0x18,0x19,0x92,0x8F,0x1C,0x1D,0x1E,0x1F,
0x80,0x81,0x82,0x83,0x84,0x85,0x17,0x1B,0x88,0x89,0x8A,0x8B,0x8C,0x05,0x06,0x07,
@@ -647,12 +676,13 @@ unsigned char ebcdic_1047_to_8859[] = {
0x5C,0xF7,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0xB2,0xD4,0xD6,0xD2,0xD3,0xD5,
0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0xB3,0xDB,0xDC,0xD9,0xDA,0x9F
};
+#endif
/*
* Copy buf[0 ... nbytes-1] into out[], translating EBCDIC to ASCII.
*/
-static void
-from_ebcdic(const unsigned char *buf, int nbytes, unsigned char *out)
+private void
+from_ebcdic(const unsigned char *buf, size_t nbytes, unsigned char *out)
{
int i;
diff --git a/contrib/file/compress.c b/contrib/file/compress.c
index 4e1219c..cdee1ce 100644
--- a/contrib/file/compress.c
+++ b/contrib/file/compress.c
@@ -1,4 +1,36 @@
/*
+ * Copyright (c) Ian F. Darwin 1986-1995.
+ * Software written by Ian F. Darwin and others;
+ * maintained 1995-present by Christos Zoulas and others.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice immediately at the beginning of the file, without modification,
+ * this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Ian F. Darwin and others.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+/*
* compress routines:
* zmagic() - returns 0 if not recognized, uncompresses and prints
* information if recognized
@@ -6,11 +38,15 @@
* using method, return sizeof new
*/
#include "file.h"
+#include "magic.h"
+#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <string.h>
+#include <errno.h>
+#include <sys/types.h>
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
@@ -19,15 +55,15 @@
#endif
#ifndef lint
-FILE_RCSID("@(#)$Id: compress.c,v 1.25 2002/07/03 18:26:37 christos Exp $")
+FILE_RCSID("@(#)$Id: compress.c,v 1.37 2004/07/24 21:00:56 christos Exp $")
#endif
-static struct {
+private struct {
const char *magic;
- int maglen;
+ size_t maglen;
const char *const argv[3];
- int silent;
+ int silent;
} compr[] = {
{ "\037\235", 2, { "gzip", "-cdq", NULL }, 1 }, /* compressed */
/* Uncompress can get stuck; so use gzip first if we have it
@@ -41,47 +77,58 @@ static struct {
{ "BZh", 3, { "bzip2", "-cd", NULL }, 1 }, /* bzip2-ed */
};
-static int ncompr = sizeof(compr) / sizeof(compr[0]);
+private int ncompr = sizeof(compr) / sizeof(compr[0]);
-static int swrite(int, const void *, size_t);
-static int sread(int, void *, size_t);
-static int uncompressbuf(int, const unsigned char *, unsigned char **, int);
+private ssize_t swrite(int, const void *, size_t);
+private ssize_t sread(int, void *, size_t);
+private size_t uncompressbuf(struct magic_set *, size_t, const unsigned char *,
+ unsigned char **, size_t);
#ifdef HAVE_LIBZ
-static int uncompressgzipped(const unsigned char *, unsigned char **, int);
+private size_t uncompressgzipped(struct magic_set *, const unsigned char *,
+ unsigned char **, size_t);
#endif
-int
-zmagic(const char *fname, unsigned char *buf, int nbytes)
+protected int
+file_zmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes)
{
- unsigned char *newbuf;
- int newsize;
- int i;
+ unsigned char *newbuf = NULL;
+ size_t i, nsz;
+ int rv = 0;
+
+ if ((ms->flags & MAGIC_COMPRESS) == 0)
+ return 0;
for (i = 0; i < ncompr; i++) {
if (nbytes < compr[i].maglen)
continue;
if (memcmp(buf, compr[i].magic, compr[i].maglen) == 0 &&
- (newsize = uncompressbuf(i, buf, &newbuf, nbytes)) != 0) {
- tryit(fname, newbuf, newsize, 1);
- free(newbuf);
- printf(" (");
- tryit(fname, buf, nbytes, 0);
- printf(")");
- return 1;
+ (nsz = uncompressbuf(ms, i, buf, &newbuf, nbytes)) != 0) {
+ ms->flags &= ~MAGIC_COMPRESS;
+ rv = -1;
+ if (file_buffer(ms, newbuf, nsz) == -1)
+ goto error;
+ if (file_printf(ms, " (") == -1)
+ goto error;
+ if (file_buffer(ms, buf, nbytes) == -1)
+ goto error;
+ if (file_printf(ms, ")") == -1)
+ goto error;
+ rv = 1;
+ break;
}
}
-
- if (i == ncompr)
- return 0;
-
- return 1;
+error:
+ if (newbuf)
+ free(newbuf);
+ ms->flags |= MAGIC_COMPRESS;
+ return rv;
}
/*
* `safe' write for sockets and pipes.
*/
-static int
+private ssize_t
swrite(int fd, const void *buf, size_t n)
{
int rv;
@@ -106,7 +153,7 @@ swrite(int fd, const void *buf, size_t n)
/*
* `safe' read for sockets and pipes.
*/
-static int
+private ssize_t
sread(int fd, void *buf, size_t n)
{
int rv;
@@ -129,8 +176,9 @@ sread(int fd, void *buf, size_t n)
return rn;
}
-int
-pipe2file(int fd, void *startbuf, size_t nbytes)
+protected int
+file_pipe2file(struct magic_set *ms, int fd, const void *startbuf,
+ size_t nbytes)
{
char buf[4096];
int r, tfd;
@@ -151,30 +199,28 @@ pipe2file(int fd, void *startbuf, size_t nbytes)
errno = r;
#endif
if (tfd == -1) {
- error("Can't create temporary file for pipe copy (%s)\n",
- strerror(errno));
- /*NOTREACHED*/
+ file_error(ms, errno,
+ "cannot create temporary file for pipe copy");
+ return -1;
}
- if (swrite(tfd, startbuf, nbytes) != nbytes)
+ if (swrite(tfd, startbuf, nbytes) != (ssize_t)nbytes)
r = 1;
else {
while ((r = sread(fd, buf, sizeof(buf))) > 0)
- if (swrite(tfd, buf, r) != r)
+ if (swrite(tfd, buf, (size_t)r) != r)
break;
}
switch (r) {
case -1:
- error("Error copying from pipe to temp file (%s)\n",
- strerror(errno));
- /*NOTREACHED*/
+ file_error(ms, errno, "error copying from pipe to temp file");
+ return -1;
case 0:
break;
default:
- error("Error while writing to temp file (%s)\n",
- strerror(errno));
- /*NOTREACHED*/
+ file_error(ms, errno, "error while writing to temp file");
+ return -1;
}
/*
@@ -183,14 +229,13 @@ pipe2file(int fd, void *startbuf, size_t nbytes)
* can still access the phantom inode.
*/
if ((fd = dup2(tfd, fd)) == -1) {
- error("Couldn't dup destcriptor for temp file(%s)\n",
- strerror(errno));
- /*NOTREACHED*/
+ file_error(ms, errno, "could not dup descriptor for temp file");
+ return -1;
}
(void)close(tfd);
if (lseek(fd, (off_t)0, SEEK_SET) == (off_t)-1) {
- error("Couldn't seek on temp file (%s)\n", strerror(errno));
- /*NOTREACHED*/
+ file_badseek(ms);
+ return -1;
}
return fd;
}
@@ -202,34 +247,42 @@ pipe2file(int fd, void *startbuf, size_t nbytes)
#define FNAME (1 << 3)
#define FCOMMENT (1 << 4)
-static int
-uncompressgzipped(const unsigned char *old, unsigned char **newch, int n)
+private size_t
+uncompressgzipped(struct magic_set *ms, const unsigned char *old,
+ unsigned char **newch, size_t n)
{
unsigned char flg = old[3];
- int data_start = 10;
+ size_t data_start = 10;
z_stream z;
int rc;
- if (flg & FEXTRA)
+ if (flg & FEXTRA) {
+ if (data_start+1 >= n)
+ return 0;
data_start += 2 + old[data_start] + old[data_start + 1] * 256;
+ }
if (flg & FNAME) {
- while(old[data_start])
+ while(data_start < n && old[data_start])
data_start++;
data_start++;
}
if(flg & FCOMMENT) {
- while(old[data_start])
+ while(data_start < n && old[data_start])
data_start++;
data_start++;
}
if(flg & FHCRC)
data_start += 2;
+ if (data_start >= n)
+ return 0;
if ((*newch = (unsigned char *)malloc(HOWMANY + 1)) == NULL) {
return 0;
}
- z.next_in = (Bytef *)(old + data_start);
+ /* XXX: const castaway, via strchr */
+ z.next_in = (Bytef *)strchr((const char *)old + data_start,
+ old[data_start]);
z.avail_in = n - data_start;
z.next_out = *newch;
z.avail_out = HOWMANY;
@@ -239,17 +292,17 @@ uncompressgzipped(const unsigned char *old, unsigned char **newch, int n)
rc = inflateInit2(&z, -15);
if (rc != Z_OK) {
- (void) fprintf(stderr,"%s: zlib: %s\n", progname, z.msg);
+ file_error(ms, 0, "zlib: %s", z.msg);
return 0;
}
rc = inflate(&z, Z_SYNC_FLUSH);
if (rc != Z_OK && rc != Z_STREAM_END) {
- fprintf(stderr,"%s: zlib: %s\n", progname, z.msg);
+ file_error(ms, 0, "zlib: %s", z.msg);
return 0;
}
- n = z.total_out;
+ n = (size_t)z.total_out;
inflateEnd(&z);
/* let's keep the nul-terminate tradition */
@@ -259,23 +312,24 @@ uncompressgzipped(const unsigned char *old, unsigned char **newch, int n)
}
#endif
-static int
-uncompressbuf(int method, const unsigned char *old, unsigned char **newch,
- int n)
+private size_t
+uncompressbuf(struct magic_set *ms, size_t method, const unsigned char *old,
+ unsigned char **newch, size_t n)
{
int fdin[2], fdout[2];
+ int r;
/* The buffer is NUL terminated, and we don't need that. */
n--;
#ifdef HAVE_LIBZ
if (method == 2)
- return uncompressgzipped(old,newch,n);
+ return uncompressgzipped(ms, old, newch, n);
#endif
if (pipe(fdin) == -1 || pipe(fdout) == -1) {
- error("cannot create pipe (%s).\n", strerror(errno));
- /*NOTREACHED*/
+ file_error(ms, errno, "cannot create pipe");
+ return 0;
}
switch (fork()) {
case 0: /* child */
@@ -296,15 +350,27 @@ uncompressbuf(int method, const unsigned char *old, unsigned char **newch,
exit(1);
/*NOTREACHED*/
case -1:
- error("could not fork (%s).\n", strerror(errno));
- /*NOTREACHED*/
+ file_error(ms, errno, "could not fork");
+ return 0;
default: /* parent */
(void) close(fdin[0]);
(void) close(fdout[1]);
- if (swrite(fdin[1], old, n) != n) {
- n = 0;
- goto err;
+ /* fork again, to avoid blocking because both pipes filled */
+ switch (fork()) {
+ case 0: /* child */
+ (void)close(fdout[0]);
+ if (swrite(fdin[1], old, n) != n)
+ exit(1);
+ exit(0);
+ /*NOTREACHED*/
+
+ case -1:
+ exit(1);
+ /*NOTREACHED*/
+
+ default: /* parent */
+ break;
}
(void) close(fdin[1]);
fdin[1] = -1;
@@ -312,10 +378,13 @@ uncompressbuf(int method, const unsigned char *old, unsigned char **newch,
n = 0;
goto err;
}
- if ((n = sread(fdout[0], *newch, HOWMANY)) <= 0) {
+ if ((r = sread(fdout[0], *newch, HOWMANY)) <= 0) {
free(*newch);
n = 0;
+ newch[0] = '\0';
goto err;
+ } else {
+ n = r;
}
/* NUL terminate, as every buffer is handled here. */
(*newch)[n++] = '\0';
@@ -323,7 +392,12 @@ err:
if (fdin[1] != -1)
(void) close(fdin[1]);
(void) close(fdout[0]);
- (void) wait(NULL);
+#ifdef WNOHANG
+ while (waitpid(-1, NULL, WNOHANG) != -1)
+ continue;
+#else
+ (void)wait(NULL);
+#endif
return n;
}
}
diff --git a/contrib/file/config.h.in b/contrib/file/config.h.in
index d00ad53..755f43f 100644
--- a/contrib/file/config.h.in
+++ b/contrib/file/config.h.in
@@ -1,31 +1,9 @@
-/* config.h.in. Generated automatically from configure.in by autoheader. */
-
-/* Define to empty if the keyword does not work. */
-#undef const
-
-/* Define if your struct stat has st_rdev. */
-#undef HAVE_ST_RDEV
-
-/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
-#undef HAVE_SYS_WAIT_H
-
-/* Define if major, minor, and makedev are declared in <mkdev.h>. */
-#undef MAJOR_IN_MKDEV
-
-/* Define if major, minor, and makedev are declared in <sysmacros.h>. */
-#undef MAJOR_IN_SYSMACROS
-
-/* Define to `long' if <sys/types.h> doesn't define. */
-#undef off_t
-
-/* Define to `unsigned' if <sys/types.h> doesn't define. */
-#undef size_t
-
-/* Define if you have the ANSI C header files. */
-#undef STDC_HEADERS
+/* config.h.in. Generated from configure.in by autoheader. */
+/* Autoheader needs me */
+#undef PACKAGE
-/* Define if your <sys/time.h> declares struct tm. */
-#undef TM_IN_SYS_TIME
+/* Autoheader needs me */
+#undef VERSION
/* Define if builtin ELF support is enabled. */
#undef BUILTIN_ELF
@@ -36,12 +14,21 @@
/* Define if the `long long' type works. */
#undef HAVE_LONG_LONG
+/* Define if we have "tm_zone" in "struct tm". */
+#undef HAVE_TM_ZONE
+
+/* Define if we have a global "char * []" "tzname" variable. */
+#undef HAVE_TZNAME
+
/* Define if we have "tm_isdst" in "struct tm". */
#undef HAVE_TM_ISDST
/* Define if we have a global "int" variable "daylight". */
#undef HAVE_DAYLIGHT
+/* Define if we have a mkstemp */
+#undef HAVE_MKSTEMP
+
/* Define to `unsigned char' if standard headers don't define. */
#undef uint8_t
@@ -58,6 +45,9 @@
/* Define to `int' if standard headers don't define. */
#undef int32_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
@@ -70,62 +60,134 @@
/* The number of bytes in a uint64_t. */
#define SIZEOF_UINT64_T 0
-/* Define if you have the getopt_long function. */
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the <getopt.h> header file. */
+#undef HAVE_GETOPT_H
+
+/* Define to 1 if you have the `getopt_long' function. */
#undef HAVE_GETOPT_LONG
-/* Define if you have the mkstemp function. */
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `z' library (-lz). */
+#undef HAVE_LIBZ
+
+/* Define to 1 if you have the <locale.h> header file. */
+#undef HAVE_LOCALE_H
+
+/* Define to 1 if you have the `mbrtowc' function. */
+#undef HAVE_MBRTOWC
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `mkstemp' function. */
#undef HAVE_MKSTEMP
-/* Define if you have the mmap function. */
+/* Define to 1 if you have the `mmap' function. */
#undef HAVE_MMAP
-/* Define if you have the strerror function. */
-#undef HAVE_STRERROR
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
-/* Define if you have the strtoul function. */
-#undef HAVE_STRTOUL
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
-/* Define if you have the <fcntl.h> header file. */
-#undef HAVE_FCNTL_H
+/* Define to 1 if you have the `strerror' function. */
+#undef HAVE_STRERROR
-/* Define if you have the <getopt.h> header file. */
-#undef HAVE_GETOPT_H
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
-/* Define if you have the <inttypes.h> header file. */
-#undef HAVE_INTTYPES_H
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
-/* Define if you have the <locale.h> header file. */
-#undef HAVE_LOCALE_H
+/* Define to 1 if you have the `strtoul' function. */
+#undef HAVE_STRTOUL
-/* Define if you have the <stdint.h> header file. */
-#undef HAVE_STDINT_H
+/* Define to 1 if `st_rdev' is member of `struct stat'. */
+#undef HAVE_STRUCT_STAT_ST_RDEV
-/* Define if you have the <sys/mman.h> header file. */
+/* Define to 1 if your `struct stat' has `st_rdev'. Deprecated, use
+ `HAVE_STRUCT_STAT_ST_RDEV' instead. */
+#undef HAVE_ST_RDEV
+
+/* Define to 1 if you have the <sys/mman.h> header file. */
#undef HAVE_SYS_MMAN_H
-/* Define if you have the <sys/stat.h> header file. */
+/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
-/* Define if you have the <sys/types.h> header file. */
+/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
-/* Define if you have the <unistd.h> header file. */
+/* Define to 1 if you have the <sys/utime.h> header file. */
+#undef HAVE_SYS_UTIME_H
+
+/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
+#undef HAVE_SYS_WAIT_H
+
+/* HAVE_TM_ZONE */
+#undef HAVE_TM_ZONE
+
+/* HAVE_TZNAME */
+#undef HAVE_TZNAME
+
+/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
-/* Define if you have the z library (-lz). */
-#undef HAVE_LIBZ
+/* Define to 1 if you have the `utime' function. */
+#undef HAVE_UTIME
+
+/* Define to 1 if you have the `utimes' function. */
+#undef HAVE_UTIMES
+
+/* Define to 1 if you have the <utime.h> header file. */
+#undef HAVE_UTIME_H
+
+/* Define to 1 if you have the <wchar.h> header file. */
+#undef HAVE_WCHAR_H
+
+/* Define to 1 if you have the `wcwidth' function. */
+#undef HAVE_WCWIDTH
+
+/* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>.
+ */
+#undef MAJOR_IN_MKDEV
+
+/* Define to 1 if `major', `minor', and `makedev' are declared in
+ <sysmacros.h>. */
+#undef MAJOR_IN_SYSMACROS
/* Name of package */
#undef PACKAGE
-/* Version number of package */
-#undef VERSION
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
-/* HAVE_TM_ZONE */
-#undef HAVE_TM_ZONE
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
-/* HAVE_TZNAME */
-#undef HAVE_TZNAME
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define to 1 if your <sys/time.h> declares `struct tm'. */
+#undef TM_IN_SYS_TIME
+
+/* Version number of package */
+#undef VERSION
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
@@ -133,3 +195,14 @@
/* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define to a type if <wchar.h> does not define. */
+#undef mbstate_t
+
+/* Define to `long' if <sys/types.h> does not define. */
+#undef off_t
+
+/* Define to `unsigned' if <sys/types.h> does not define. */
+#undef size_t
diff --git a/contrib/file/configure b/contrib/file/configure
index 6a3e072..b2e541f 100755
--- a/contrib/file/configure
+++ b/contrib/file/configure
@@ -1,34 +1,324 @@
#! /bin/sh
-
# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.13
-# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+# Generated by GNU Autoconf 2.57.
#
+# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
+# Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
+fi
+
+# Support unset when possible.
+if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)$' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" || {
+ # Find who we are. Look in the path if we contain no path at all
+ # relative or not.
+ case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+ ;;
+ esac
+ # We did not find ourselves, most probably we were run as `sh COMMAND'
+ # in which case we are not to be found in the path.
+ if test "x$as_myself" = x; then
+ as_myself=$0
+ fi
+ if test ! -f "$as_myself"; then
+ { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
+ { (exit 1); exit 1; }; }
+ fi
+ case $CONFIG_SHELL in
+ '')
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for as_base in sh bash ksh sh5; do
+ case $as_dir in
+ /*)
+ if ("$as_dir/$as_base" -c '
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+ CONFIG_SHELL=$as_dir/$as_base
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+ fi;;
+ esac
+ done
+done
+;;
+ esac
-# Defaults:
-ac_help=
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line before each line; the second 'sed' does the real
+ # work. The second script uses 'N' to pair each line-number line
+ # with the numbered line, and appends trailing '-' during
+ # substitution so that $LINENO is not a special case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
+ sed '=' <$as_myself |
+ sed '
+ N
+ s,$,-,
+ : loop
+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+ t loop
+ s,-$,,
+ s,^['$as_cr_digits']*\n,,
+ ' >$as_me.lineno &&
+ chmod +x $as_me.lineno ||
+ { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensible to this).
+ . ./$as_me.lineno
+ # Exit status is that of the last command.
+ exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T=' ' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
+ as_ln_s='cp -p'
+ else
+ as_ln_s='ln -s'
+ fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+exec 6>&1
+
+#
+# Initializations.
+#
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"
-ac_help="$ac_help
- --enable-fsect-man5 enable file formats in man section 5"
-ac_help="$ac_help
- --disable-largefile omit support for large files"
+ac_config_libobj_dir=.
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Maximum number of lines to put in a shell here document.
+# This variable seems obsolete. It should probably be removed, and
+# only ac_max_sed_lines should be used.
+: ${ac_max_here_lines=38}
+
+# Identity of this package.
+PACKAGE_NAME=
+PACKAGE_TARNAME=
+PACKAGE_VERSION=
+PACKAGE_STRING=
+PACKAGE_BUGREPORT=
+
+ac_unique_file="src/file.c"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+# include <stdint.h>
+# endif
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE am__leading_dot MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT fsect FSECT5_TRUE FSECT5_FALSE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE LN_S build build_cpu build_vendor build_os host host_cpu host_vendor host_os RANLIB ac_ct_RANLIB LIBTOOL CPP EGREP LIBOBJS LTLIBOBJS'
+ac_subst_files=''
# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
# The variables have the same names as the options, with
# dashes changed to underlines.
-build=NONE
-cache_file=./config.cache
+cache_file=/dev/null
exec_prefix=NONE
-host=NONE
no_create=
-nonopt=NONE
no_recursion=
prefix=NONE
program_prefix=NONE
@@ -37,10 +327,15 @@ program_transform_name=s,x,x,
silent=
site=
srcdir=
-target=NONE
verbose=
x_includes=NONE
x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
@@ -54,17 +349,9 @@ oldincludedir='/usr/include'
infodir='${prefix}/info'
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
-
ac_prev=
for ac_option
do
-
# If the previous option needs an argument, assign it.
if test -n "$ac_prev"; then
eval "$ac_prev=\$ac_option"
@@ -72,59 +359,59 @@ do
continue
fi
- case "$ac_option" in
- -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) ac_optarg= ;;
- esac
+ ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
# Accept the important Cygnus configure options, so we can diagnose typos.
- case "$ac_option" in
+ case $ac_option in
-bindir | --bindir | --bindi | --bind | --bin | --bi)
ac_prev=bindir ;;
-bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
- bindir="$ac_optarg" ;;
+ bindir=$ac_optarg ;;
-build | --build | --buil | --bui | --bu)
- ac_prev=build ;;
+ ac_prev=build_alias ;;
-build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build="$ac_optarg" ;;
+ build_alias=$ac_optarg ;;
-cache-file | --cache-file | --cache-fil | --cache-fi \
| --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
ac_prev=cache_file ;;
-cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
| --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
- cache_file="$ac_optarg" ;;
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
-datadir | --datadir | --datadi | --datad | --data | --dat | --da)
ac_prev=datadir ;;
-datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
| --da=*)
- datadir="$ac_optarg" ;;
+ datadir=$ac_optarg ;;
-disable-* | --disable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+ ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
# Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- eval "enable_${ac_feature}=no" ;;
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ eval "enable_$ac_feature=no" ;;
-enable-* | --enable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+ ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
# Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
*) ac_optarg=yes ;;
esac
- eval "enable_${ac_feature}='$ac_optarg'" ;;
+ eval "enable_$ac_feature='$ac_optarg'" ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
@@ -133,95 +420,47 @@ do
-exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
| --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
| --exec=* | --exe=* | --ex=*)
- exec_prefix="$ac_optarg" ;;
+ exec_prefix=$ac_optarg ;;
-gas | --gas | --ga | --g)
# Obsolete; use --with-gas.
with_gas=yes ;;
- -help | --help | --hel | --he)
- # Omit some internal or obsolete options to make the list less imposing.
- # This message is too long to be a string in the A/UX 3.1 sh.
- cat << EOF
-Usage: configure [options] [host]
-Options: [defaults in brackets after descriptions]
-Configuration:
- --cache-file=FILE cache test results in FILE
- --help print this message
- --no-create do not create output files
- --quiet, --silent do not print \`checking...' messages
- --version print the version of autoconf that created configure
-Directory and file names:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [same as prefix]
- --bindir=DIR user executables in DIR [EPREFIX/bin]
- --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
- --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data in DIR
- [PREFIX/share]
- --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data in DIR
- [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
- --libdir=DIR object code libraries in DIR [EPREFIX/lib]
- --includedir=DIR C header files in DIR [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
- --infodir=DIR info documentation in DIR [PREFIX/info]
- --mandir=DIR man documentation in DIR [PREFIX/man]
- --srcdir=DIR find the sources in DIR [configure dir or ..]
- --program-prefix=PREFIX prepend PREFIX to installed program names
- --program-suffix=SUFFIX append SUFFIX to installed program names
- --program-transform-name=PROGRAM
- run sed PROGRAM on installed program names
-EOF
- cat << EOF
-Host type:
- --build=BUILD configure for building on BUILD [BUILD=HOST]
- --host=HOST configure for HOST [guessed]
- --target=TARGET configure for TARGET [TARGET=HOST]
-Features and packages:
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --x-includes=DIR X include files are in DIR
- --x-libraries=DIR X library files are in DIR
-EOF
- if test -n "$ac_help"; then
- echo "--enable and --with options recognized:$ac_help"
- fi
- exit 0 ;;
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
-host | --host | --hos | --ho)
- ac_prev=host ;;
+ ac_prev=host_alias ;;
-host=* | --host=* | --hos=* | --ho=*)
- host="$ac_optarg" ;;
+ host_alias=$ac_optarg ;;
-includedir | --includedir | --includedi | --included | --include \
| --includ | --inclu | --incl | --inc)
ac_prev=includedir ;;
-includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
| --includ=* | --inclu=* | --incl=* | --inc=*)
- includedir="$ac_optarg" ;;
+ includedir=$ac_optarg ;;
-infodir | --infodir | --infodi | --infod | --info | --inf)
ac_prev=infodir ;;
-infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
- infodir="$ac_optarg" ;;
+ infodir=$ac_optarg ;;
-libdir | --libdir | --libdi | --libd)
ac_prev=libdir ;;
-libdir=* | --libdir=* | --libdi=* | --libd=*)
- libdir="$ac_optarg" ;;
+ libdir=$ac_optarg ;;
-libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
| --libexe | --libex | --libe)
ac_prev=libexecdir ;;
-libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
| --libexe=* | --libex=* | --libe=*)
- libexecdir="$ac_optarg" ;;
+ libexecdir=$ac_optarg ;;
-localstatedir | --localstatedir | --localstatedi | --localstated \
| --localstate | --localstat | --localsta | --localst \
@@ -230,19 +469,19 @@ EOF
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
| --localstate=* | --localstat=* | --localsta=* | --localst=* \
| --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
- localstatedir="$ac_optarg" ;;
+ localstatedir=$ac_optarg ;;
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
ac_prev=mandir ;;
-mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
- mandir="$ac_optarg" ;;
+ mandir=$ac_optarg ;;
-nfp | --nfp | --nf)
# Obsolete; use --without-fp.
with_fp=no ;;
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c)
+ | --no-cr | --no-c | -n)
no_create=yes ;;
-no-recursion | --no-recursion | --no-recursio | --no-recursi \
@@ -256,26 +495,26 @@ EOF
-oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
| --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
| --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
- oldincludedir="$ac_optarg" ;;
+ oldincludedir=$ac_optarg ;;
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
ac_prev=prefix ;;
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
- prefix="$ac_optarg" ;;
+ prefix=$ac_optarg ;;
-program-prefix | --program-prefix | --program-prefi | --program-pref \
| --program-pre | --program-pr | --program-p)
ac_prev=program_prefix ;;
-program-prefix=* | --program-prefix=* | --program-prefi=* \
| --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
- program_prefix="$ac_optarg" ;;
+ program_prefix=$ac_optarg ;;
-program-suffix | --program-suffix | --program-suffi | --program-suff \
| --program-suf | --program-su | --program-s)
ac_prev=program_suffix ;;
-program-suffix=* | --program-suffix=* | --program-suffi=* \
| --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
- program_suffix="$ac_optarg" ;;
+ program_suffix=$ac_optarg ;;
-program-transform-name | --program-transform-name \
| --program-transform-nam | --program-transform-na \
@@ -292,7 +531,7 @@ EOF
| --program-transfo=* | --program-transf=* \
| --program-trans=* | --program-tran=* \
| --progr-tra=* | --program-tr=* | --program-t=*)
- program_transform_name="$ac_optarg" ;;
+ program_transform_name=$ac_optarg ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
@@ -302,7 +541,7 @@ EOF
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
| --sbi=* | --sb=*)
- sbindir="$ac_optarg" ;;
+ sbindir=$ac_optarg ;;
-sharedstatedir | --sharedstatedir | --sharedstatedi \
| --sharedstated | --sharedstate | --sharedstat | --sharedsta \
@@ -313,58 +552,57 @@ EOF
| --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
| --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
| --sha=* | --sh=*)
- sharedstatedir="$ac_optarg" ;;
+ sharedstatedir=$ac_optarg ;;
-site | --site | --sit)
ac_prev=site ;;
-site=* | --site=* | --sit=*)
- site="$ac_optarg" ;;
+ site=$ac_optarg ;;
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- srcdir="$ac_optarg" ;;
+ srcdir=$ac_optarg ;;
-sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
| --syscon | --sysco | --sysc | --sys | --sy)
ac_prev=sysconfdir ;;
-sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
| --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
- sysconfdir="$ac_optarg" ;;
+ sysconfdir=$ac_optarg ;;
-target | --target | --targe | --targ | --tar | --ta | --t)
- ac_prev=target ;;
+ ac_prev=target_alias ;;
-target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target="$ac_optarg" ;;
+ target_alias=$ac_optarg ;;
-v | -verbose | --verbose | --verbos | --verbo | --verb)
verbose=yes ;;
- -version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.13"
- exit 0 ;;
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
-with-* | --with-*)
- ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+ ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
# Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
ac_package=`echo $ac_package| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
*) ac_optarg=yes ;;
esac
- eval "with_${ac_package}='$ac_optarg'" ;;
+ eval "with_$ac_package='$ac_optarg'" ;;
-without-* | --without-*)
- ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+ ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
# Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- eval "with_${ac_package}=no" ;;
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package | sed 's/-/_/g'`
+ eval "with_$ac_package=no" ;;
--x)
# Obsolete; use --with-x.
@@ -375,99 +613,110 @@ EOF
ac_prev=x_includes ;;
-x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
| --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
- x_includes="$ac_optarg" ;;
+ x_includes=$ac_optarg ;;
-x-libraries | --x-libraries | --x-librarie | --x-librari \
| --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
ac_prev=x_libraries ;;
-x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
- x_libraries="$ac_optarg" ;;
+ x_libraries=$ac_optarg ;;
- -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+ -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; }
;;
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+ { (exit 1); exit 1; }; }
+ ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+ eval "$ac_envvar='$ac_optarg'"
+ export $ac_envvar ;;
+
*)
- if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
- echo "configure: warning: $ac_option: invalid host type" 1>&2
- fi
- if test "x$nonopt" != xNONE; then
- { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
- fi
- nonopt="$ac_option"
+ # FIXME: should be removed in autoconf 3.0.
+ echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
;;
esac
done
if test -n "$ac_prev"; then
- { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ { echo "$as_me: error: missing argument to $ac_option" >&2
+ { (exit 1); exit 1; }; }
fi
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-# File descriptor usage:
-# 0 standard input
-# 1 file creation
-# 2 errors and warnings
-# 3 some systems may open it to /dev/tty
-# 4 used on the Kubota Titan
-# 6 checking for... messages and results
-# 5 compiler messages saved in config.log
-if test "$silent" = yes; then
- exec 6>/dev/null
-else
- exec 6>&1
-fi
-exec 5>./config.log
-
-echo "\
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-" 1>&5
+# Be sure to have absolute paths.
+for ac_var in exec_prefix prefix
+do
+ eval ac_val=$`echo $ac_var`
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
+ esac
+done
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Also quote any args containing shell metacharacters.
-ac_configure_args=
-for ac_arg
+# Be sure to have absolute paths.
+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+ localstatedir libdir includedir oldincludedir infodir mandir
do
- case "$ac_arg" in
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c) ;;
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
- ac_configure_args="$ac_configure_args '$ac_arg'" ;;
- *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+ eval ac_val=$`echo $ac_var`
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) ;;
+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
esac
done
-# NLS nuisances.
-# Only set these to C if already set. These must not be set unconditionally
-# because not all systems understand e.g. LANG=C (notably SCO).
-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
-# Non-C LC_CTYPE values break the ctype check.
-if test "${LANG+set}" = set; then LANG=C; export LANG; fi
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+ If a cross compiler is detected then cross compile mode will be used." >&2
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo > confdefs.h
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
-# A filename unique to this package, relative to the directory that
-# configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=file.c
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
ac_srcdir_defaulted=yes
# Try the directory containing this script, then its parent.
- ac_prog=$0
- ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
- test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+ ac_confdir=`(dirname "$0") 2>/dev/null ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$0" : 'X\(//\)[^/]' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$0" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
srcdir=$ac_confdir
if test ! -r $srcdir/$ac_unique_file; then
srcdir=..
@@ -477,13 +726,453 @@ else
fi
if test ! -r $srcdir/$ac_unique_file; then
if test "$ac_srcdir_defaulted" = yes; then
- { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
+ { (exit 1); exit 1; }; }
else
- { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+ { (exit 1); exit 1; }; }
fi
fi
-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
+ { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+ { (exit 1); exit 1; }; }
+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
+ac_env_build_alias_set=${build_alias+set}
+ac_env_build_alias_value=$build_alias
+ac_cv_env_build_alias_set=${build_alias+set}
+ac_cv_env_build_alias_value=$build_alias
+ac_env_host_alias_set=${host_alias+set}
+ac_env_host_alias_value=$host_alias
+ac_cv_env_host_alias_set=${host_alias+set}
+ac_cv_env_host_alias_value=$host_alias
+ac_env_target_alias_set=${target_alias+set}
+ac_env_target_alias_value=$target_alias
+ac_cv_env_target_alias_set=${target_alias+set}
+ac_cv_env_target_alias_value=$target_alias
+ac_env_CC_set=${CC+set}
+ac_env_CC_value=$CC
+ac_cv_env_CC_set=${CC+set}
+ac_cv_env_CC_value=$CC
+ac_env_CFLAGS_set=${CFLAGS+set}
+ac_env_CFLAGS_value=$CFLAGS
+ac_cv_env_CFLAGS_set=${CFLAGS+set}
+ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_LDFLAGS_set=${LDFLAGS+set}
+ac_env_LDFLAGS_value=$LDFLAGS
+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
+ac_cv_env_LDFLAGS_value=$LDFLAGS
+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_env_CPPFLAGS_value=$CPPFLAGS
+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+ac_env_CPP_set=${CPP+set}
+ac_env_CPP_value=$CPP
+ac_cv_env_CPP_set=${CPP+set}
+ac_cv_env_CPP_value=$CPP
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures this package to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+_ACEOF
+
+ cat <<_ACEOF
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --infodir=DIR info documentation [PREFIX/info]
+ --mandir=DIR man documentation [PREFIX/man]
+_ACEOF
+
+ cat <<\_ACEOF
+
+Program names:
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM run sed PROGRAM on installed program names
+
+System types:
+ --build=BUILD configure for building on BUILD [guessed]
+ --host=HOST cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-maintainer-mode enable make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer
+ --disable-elf disable builtin ELF support
+ --disable-elf-core disable ELF core file support
+ --enable-fsect-man5 enable file formats in man section 5
+ --disable-dependency-tracking Speeds up one-time builds
+ --enable-dependency-tracking Do not reject slow dependency extractors
+ --enable-shared=PKGS build shared libraries default=yes
+ --enable-static=PKGS build static libraries default=yes
+ --enable-fast-install=PKGS optimize for fast installation default=yes
+ --disable-libtool-lock avoid locking (might break parallel builds)
+ --disable-largefile omit support for large files
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-gnu-ld assume the C compiler uses GNU ld default=no
+ --with-pic try to use only PIC/non-PIC objects default=use both
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
+ headers in a nonstandard directory <include dir>
+ CPP C preprocessor
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+_ACEOF
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ ac_popdir=`pwd`
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d $ac_dir || continue
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
+# absolute.
+ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
+ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
+ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
+ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
+
+ cd $ac_dir
+ # Check for guested configure; otherwise get Cygnus style configure.
+ if test -f $ac_srcdir/configure.gnu; then
+ echo
+ $SHELL $ac_srcdir/configure.gnu --help=recursive
+ elif test -f $ac_srcdir/configure; then
+ echo
+ $SHELL $ac_srcdir/configure --help=recursive
+ elif test -f $ac_srcdir/configure.ac ||
+ test -f $ac_srcdir/configure.in; then
+ echo
+ $ac_configure --help
+ else
+ echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi
+ cd $ac_popdir
+ done
+fi
+
+test -n "$ac_init_help" && exit 0
+if $ac_init_version; then
+ cat <<\_ACEOF
+
+Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
+Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit 0
+fi
+exec 5>config.log
+cat >&5 <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by $as_me, which was
+generated by GNU Autoconf 2.57. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ echo "PATH: $as_dir"
+done
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_sep=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+ 2)
+ ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+ # Get rid of the leading space.
+ ac_sep=" "
+ ;;
+ esac
+ done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Be sure not to use single quotes in there, as some shells,
+# such as our DU 5.0 friend, will then `close' the trap.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+{
+ (set) 2>&1 |
+ case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ sed -n \
+ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+ ;;
+ *)
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+}
+ echo
+
+ cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=$`echo $ac_var`
+ echo "$ac_var='"'"'$ac_val'"'"'"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ cat <<\_ASBOX
+## ------------- ##
+## Output files. ##
+## ------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=$`echo $ac_var`
+ echo "$ac_var='"'"'$ac_val'"'"'"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+ echo
+ sed "/^$/d" confdefs.h | sort
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ echo "$as_me: caught signal $ac_signal"
+ echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core core.* *.core &&
+ rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+ ' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo >confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
# Prefer explicitly selected file to automatically selected ones.
if test -z "$CONFIG_SITE"; then
if test "x$prefix" != xNONE; then
@@ -494,41 +1183,106 @@ if test -z "$CONFIG_SITE"; then
fi
for ac_site_file in $CONFIG_SITE; do
if test -r "$ac_site_file"; then
- echo "loading site script $ac_site_file"
+ { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
. "$ac_site_file"
fi
done
if test -r "$cache_file"; then
- echo "loading cache $cache_file"
- . $cache_file
+ # Some versions of bash will fail to source /dev/null (special
+ # files actually), so we avoid doing that.
+ if test -f "$cache_file"; then
+ { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . $cache_file;;
+ *) . ./$cache_file;;
+ esac
+ fi
else
- echo "creating cache $cache_file"
- > $cache_file
+ { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in `(set) 2>&1 |
+ sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val="\$ac_cv_env_${ac_var}_value"
+ eval ac_new_val="\$ac_env_${ac_var}_value"
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
+echo "$as_me: former value: $ac_old_val" >&2;}
+ { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
+echo "$as_me: current value: $ac_new_val" >&2;}
+ ac_cache_corrupted=:
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+ { (exit 1); exit 1; }; }
fi
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
-
-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
- ac_n= ac_c='
-' ac_t=' '
- else
- ac_n=-n ac_c= ac_t=
- fi
-else
- ac_n= ac_c='\c' ac_t=
-fi
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+am__api_version="1.7"
ac_aux_dir=
for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
if test -f $ac_dir/install-sh; then
@@ -539,14 +1293,20 @@ for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install.sh -c"
break
+ elif test -f $ac_dir/shtool; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -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; }
+ { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
+echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
+ { (exit 1); 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.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
+ac_configure="$SHELL $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
@@ -555,308 +1315,477 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
# SunOS /usr/etc/install
# IRIX /sbin/install
# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
# 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:564: checking for a BSD compatible install" >&5
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+if test "${ac_cv_path_install+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+ ./ | .// | /cC/* | \
+ /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
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
done
- ;;
- esac
- done
- IFS="$ac_save_IFS"
+ done
+ ;;
+esac
+done
+
fi
if test "${ac_cv_path_install+set}" = set; then
- INSTALL="$ac_cv_path_install"
+ 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"
+ INSTALL=$ac_install_sh
fi
fi
-echo "$ac_t""$INSTALL" 1>&6
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&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_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:617: checking whether build environment is sane" >&5
+echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6
# Just in case
sleep 1
-echo timestamp > conftestfile
+echo timestamp > conftest.file
# 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`
+ set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
if test "$*" = "X"; then
# -L didn't work.
- set X `ls -t $srcdir/configure conftestfile`
+ set X `ls -t $srcdir/configure conftest.file`
fi
- if test "$*" != "X $srcdir/configure conftestfile" \
- && test "$*" != "X conftestfile $srcdir/configure"; then
+ rm -f conftest.file
+ if test "$*" != "X $srcdir/configure conftest.file" \
+ && test "$*" != "X conftest.file $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; }
+ { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" >&5
+echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" >&2;}
+ { (exit 1); exit 1; }; }
fi
- test "$2" = conftestfile
+ test "$2" = conftest.file
)
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
+ { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
+Check your system clock" >&5
+echo "$as_me: error: newly created file is older than distributed files!
+Check your system clock" >&2;}
+ { (exit 1); exit 1; }; }
fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
test "$program_prefix" != NONE &&
- program_transform_name="s,^,${program_prefix},; $program_transform_name"
+ 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"
+ program_transform_name="s,\$,$program_suffix,;$program_transform_name"
+# Double any \ or $. echo might interpret backslashes.
+# By default was `s,x,x', remove it if useless.
+cat <<\_ACEOF >conftest.sed
+s/[\\$]/&&/g;s/;s,x,x,$//
+_ACEOF
+program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
+rm conftest.sed
+
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
+echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+for ac_prog in gawk mawk nawk awk
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_AWK+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$AWK"; then
+ ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AWK="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
-# sed with no file args requires a program.
-test "$program_transform_name" = "" && program_transform_name="s,x,x,"
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+ echo "$as_me:$LINENO: result: $AWK" >&5
+echo "${ECHO_T}$AWK" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$AWK" && break
+done
-echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:674: 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
+echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'`
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftestmake <<\EOF
+ cat >conftest.make <<\_ACEOF
all:
- @echo 'ac_maketemp="${MAKE}"'
-EOF
+ @echo 'ac_maketemp="$(MAKE)"'
+_ACEOF
# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
+eval `${MAKE-make} -f conftest.make 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
+rm -f conftest.make
fi
if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
SET_MAKE=
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
SET_MAKE="MAKE=${MAKE-make}"
fi
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
-PACKAGE=file
-
-VERSION=3.41
+ # test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+ test -f $srcdir/config.status; then
+ { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
+echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
+ { (exit 1); exit 1; }; }
+fi
-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; }
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
fi
-cat >> confdefs.h <<EOF
+
+
+# Define the identity of the package.
+ PACKAGE=file
+ VERSION=4.10
+
+
+cat >>confdefs.h <<_ACEOF
#define PACKAGE "$PACKAGE"
-EOF
+_ACEOF
+
-cat >> confdefs.h <<EOF
+cat >>confdefs.h <<_ACEOF
#define VERSION "$VERSION"
-EOF
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
-missing_dir=`cd $ac_aux_dir && pwd`
-echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:720: 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
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_STRIP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ACLOCAL="$missing_dir/missing aclocal"
- echo "$ac_t""missing" 1>&6
-fi
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
-echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:733: 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
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6
else
- AUTOCONF="$missing_dir/missing autoconf"
- echo "$ac_t""missing" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:746: 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
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
-echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:759: 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
+ test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":"
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6
else
- AUTOHEADER="$missing_dir/missing autoheader"
- echo "$ac_t""missing" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:772: 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
+ STRIP=$ac_ct_STRIP
else
- MAKEINFO="$missing_dir/missing makeinfo"
- echo "$ac_t""missing" 1>&6
+ STRIP="$ac_cv_prog_STRIP"
fi
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+
+ ac_config_headers="$ac_config_headers config.h"
+
+echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6
+ # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then
+ enableval="$enable_maintainer_mode"
+ USE_MAINTAINER_MODE=$enableval
+else
+ USE_MAINTAINER_MODE=no
+fi;
+ echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5
+echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6
+
+
+if test $USE_MAINTAINER_MODE = yes; then
+ MAINTAINER_MODE_TRUE=
+ MAINTAINER_MODE_FALSE='#'
+else
+ MAINTAINER_MODE_TRUE='#'
+ MAINTAINER_MODE_FALSE=
+fi
+ MAINT=$MAINTAINER_MODE_TRUE
-echo $ac_n "checking for builtin ELF support""... $ac_c" 1>&6
-echo "configure:790: checking for builtin ELF support" >&5
+
+echo "$as_me:$LINENO: checking for builtin ELF support" >&5
+echo $ECHO_N "checking for builtin ELF support... $ECHO_C" >&6
# 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
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+ cat >>confdefs.h <<\_ACEOF
#define BUILTIN_ELF 1
-EOF
+_ACEOF
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
else
-
+
# enable by default
- echo "$ac_t""yes" 1>&6
- cat >> confdefs.h <<\EOF
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+ cat >>confdefs.h <<\_ACEOF
#define BUILTIN_ELF 1
-EOF
+_ACEOF
-fi
-
+fi;
-echo $ac_n "checking for ELF core file support""... $ac_c" 1>&6
-echo "configure:816: checking for ELF core file support" >&5
+echo "$as_me:$LINENO: checking for ELF core file support" >&5
+echo $ECHO_N "checking for ELF core file support... $ECHO_C" >&6
# 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
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+ cat >>confdefs.h <<\_ACEOF
#define ELFCORE 1
-EOF
+_ACEOF
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
else
-
+
# enable by default
- echo "$ac_t""yes" 1>&6
- cat >> confdefs.h <<\EOF
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+ cat >>confdefs.h <<\_ACEOF
#define ELFCORE 1
-EOF
-
+_ACEOF
-fi
+fi;
-echo $ac_n "checking for file formats in man section 5""... $ac_c" 1>&6
-echo "configure:842: checking for file formats in man section 5" >&5
+echo "$as_me:$LINENO: checking for file formats in man section 5" >&5
+echo $ECHO_N "checking for file formats in man section 5... $ECHO_C" >&6
# Check whether --enable-fsect-man5 or --disable-fsect-man5 was given.
if test "${enable_fsect_man5+set}" = set; then
enableval="$enable_fsect_man5"
if test "${enableval}" = yes; then
- echo "$ac_t""yes" 1>&6
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
fsect=5
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fsect=4
fi
else
-
+
# disable by default
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fsect=4
-fi
-
+fi;
@@ -868,214 +1797,644 @@ else
FSECT5_FALSE=
fi
-# Extract the first word of "gcc", so it can be a program name with args.
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # 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:875: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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="gcc"
- break
- fi
- done
- IFS="$ac_save_ifs"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
fi
fi
-CC="$ac_cv_prog_CC"
+CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
else
- echo "$ac_t""no" 1>&6
+ CC="$ac_cv_prog_CC"
fi
+fi
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:905: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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_prog_rejected=no
- 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
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- break
- fi
- done
- IFS="$ac_save_ifs"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
if test $ac_prog_rejected = yes; then
# We found a bogon in the path, so make sure we never use it.
set dummy $ac_cv_prog_CC
shift
- if test $# -gt 0; then
+ if test $# != 0; then
# We chose a different compiler from the bogus one.
# However, it has the same basename, so the bogon will be chosen
# first if we set CC to just the basename; use the full file name.
shift
- set dummy "$ac_dir/$ac_word" "$@"
- shift
- ac_cv_prog_CC="$@"
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
fi
fi
fi
fi
-CC="$ac_cv_prog_CC"
+CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&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:956: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
fi
fi
-CC="$ac_cv_prog_CC"
+CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&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; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:988: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
-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
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
-cat > conftest.$ac_ext << EOF
+ test -n "$ac_ct_CC" && break
+done
-#line 999 "configure"
-#include "confdefs.h"
+ CC=$ac_ct_CC
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+ "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+ (eval $ac_compiler --version </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+ (eval $ac_compiler -v </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+ (eval $ac_compiler -V </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
-main(){return(0);}
-EOF
-if { (eval echo configure:1004: \"$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
- ac_cv_prog_cc_cross=no
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+echo "$as_me:$LINENO: checking for C compiler default output" >&5
+echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
+ (eval $ac_link_default) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Find the output, starting from the most likely. This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+
+# Be careful to initialize this variable, since it used to be cached.
+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
+ac_cv_exeext=
+# b.out is created by i960 compilers.
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
+ ;;
+ conftest.$ac_ext )
+ # This is the source file.
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ # FIXME: I believe we export ac_cv_exeext for Libtool,
+ # but it would be cool to find out if it's true. Does anybody
+ # maintain Libtool? --akim.
+ export ac_cv_exeext
+ break;;
+ * )
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
+
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+ if { ac_try='./$ac_file'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cross_compiling=no
else
- ac_cv_prog_cc_cross=yes
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
fi
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- 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:1030: 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:1035: 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
- cat > conftest.c <<EOF
-#ifdef __GNUC__
- yes;
-#endif
-EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1044: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
- ac_cv_prog_gcc=yes
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ export ac_cv_exeext
+ break;;
+ * ) break;;
+ esac
+done
else
- ac_cv_prog_gcc=no
-fi
-fi
-
-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+ { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+if test "${ac_cv_objext+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
else
- GCC=
-fi
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
-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:1063: 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
- echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_compiler_gnu=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_prog_cc_g=yes
else
- ac_cv_prog_cc_g=no
-fi
-rm -f conftest*
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ac_cv_prog_cc_g=no
fi
-
-echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
+ CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
if test "$GCC" = yes; then
CFLAGS="-g -O2"
@@ -1089,6 +2448,390 @@ else
CFLAGS=
fi
fi
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX -qlanglvl=ansi
+# Ultrix and OSF/1 -std1
+# HP-UX 10.20 and later -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+ x|xno)
+ echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+ *)
+ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+ CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# Some people use a C++ compiler to compile C. Since we use `exit',
+# in C++ we need to declare it. In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+ choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ for ac_declaration in \
+ ''\
+ '#include <stdlib.h>' \
+ 'extern "C" void std::exit (int) throw (); using std::exit;' \
+ 'extern "C" void std::exit (int); using std::exit;' \
+ 'extern "C" void exit (int) throw ();' \
+ 'extern "C" void exit (int);' \
+ 'void exit (int);'
+do
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+$ac_declaration
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+ echo '#ifdef __cplusplus' >>confdefs.h
+ echo $ac_declaration >>confdefs.h
+ echo '#endif' >>confdefs.h
+fi
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+DEPDIR="${am__leading_dot}deps"
+
+ ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
+echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+ am__include=include
+ am__quote=
+ _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ fi
+fi
+
+
+echo "$as_me:$LINENO: result: $_am_result" >&5
+echo "${ECHO_T}$_am_result" >&6
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then
+ enableval="$enable_dependency_tracking"
+
+fi;
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+fi
+
+
+if test "x$enable_dependency_tracking" != xno; then
+ AMDEP_TRUE=
+ AMDEP_FALSE='#'
+else
+ AMDEP_TRUE='#'
+ AMDEP_FALSE=
+fi
+
+
+
+
+depcc="$CC" am_compiler_list=
+
+echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_CC_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ : > sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode=$depmode \
+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored.
+ if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else
+ am_cv_CC_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+
+
+if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+ am__fastdepCC_TRUE=
+ am__fastdepCC_FALSE='#'
+else
+ am__fastdepCC_TRUE='#'
+ am__fastdepCC_FALSE=
+fi
+
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
@@ -1097,205 +2840,1370 @@ fi
# SunOS /usr/etc/install
# IRIX /sbin/install
# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
# 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:1106: checking for a BSD compatible install" >&5
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+if test "${ac_cv_path_install+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+ ./ | .// | /cC/* | \
+ /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
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
done
- ;;
- esac
- done
- IFS="$ac_save_IFS"
+ done
+ ;;
+esac
+done
+
fi
if test "${ac_cv_path_install+set}" = set; then
- INSTALL="$ac_cv_path_install"
+ 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"
+ INSTALL=$ac_install_sh
fi
fi
-echo "$ac_t""$INSTALL" 1>&6
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&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_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1159: 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
+echo "$as_me:$LINENO: checking whether ln -s works" >&5
+echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+ echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+echo "${ECHO_T}no, using $LN_S" >&6
+fi
+
+# Check whether --enable-shared or --disable-shared was given.
+if test "${enable_shared+set}" = set; then
+ enableval="$enable_shared"
+ p=${PACKAGE-default}
+case $enableval in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_shared=yes
+fi;
+# Check whether --enable-static or --disable-static was given.
+if test "${enable_static+set}" = set; then
+ enableval="$enable_static"
+ p=${PACKAGE-default}
+case $enableval in
+yes) enable_static=yes ;;
+no) enable_static=no ;;
+*)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_static=yes
+fi;
+# Check whether --enable-fast-install or --disable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then
+ enableval="$enable_fast_install"
+ p=${PACKAGE-default}
+case $enableval in
+yes) enable_fast_install=yes ;;
+no) enable_fast_install=no ;;
+*)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_fast_install=yes
+fi;
+# Make sure we can run config.sub.
+$ac_config_sub sun4 >/dev/null 2>&1 ||
+ { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
+echo "$as_me: error: cannot run $ac_config_sub" >&2;}
+ { (exit 1); exit 1; }; }
+
+echo "$as_me:$LINENO: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6
+if test "${ac_cv_build+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_build_alias=$build_alias
+test -z "$ac_cv_build_alias" &&
+ ac_cv_build_alias=`$ac_config_guess`
+test -z "$ac_cv_build_alias" &&
+ { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+ { (exit 1); exit 1; }; }
+ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
+ { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
+ { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6
+build=$ac_cv_build
+build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+echo "$as_me:$LINENO: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6
+if test "${ac_cv_host+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_host_alias=$host_alias
+test -z "$ac_cv_host_alias" &&
+ ac_cv_host_alias=$ac_cv_build_alias
+ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
+ { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
+ { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6
+host=$ac_cv_host
+host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+
+# Check whether --with-gnu-ld or --without-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+ withval="$with_gnu_ld"
+ test "$withval" = no || with_gnu_ld=yes
+else
+ with_gnu_ld=no
+fi;
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ echo "$as_me:$LINENO: checking for ld used by GCC" >&5
+echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [\\/]* | [A-Za-z]:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+ # Canonicalize the path of ld
+ ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ echo "$as_me:$LINENO: checking for GNU ld" >&5
+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6
else
- rm -f conftestdata
-if ln -s X conftestdata 2>/dev/null
-then
- rm -f conftestdata
- ac_cv_prog_LN_S="ln -s"
+ echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6
+fi
+if test "${lt_cv_path_LD+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_cv_prog_LN_S=ln
+ if test -z "$LD"; then
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ lt_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some GNU ld's only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+ test "$with_gnu_ld" != no && break
+ else
+ test "$with_gnu_ld" != yes && break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ echo "$as_me:$LINENO: result: $LD" >&5
+echo "${ECHO_T}$LD" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-LN_S="$ac_cv_prog_LN_S"
-if test "$ac_cv_prog_LN_S" = "ln -s"; then
- echo "$ac_t""yes" 1>&6
+test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+ { (exit 1); exit 1; }; }
+echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6
+if test "${lt_cv_prog_gnu_ld+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+ lt_cv_prog_gnu_ld=yes
else
- echo "$ac_t""no" 1>&6
+ lt_cv_prog_gnu_ld=no
+fi
fi
+echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6
+with_gnu_ld=$lt_cv_prog_gnu_ld
-echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1181: checking how to run the C preprocessor" >&5
+echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
+echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6
+if test "${lt_cv_ld_reload_flag+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_cv_ld_reload_flag='-r'
+fi
+echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
+echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6
+reload_flag=$lt_cv_ld_reload_flag
+test -n "$reload_flag" && reload_flag=" $reload_flag"
+
+echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5
+echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6
+if test "${lt_cv_path_NM+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$NM"; then
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm=$ac_dir/${ac_tool_prefix}nm
+ if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ # Tru64's nm complains that /dev/null is an invalid object file
+ if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+ else
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi
+fi
+
+NM="$lt_cv_path_NM"
+echo "$as_me:$LINENO: result: $NM" >&5
+echo "${ECHO_T}$NM" >&6
+
+echo "$as_me:$LINENO: checking how to recognise dependant libraries" >&5
+echo $ECHO_N "checking how to recognise dependant libraries... $ECHO_C" >&6
+if test "${lt_cv_deplibs_check_method+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [regex]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given egrep regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+beos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+bsdi4*)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ ;;
+
+cygwin* | mingw* |pw32*)
+ lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ ;;
+
+darwin* | rhapsody*)
+ lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ case "$host_os" in
+ rhapsody* | darwin1.012)
+ lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System'
+ ;;
+ *) # Darwin 1.3 on
+ lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
+ ;;
+ esac
+ ;;
+
+freebsd* )
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ case $host_cpu in
+ i*86 )
+ # Not sure whether the presence of OpenBSD here was a mistake.
+ # Let's accept both of them until this is cleared up.
+ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+ ;;
+ esac
+ else
+ lt_cv_deplibs_check_method=pass_all
+ fi
+ ;;
+
+gnu*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+hpux10.20*|hpux11*)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libc.sl
+ ;;
+
+irix5* | irix6*)
+ case $host_os in
+ irix5*)
+ # this will be overridden with pass_all, but let us keep it just in case
+ lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
+ ;;
+ *)
+ case $LD in
+ *-32|*"-32 ") libmagic=32-bit;;
+ *-n32|*"-n32 ") libmagic=N32;;
+ *-64|*"-64 ") libmagic=64-bit;;
+ *) libmagic=never-match;;
+ esac
+ # this will be overridden with pass_all, but let us keep it just in case
+ lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"
+ ;;
+ esac
+ lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+ case $host_cpu in
+ alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* )
+ lt_cv_deplibs_check_method=pass_all ;;
+ *)
+ # glibc up to 2.1.1 does not perform some relocations on ARM
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;;
+ esac
+ lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+ ;;
+
+netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$'
+ fi
+ ;;
+
+newsos6)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libnls.so
+ ;;
+
+osf3* | osf4* | osf5*)
+ # this will be overridden with pass_all, but let us keep it just in case
+ lt_cv_deplibs_check_method='file_magic COFF format alpha shared library'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sco3.2v5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+solaris*)
+ lt_cv_deplibs_check_method=pass_all
+ lt_cv_file_magic_test_file=/lib/libc.so
+ ;;
+
+sysv5uw[78]* | sysv4*uw2*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ case $host_vendor in
+ ncr)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ motorola)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+ ;;
+ esac
+ ;;
+esac
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
+echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+
+
+
+
+
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
+echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case $MAGIC_CMD in
+ /*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+ ?:/*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
+ ;;
+ *)
+ ac_save_MAGIC_CMD="$MAGIC_CMD"
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="/usr/bin:$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/${ac_tool_prefix}file; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ egrep "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ MAGIC_CMD="$ac_save_MAGIC_CMD"
+ ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+ if test -n "$ac_tool_prefix"; then
+ echo "$as_me:$LINENO: checking for file" >&5
+echo $ECHO_N "checking for file... $ECHO_C" >&6
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case $MAGIC_CMD in
+ /*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+ ?:/*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
+ ;;
+ *)
+ ac_save_MAGIC_CMD="$MAGIC_CMD"
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="/usr/bin:$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/file; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/file"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ egrep "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ MAGIC_CMD="$ac_save_MAGIC_CMD"
+ ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ else
+ MAGIC_CMD=:
+ fi
+fi
+
+ fi
+ ;;
+esac
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_RANLIB+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+ echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+ ac_ct_RANLIB=$RANLIB
+ # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_RANLIB"; then
+ ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_RANLIB="ranlib"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+ echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ RANLIB=$ac_ct_RANLIB
+else
+ RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_STRIP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":"
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ STRIP=$ac_ct_STRIP
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+
+# Check for any special flags to pass to ltconfig.
+libtool_flags="--cache-file=$cache_file"
+test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
+test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
+test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
+test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc"
+test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
+
+
+# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+ enableval="$enable_libtool_lock"
+
+fi;
+test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
+test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
+
+
+# Check whether --with-pic or --without-pic was given.
+if test "${with_pic+set}" = set; then
+ withval="$with_pic"
+ pic_mode="$withval"
+else
+ pic_mode=default
+fi;
+test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic"
+test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '#line 3698 "configure"' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
+echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6
+if test "${lt_cv_cc_needs_belf+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ lt_cv_cc_needs_belf=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+lt_cv_cc_needs_belf=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
+echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+
+
+esac
+
+
+# Save cache, so that ltconfig can load it
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# 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 | 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 \).
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+} |
+ sed '
+ t clear
+ : clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ : end' >>confcache
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
+ if test -w $cache_file; then
+ test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+ cat confcache >$cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+# Actually configure libtool. ac_aux_dir is where install-sh is found.
+AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
+MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
+AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
+objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
+deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
+$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \
+|| { { echo "$as_me:$LINENO: error: libtool configure failed" >&5
+echo "$as_me: error: libtool configure failed" >&2;}
+ { (exit 1); exit 1; }; }
+
+# Reload cache, that may have been modified by ltconfig
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special
+ # files actually), so we avoid doing that.
+ if test -f "$cache_file"; then
+ { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . $cache_file;;
+ *) . ./$cache_file;;
+ esac
+ fi
+else
+ { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+# Redirect the config.log output again, so that the ltconfig log is not
+# clobbered by the next message.
+exec 5>>./config.log
+
+
+
+
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
# 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"
+ if test "${ac_cv_prog_CPP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp.
- cat > conftest.$ac_ext <<EOF
-#line 1196 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1202: \"$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
- :
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
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 <<EOF
-#line 1213 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1219: \"$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
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_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 <<EOF
-#line 1230 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1236: \"$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
- :
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP=/lib/cpp
+ ac_cpp_err=yes
fi
-rm -f conftest*
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ break
fi
-rm -f conftest*
- ac_cv_prog_CPP="$CPP"
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
fi
- CPP="$ac_cv_prog_CPP"
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ :
+else
+ { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_cv_prog_CPP="$CPP"
+ if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+ then ac_cv_prog_egrep='grep -E'
+ else ac_cv_prog_egrep='egrep'
+ fi
fi
-echo "$ac_t""$CPP" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
+
-echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1261: 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
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 1266 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <float.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1274: \"$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*
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
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
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdc=no
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
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
-#line 1291 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <string.h>
-EOF
+
+_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "memchr" >/dev/null 2>&1; then
+ $EGREP "memchr" >/dev/null 2>&1; then
:
else
- rm -rf conftest*
ac_cv_header_stdc=no
fi
rm -f conftest*
@@ -1304,16 +4212,20 @@ 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
-#line 1309 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <stdlib.h>
-EOF
+
+_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "free" >/dev/null 2>&1; then
+ $EGREP "free" >/dev/null 2>&1; then
:
else
- rm -rf conftest*
ac_cv_header_stdc=no
fi
rm -f conftest*
@@ -1322,817 +4234,2525 @@ 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
+ if test "$cross_compiling" = yes; then
:
else
- cat > conftest.$ac_ext <<EOF
-#line 1330 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <ctype.h>
-#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); }
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
-EOF
-if { (eval echo configure:1341: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
+#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);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
:
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_header_stdc=no
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
fi
-rm -fr conftest*
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
-
fi
fi
-
-echo "$ac_t""$ac_cv_header_stdc" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
if test $ac_cv_header_stdc = yes; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define STDC_HEADERS 1
-EOF
+_ACEOF
fi
-echo $ac_n "checking whether sys/types.h defines makedev""... $ac_c" 1>&6
-echo "configure:1365: 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
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+echo "$as_me:$LINENO: checking whether sys/types.h defines makedev" >&5
+echo $ECHO_N "checking whether sys/types.h defines makedev... $ECHO_C" >&6
+if test "${ac_cv_header_sys_types_h_makedev+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 1370 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/types.h>
-int main() {
+int
+main ()
+{
return makedev(0, 0);
-; return 0; }
-EOF
-if { (eval echo configure:1377: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
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*
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ac_cv_header_sys_types_h_makedev=no
fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-echo "$ac_t""$ac_cv_header_sys_types_h_makedev" 1>&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_sys_types_h_makedev" >&5
+echo "${ECHO_T}$ac_cv_header_sys_types_h_makedev" >&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:1395: 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
-#line 1400 "configure"
-#include "confdefs.h"
+if test "${ac_cv_header_sys_mkdev_h+set}" = set; then
+ echo "$as_me:$LINENO: checking for sys/mkdev.h" >&5
+echo $ECHO_N "checking for sys/mkdev.h... $ECHO_C" >&6
+if test "${ac_cv_header_sys_mkdev_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_sys_mkdev_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_mkdev_h" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking sys/mkdev.h usability" >&5
+echo $ECHO_N "checking sys/mkdev.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
#include <sys/mkdev.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1405: \"$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"
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking sys/mkdev.h presence" >&5
+echo $ECHO_N "checking sys/mkdev.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/mkdev.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
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"
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+ yes:no )
+ { echo "$as_me:$LINENO: WARNING: sys/mkdev.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: sys/mkdev.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/mkdev.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: sys/mkdev.h: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+ no:yes )
+ { echo "$as_me:$LINENO: WARNING: sys/mkdev.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: sys/mkdev.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/mkdev.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: sys/mkdev.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/mkdev.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: sys/mkdev.h: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for sys/mkdev.h" >&5
+echo $ECHO_N "checking for sys/mkdev.h... $ECHO_C" >&6
+if test "${ac_cv_header_sys_mkdev_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_sys_mkdev_h=$ac_header_preproc
fi
-rm -f conftest*
+echo "$as_me:$LINENO: result: $ac_cv_header_sys_mkdev_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_mkdev_h" >&6
+
fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- cat >> confdefs.h <<\EOF
+if test $ac_cv_header_sys_mkdev_h = yes; then
+
+cat >>confdefs.h <<\_ACEOF
#define MAJOR_IN_MKDEV 1
-EOF
+_ACEOF
-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:1433: 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
-#line 1438 "configure"
-#include "confdefs.h"
+ if test "${ac_cv_header_sys_sysmacros_h+set}" = set; then
+ echo "$as_me:$LINENO: checking for sys/sysmacros.h" >&5
+echo $ECHO_N "checking for sys/sysmacros.h... $ECHO_C" >&6
+if test "${ac_cv_header_sys_sysmacros_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_sys_sysmacros_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_sysmacros_h" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking sys/sysmacros.h usability" >&5
+echo $ECHO_N "checking sys/sysmacros.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
#include <sys/sysmacros.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1443: \"$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"
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking sys/sysmacros.h presence" >&5
+echo $ECHO_N "checking sys/sysmacros.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/sysmacros.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
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"
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+ yes:no )
+ { echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: sys/sysmacros.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: sys/sysmacros.h: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+ no:yes )
+ { echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: sys/sysmacros.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: sys/sysmacros.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: sys/sysmacros.h: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for sys/sysmacros.h" >&5
+echo $ECHO_N "checking for sys/sysmacros.h... $ECHO_C" >&6
+if test "${ac_cv_header_sys_sysmacros_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_sys_sysmacros_h=$ac_header_preproc
fi
-rm -f conftest*
+echo "$as_me:$LINENO: result: $ac_cv_header_sys_sysmacros_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_sysmacros_h" >&6
+
fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- cat >> confdefs.h <<\EOF
+if test $ac_cv_header_sys_sysmacros_h = yes; then
+
+cat >>confdefs.h <<\_ACEOF
#define MAJOR_IN_SYSMACROS 1
-EOF
+_ACEOF
-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:1471: 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
+echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6
+if test "${ac_cv_header_sys_wait_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 1476 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/types.h>
#include <sys/wait.h>
#ifndef WEXITSTATUS
-#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
+# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
#endif
#ifndef WIFEXITED
-#define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
+# 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:1492: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+
+int
+main ()
+{
+ int s;
+ wait (&s);
+ s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
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
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_sys_wait_h=no
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
fi
-
-echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6
if test $ac_cv_header_sys_wait_h = yes; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_SYS_WAIT_H 1
-EOF
+_ACEOF
fi
-for ac_hdr in stdint.h
+
+for ac_header in stdint.h
do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1516: 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
-#line 1521 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1526: \"$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"
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
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"
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+ yes:no )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+ no:yes )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=$ac_header_preproc"
fi
-rm -f conftest*
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
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 <<EOF
-#define $ac_tr_hdr 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
fi
+
done
-for ac_hdr in fcntl.h locale.h
+
+
+for ac_header in fcntl.h locale.h
do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1556: 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
-#line 1561 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1566: \"$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"
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
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"
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+ yes:no )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+ no:yes )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=$ac_header_preproc"
fi
-rm -f conftest*
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
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 <<EOF
-#define $ac_tr_hdr 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
fi
+
done
-for ac_hdr in sys/mman.h sys/stat.h sys/types.h
+
+
+
+for ac_header in sys/mman.h sys/stat.h sys/types.h
do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1596: 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
-#line 1601 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1606: \"$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"
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
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"
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+ yes:no )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+ no:yes )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=$ac_header_preproc"
fi
-rm -f conftest*
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
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 <<EOF
-#define $ac_tr_hdr 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
fi
+
done
-for ac_hdr in stdint.h inttypes.h
+
+
+for ac_header in stdint.h inttypes.h
do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1636: 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
-#line 1641 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1646: \"$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"
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
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"
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+ yes:no )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+ no:yes )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=$ac_header_preproc"
fi
-rm -f conftest*
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
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 <<EOF
-#define $ac_tr_hdr 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
fi
+
done
-for ac_hdr in unistd.h
+
+for ac_header 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:1676: 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
-#line 1681 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1686: \"$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"
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
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"
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+ yes:no )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+ no:yes )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=$ac_header_preproc"
fi
-rm -f conftest*
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
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 <<EOF
-#define $ac_tr_hdr 1
-EOF
-
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+for ac_header in getopt.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+ yes:no )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+ no:yes )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- echo "$ac_t""no" 1>&6
+ eval "$as_ac_Header=$ac_header_preproc"
fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
done
-for ac_hdr in getopt.h
+
+for ac_header in locale.h
do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1716: 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
-#line 1721 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1726: \"$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"
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
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"
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+ yes:no )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+ no:yes )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=$ac_header_preproc"
fi
-rm -f conftest*
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
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 <<EOF
-#define $ac_tr_hdr 1
-EOF
-
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+for ac_header in utime.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
else
- echo "$ac_t""no" 1>&6
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+ yes:no )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+ no:yes )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
fi
+
done
-for ac_hdr in locale.h
+
+for ac_header in sys/utime.h
do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1756: 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
-#line 1761 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1766: \"$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"
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
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"
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+ yes:no )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+ no:yes )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=$ac_header_preproc"
fi
-rm -f conftest*
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
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 <<EOF
-#define $ac_tr_hdr 1
-EOF
-
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+for ac_header in wchar.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
else
- echo "$ac_t""no" 1>&6
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+ yes:no )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+ no:yes )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=$ac_header_preproc"
fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
done
-echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:1794: checking for working const" >&5
-if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
+echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
+if test "${ac_cv_c_const+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 1799 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
-int main() {
+int
+main ()
+{
+/* FIXME: Include the comments suggested by Paul. */
+#ifndef __cplusplus
+ /* Ultrix mips cc rejects this. */
+ typedef int charset[2];
+ const charset x;
+ /* SunOS 4.1.1 cc rejects this. */
+ char const *const *ccp;
+ char **p;
+ /* NEC SVR4.0.2 mips cc rejects this. */
+ struct point {int x, y;};
+ static struct point const zero = {0,0};
+ /* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in
+ an arm of an if-expression whose if-part is not a constant
+ expression */
+ const char *g = "string";
+ ccp = &g + (g ? g-g : 0);
+ /* HPUX 7.0 cc rejects these. */
+ ++ccp;
+ p = (char**) ccp;
+ ccp = (char const *const *) p;
+ { /* SCO 3.2v4 cc rejects this. */
+ char *t;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+ }
+ { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+ }
+ { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+ }
+ { /* AIX XL C 1.02.0.0 rejects this saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; };
+ struct s *b; b->j = 5;
+ }
+ { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+ }
+#endif
-/* Ultrix mips cc rejects this. */
-typedef int charset[2]; const charset x;
-/* SunOS 4.1.1 cc rejects this. */
-char const *const *ccp;
-char **p;
-/* NEC SVR4.0.2 mips cc rejects this. */
-struct point {int x, y;};
-static struct point const zero = {0,0};
-/* AIX XL C 1.02.0.0 rejects this.
- It does not let you subtract one const X* pointer from another in an arm
- of an if-expression whose if-part is not a constant expression */
-const char *g = "string";
-ccp = &g + (g ? g-g : 0);
-/* HPUX 7.0 cc rejects these. */
-++ccp;
-p = (char**) ccp;
-ccp = (char const *const *) p;
-{ /* SCO 3.2v4 cc rejects this. */
- char *t;
- char const *s = 0 ? (char *) 0 : (char const *) 0;
-
- *t++ = 0;
-}
-{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
- int x[] = {25, 17};
- const int *foo = &x[0];
- ++foo;
-}
-{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
- typedef const int *iptr;
- iptr p = 0;
- ++p;
+ ;
+ return 0;
}
-{ /* AIX XL C 1.02.0.0 rejects this saying
- "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
- struct s { int j; const int *ap[3]; };
- struct s *b; b->j = 5;
-}
-{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
- const int foo = 10;
-}
-
-; return 0; }
-EOF
-if { (eval echo configure:1848: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_c_const=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_c_const=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_c_const=no
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
fi
-
-echo "$ac_t""$ac_cv_c_const" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
+echo "${ECHO_T}$ac_cv_c_const" >&6
if test $ac_cv_c_const = no; then
- cat >> confdefs.h <<\EOF
-#define const
-EOF
+
+cat >>confdefs.h <<\_ACEOF
+#define const
+_ACEOF
fi
-echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:1869: 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
+echo "$as_me:$LINENO: checking for off_t" >&5
+echo $ECHO_N "checking for off_t... $ECHO_C" >&6
+if test "${ac_cv_type_off_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 1874 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#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*
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((off_t *) 0)
+ return 0;
+if (sizeof (off_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_type_off_t=yes
else
- rm -rf conftest*
- ac_cv_type_off_t=no
-fi
-rm -f conftest*
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ac_cv_type_off_t=no
fi
-echo "$ac_t""$ac_cv_type_off_t" 1>&6
-if test $ac_cv_type_off_t = no; then
- cat >> confdefs.h <<\EOF
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5
+echo "${ECHO_T}$ac_cv_type_off_t" >&6
+if test $ac_cv_type_off_t = yes; then
+ :
+else
+
+cat >>confdefs.h <<_ACEOF
#define off_t long
-EOF
+_ACEOF
fi
-echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:1902: 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
+echo "$as_me:$LINENO: checking for size_t" >&5
+echo $ECHO_N "checking for size_t... $ECHO_C" >&6
+if test "${ac_cv_type_size_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 1907 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-EOF
-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*
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((size_t *) 0)
+ return 0;
+if (sizeof (size_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_type_size_t=yes
else
- rm -rf conftest*
- ac_cv_type_size_t=no
-fi
-rm -f conftest*
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ac_cv_type_size_t=no
fi
-echo "$ac_t""$ac_cv_type_size_t" 1>&6
-if test $ac_cv_type_size_t = no; then
- cat >> confdefs.h <<\EOF
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
+echo "${ECHO_T}$ac_cv_type_size_t" >&6
+if test $ac_cv_type_size_t = yes; then
+ :
+else
+
+cat >>confdefs.h <<_ACEOF
#define size_t unsigned
-EOF
+_ACEOF
fi
-echo $ac_n "checking for st_rdev in struct stat""... $ac_c" 1>&6
-echo "configure:1935: 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
+
+echo "$as_me:$LINENO: checking for struct stat.st_rdev" >&5
+echo $ECHO_N "checking for struct stat.st_rdev... $ECHO_C" >&6
+if test "${ac_cv_member_struct_stat_st_rdev+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 1940 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-int main() {
-struct stat s; s.st_rdev;
-; return 0; }
-EOF
-if { (eval echo configure:1948: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_struct_st_rdev=yes
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static struct stat ac_aggr;
+if (ac_aggr.st_rdev)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_member_struct_stat_st_rdev=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static struct stat ac_aggr;
+if (sizeof ac_aggr.st_rdev)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_member_struct_stat_st_rdev=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_struct_st_rdev=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_member_struct_stat_st_rdev=no
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_rdev" >&5
+echo "${ECHO_T}$ac_cv_member_struct_stat_st_rdev" >&6
+if test $ac_cv_member_struct_stat_st_rdev = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_RDEV 1
+_ACEOF
-echo "$ac_t""$ac_cv_struct_st_rdev" 1>&6
-if test $ac_cv_struct_st_rdev = yes; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_ST_RDEV 1
-EOF
+_ACEOF
fi
-echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
-echo "configure:1969: checking whether struct tm is in sys/time.h or time.h" >&5
-if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+
+echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5
+echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6
+if test "${ac_cv_struct_tm+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 1974 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/types.h>
#include <time.h>
-int main() {
+
+int
+main ()
+{
struct tm *tp; tp->tm_sec;
-; return 0; }
-EOF
-if { (eval echo configure:1982: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_struct_tm=time.h
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_struct_tm=sys/time.h
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_struct_tm=sys/time.h
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
fi
-
-echo "$ac_t""$ac_cv_struct_tm" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5
+echo "${ECHO_T}$ac_cv_struct_tm" >&6
if test $ac_cv_struct_tm = sys/time.h; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define TM_IN_SYS_TIME 1
-EOF
+_ACEOF
fi
-echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6
-echo "configure:2003: checking for tm_zone in struct tm" >&5
-if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for tm_zone in struct tm" >&5
+echo $ECHO_N "checking for tm_zone in struct tm... $ECHO_C" >&6
+if test "${ac_cv_struct_tm_zone+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 2008 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/types.h>
#include <$ac_cv_struct_tm>
-int main() {
+int
+main ()
+{
struct tm tm; tm.tm_zone;
-; return 0; }
-EOF
-if { (eval echo configure:2016: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_struct_tm_zone=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_struct_tm_zone=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_struct_tm_zone=no
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
fi
-
-echo "$ac_t""$ac_cv_struct_tm_zone" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_struct_tm_zone" >&5
+echo "${ECHO_T}$ac_cv_struct_tm_zone" >&6
if test "$ac_cv_struct_tm_zone" = yes; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_TM_ZONE 1
-EOF
+_ACEOF
fi
-echo $ac_n "checking for tzname""... $ac_c" 1>&6
-echo "configure:2036: checking for tzname" >&5
-if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for tzname" >&5
+echo $ECHO_N "checking for tzname... $ECHO_C" >&6
+if test "${ac_cv_var_tzname+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 2041 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <time.h>
#ifndef tzname /* For SGI. */
extern char *tzname[]; /* RS6000 and others reject char **tzname. */
#endif
-int main() {
+int
+main ()
+{
atoi(*tzname);
-; return 0; }
-EOF
-if { (eval echo configure:2051: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_var_tzname=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_var_tzname=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_var_tzname=no
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
fi
-
-echo "$ac_t""$ac_cv_var_tzname" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_var_tzname" >&5
+echo "${ECHO_T}$ac_cv_var_tzname" >&6
if test $ac_cv_var_tzname = yes; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_TZNAME 1
-EOF
+_ACEOF
fi
-echo $ac_n "checking for tm_isdst in struct tm""... $ac_c" 1>&6
-echo "configure:2072: checking for tm_isdst in struct tm" >&5
-if eval "test \"`echo '$''{'ac_cv_struct_tm_isdst'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2077 "configure"
-#include "confdefs.h"
+echo "$as_me:$LINENO: checking for tm_isdst in struct tm" >&5
+echo $ECHO_N "checking for tm_isdst in struct tm... $ECHO_C" >&6
+if test "${ac_cv_struct_tm_isdst+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/types.h>
#include <$ac_cv_struct_tm>
-int main() {
+int
+main ()
+{
struct tm tm; tm.tm_isdst;
-; return 0; }
-EOF
-if { (eval echo configure:2085: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_struct_tm_isdst=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_struct_tm_isdst=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_struct_tm_isdst=no
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
fi
-
-echo "$ac_t""$ac_cv_struct_tm_isdst" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_struct_tm_isdst" >&5
+echo "${ECHO_T}$ac_cv_struct_tm_isdst" >&6
if test "$ac_cv_struct_tm_isdst" = yes; then
- cat >> confdefs.h <<\EOF
+ cat >>confdefs.h <<\_ACEOF
#define HAVE_TM_ISDST 1
-EOF
+_ACEOF
fi
-echo $ac_n "checking for daylight""... $ac_c" 1>&6
-echo "configure:2105: checking for daylight" >&5
-if eval "test \"`echo '$''{'ac_cv_var_daylight'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for daylight" >&5
+echo $ECHO_N "checking for daylight... $ECHO_C" >&6
+if test "${ac_cv_var_daylight+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 2110 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <time.h>
#ifndef daylight /* In case IRIX #defines this, too */
extern int daylight;
#endif
-int main() {
+int
+main ()
+{
atoi(daylight);
-; return 0; }
-EOF
-if { (eval echo configure:2120: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_var_daylight=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_var_daylight=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_var_daylight=no
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
fi
-
-echo "$ac_t""$ac_cv_var_daylight" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_var_daylight" >&5
+echo "${ECHO_T}$ac_cv_var_daylight" >&6
if test $ac_cv_var_daylight = yes; then
- cat >> confdefs.h <<\EOF
+ cat >>confdefs.h <<\_ACEOF
#define HAVE_DAYLIGHT 1
-EOF
+_ACEOF
fi
@@ -2140,25 +6760,28 @@ EOF
# Check whether --enable-largefile or --disable-largefile was given.
if test "${enable_largefile+set}" = set; then
enableval="$enable_largefile"
- :
-fi
+fi;
if test "$enable_largefile" != no; then
- echo $ac_n "checking for special C compiler options needed for large files=
-""... $ac_c" 1>&6
-echo "configure:2151: checking for special C compiler options needed for large files=
+ echo "$as_me:$LINENO: checking for special C compiler options needed for large files=
" >&5
-if eval "test \"`echo '$''{'ac_cv_sys_largefile_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo $ECHO_N "checking for special C compiler options needed for large files=
+... $ECHO_C" >&6
+if test "${ac_cv_sys_largefile_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_cv_sys_largefile_CC=no
if test "$GCC" != yes; then
# IRIX 6.2 and later do not support large files by default,
# so use the C compiler's -n32 option if that helps.
- cat > conftest.$ac_ext <<EOF
-#line 2161 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/types.h>
/* Check that off_t can represent 2**63 - 1 correctly.
We can't simply "#define LARGE_OFF_T 9223372036854775807",
@@ -2168,22 +6791,41 @@ else
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
-
-int main() {
-; return 0; }
-EOF
-if { (eval echo configure:2177: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
:
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_save_CC="$CC"
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_save_CC="$CC"
CC="$CC -n32"
- cat > conftest.$ac_ext <<EOF
-#line 2186 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/types.h>
/* Check that off_t can represent 2**63 - 1 correctly.
We can't simply "#define LARGE_OFF_T 9223372036854775807",
@@ -2193,39 +6835,58 @@ else
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
-
-int main() {
-; return 0; }
-EOF
-if { (eval echo configure:2202: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_sys_largefile_CC=' -n32'
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
CC="$ac_save_CC"
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
fi
fi
-
-echo "$ac_t""$ac_cv_sys_largefile_CC" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_CC" >&5
+echo "${ECHO_T}$ac_cv_sys_largefile_CC" >&6
if test "$ac_cv_sys_largefile_CC" != no; then
CC="$CC$ac_cv_sys_largefile_CC"
fi
- echo $ac_n "checking for _FILE_OFFSET_BITS value needed for large files""... $ac_c" 1>&6
-echo "configure:2222: checking for _FILE_OFFSET_BITS value needed for large files" >&5
-if eval "test \"`echo '$''{'ac_cv_sys_file_offset_bits'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS value needed for large files" >&5
+echo $ECHO_N "checking for _FILE_OFFSET_BITS value needed for large files... $ECHO_C" >&6
+if test "${ac_cv_sys_file_offset_bits+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_cv_sys_file_offset_bits=no
- cat > conftest.$ac_ext <<EOF
-#line 2228 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/types.h>
/* Check that off_t can represent 2**63 - 1 correctly.
We can't simply "#define LARGE_OFF_T 9223372036854775807",
@@ -2235,20 +6896,39 @@ else
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
-
-int main() {
-; return 0; }
-EOF
-if { (eval echo configure:2244: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
:
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- cat > conftest.$ac_ext <<EOF
-#line 2251 "configure"
-#include "confdefs.h"
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#define _FILE_OFFSET_BITS 64
#include <sys/types.h>
/* Check that off_t can represent 2**63 - 1 correctly.
@@ -2259,40 +6939,60 @@ else
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
-
-
-int main() {
-; return 0; }
-EOF
-if { (eval echo configure:2269: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_sys_file_offset_bits=64
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
fi
-
-echo "$ac_t""$ac_cv_sys_file_offset_bits" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5
+echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6
if test "$ac_cv_sys_file_offset_bits" != no; then
- cat >> confdefs.h <<EOF
+
+cat >>confdefs.h <<_ACEOF
#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
-EOF
+_ACEOF
fi
- echo $ac_n "checking for _LARGE_FILES value needed for large files""... $ac_c" 1>&6
-echo "configure:2289: checking for _LARGE_FILES value needed for large files" >&5
-if eval "test \"`echo '$''{'ac_cv_sys_large_files'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5
+echo $ECHO_N "checking for _LARGE_FILES value needed for large files... $ECHO_C" >&6
+if test "${ac_cv_sys_large_files+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_cv_sys_large_files=no
- cat > conftest.$ac_ext <<EOF
-#line 2295 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/types.h>
/* Check that off_t can represent 2**63 - 1 correctly.
We can't simply "#define LARGE_OFF_T 9223372036854775807",
@@ -2302,20 +7002,39 @@ else
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
-
-int main() {
-; return 0; }
-EOF
-if { (eval echo configure:2311: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
:
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- cat > conftest.$ac_ext <<EOF
-#line 2318 "configure"
-#include "confdefs.h"
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#define _LARGE_FILES 1
#include <sys/types.h>
/* Check that off_t can represent 2**63 - 1 correctly.
@@ -2326,42 +7045,261 @@ else
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
-
-
-int main() {
-; return 0; }
-EOF
-if { (eval echo configure:2336: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_sys_large_files=1
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
fi
-
-echo "$ac_t""$ac_cv_sys_large_files" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5
+echo "${ECHO_T}$ac_cv_sys_large_files" >&6
if test "$ac_cv_sys_large_files" != no; then
- cat >> confdefs.h <<EOF
+
+cat >>confdefs.h <<_ACEOF
#define _LARGE_FILES $ac_cv_sys_large_files
-EOF
+_ACEOF
fi
fi
-
-echo $ac_n "checking for uint8_t""... $ac_c" 1>&6
-echo "configure:2359: 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
+
+
+for ac_header in stdlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+ yes:no )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+ no:yes )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 2364 "configure"
-#include "confdefs.h"
+ eval "$as_ac_Header=$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+ echo "$as_me:$LINENO: checking for mbstate_t" >&5
+echo $ECHO_N "checking for mbstate_t... $ECHO_C" >&6
+if test "${ac_cv_type_mbstate_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+#if HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+#include <wchar.h>
+int
+main ()
+{
+mbstate_t x; return sizeof x;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_mbstate_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_mbstate_t=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_mbstate_t" >&5
+echo "${ECHO_T}$ac_cv_type_mbstate_t" >&6
+ if test $ac_cv_type_mbstate_t = no; then
+
+cat >>confdefs.h <<\_ACEOF
+#define mbstate_t int
+_ACEOF
+
+ fi
+
+echo "$as_me:$LINENO: checking for uint8_t" >&5
+echo $ECHO_N "checking for uint8_t... $ECHO_C" >&6
+if test "${ac_cv_type_uint8_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#if HAVE_STDINT_H
#include <stdint.h>
#endif
@@ -2370,34 +7308,37 @@ else
#include <stdlib.h>
#include <stddef.h>
#endif
-EOF
+_ACEOF
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*
+ $EGREP "(^|[^a-zA-Z_0-9])uint8_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
ac_cv_type_uint8_t=yes
else
- rm -rf conftest*
ac_cv_type_uint8_t=no
fi
rm -f conftest*
fi
-echo "$ac_t""$ac_cv_type_uint8_t" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_type_uint8_t" >&5
+echo "${ECHO_T}$ac_cv_type_uint8_t" >&6
if test $ac_cv_type_uint8_t = no; then
- cat >> confdefs.h <<\EOF
+ cat >>confdefs.h <<\_ACEOF
#define uint8_t unsigned char
-EOF
+_ACEOF
fi
-echo $ac_n "checking for uint16_t""... $ac_c" 1>&6
-echo "configure:2395: 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
+echo "$as_me:$LINENO: checking for uint16_t" >&5
+echo $ECHO_N "checking for uint16_t... $ECHO_C" >&6
+if test "${ac_cv_type_uint16_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 2400 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#if HAVE_STDINT_H
#include <stdint.h>
#endif
@@ -2406,34 +7347,37 @@ else
#include <stdlib.h>
#include <stddef.h>
#endif
-EOF
+_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "(^|[^a-zA-Z_0-9])uint16_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
- rm -rf conftest*
+ $EGREP "(^|[^a-zA-Z_0-9])uint16_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
ac_cv_type_uint16_t=yes
else
- rm -rf conftest*
ac_cv_type_uint16_t=no
fi
rm -f conftest*
fi
-echo "$ac_t""$ac_cv_type_uint16_t" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_type_uint16_t" >&5
+echo "${ECHO_T}$ac_cv_type_uint16_t" >&6
if test $ac_cv_type_uint16_t = no; then
- cat >> confdefs.h <<\EOF
+ cat >>confdefs.h <<\_ACEOF
#define uint16_t unsigned short
-EOF
+_ACEOF
fi
-echo $ac_n "checking for uint32_t""... $ac_c" 1>&6
-echo "configure:2431: 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
+echo "$as_me:$LINENO: checking for uint32_t" >&5
+echo $ECHO_N "checking for uint32_t... $ECHO_C" >&6
+if test "${ac_cv_type_uint32_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 2436 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#if HAVE_STDINT_H
#include <stdint.h>
#endif
@@ -2442,34 +7386,37 @@ else
#include <stdlib.h>
#include <stddef.h>
#endif
-EOF
+_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "(^|[^a-zA-Z_0-9])uint32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
- rm -rf conftest*
+ $EGREP "(^|[^a-zA-Z_0-9])uint32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
ac_cv_type_uint32_t=yes
else
- rm -rf conftest*
ac_cv_type_uint32_t=no
fi
rm -f conftest*
fi
-echo "$ac_t""$ac_cv_type_uint32_t" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_type_uint32_t" >&5
+echo "${ECHO_T}$ac_cv_type_uint32_t" >&6
if test $ac_cv_type_uint32_t = no; then
- cat >> confdefs.h <<\EOF
+ cat >>confdefs.h <<\_ACEOF
#define uint32_t unsigned int
-EOF
+_ACEOF
fi
-echo $ac_n "checking for int32_t""... $ac_c" 1>&6
-echo "configure:2467: checking for int32_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_int32_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for int32_t" >&5
+echo $ECHO_N "checking for int32_t... $ECHO_C" >&6
+if test "${ac_cv_type_int32_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 2472 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#if HAVE_STDINT_H
#include <stdint.h>
#endif
@@ -2478,64 +7425,81 @@ else
#include <stdlib.h>
#include <stddef.h>
#endif
-EOF
+_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "(^|[^a-zA-Z_0-9])int32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
- rm -rf conftest*
+ $EGREP "(^|[^a-zA-Z_0-9])int32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
ac_cv_type_int32_t=yes
else
- rm -rf conftest*
ac_cv_type_int32_t=no
fi
rm -f conftest*
fi
-echo "$ac_t""$ac_cv_type_int32_t" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_type_int32_t" >&5
+echo "${ECHO_T}$ac_cv_type_int32_t" >&6
if test $ac_cv_type_int32_t = no; then
- cat >> confdefs.h <<\EOF
+ cat >>confdefs.h <<\_ACEOF
#define int32_t int
-EOF
+_ACEOF
fi
-echo $ac_n "checking for long long""... $ac_c" 1>&6
-echo "configure:2503: 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
+echo "$as_me:$LINENO: checking for long long" >&5
+echo $ECHO_N "checking for long long... $ECHO_C" >&6
+if test "${ac_cv_c_long_long+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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 <<EOF
-#line 2514 "configure"
-#include "confdefs.h"
+ { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
int main() {
long long foo = 0;
exit(sizeof(long long) < sizeof(long)); }
-EOF
-if { (eval echo configure:2520: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_c_long_long=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_c_long_long=no
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_c_long_long=no
fi
-rm -fr conftest*
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
-
fi
fi
-
-echo "$ac_t""$ac_cv_c_long_long" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_c_long_long" >&5
+echo "${ECHO_T}$ac_cv_c_long_long" >&6
if test $ac_cv_c_long_long = yes; then
- cat >> confdefs.h <<\EOF
+ cat >>confdefs.h <<\_ACEOF
#define HAVE_LONG_LONG 1
-EOF
+_ACEOF
fi
@@ -2544,14 +7508,18 @@ if test $ac_cv_c_long_long = yes; then
else
long64='unsigned long';
fi
-echo $ac_n "checking for uint64_t""... $ac_c" 1>&6
-echo "configure:2549: 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 <<EOF
-#line 2554 "configure"
-#include "confdefs.h"
+echo "$as_me:$LINENO: checking for uint64_t" >&5
+echo $ECHO_N "checking for uint64_t... $ECHO_C" >&6
+if test "${ac_cv_type_uint64_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#if HAVE_STDINT_H
#include <stdint.h>
#endif
@@ -2560,40 +7528,44 @@ else
#include <stdlib.h>
#include <stddef.h>
#endif
-EOF
+_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "(^|[^a-zA-Z_0-9])uint64_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
- rm -rf conftest*
+ $EGREP "(^|[^a-zA-Z_0-9])uint64_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
eval "ac_cv_type_uint64_t=yes"
else
- rm -rf conftest*
eval "ac_cv_type_uint64_t=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_type_'uint64_t`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
else
- echo "$ac_t""no" 1>&6
- cat >> confdefs.h <<EOF
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+ cat >>confdefs.h <<_ACEOF
#define uint64_t $long64
-EOF
+_ACEOF
fi
-echo $ac_n "checking size of uint8_t""... $ac_c" 1>&6
-echo "configure:2588: 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
+echo "$as_me:$LINENO: checking size of uint8_t" >&5
+echo $ECHO_N "checking size of uint8_t... $ECHO_C" >&6
+if test "${ac_cv_sizeof_uint8_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test "$cross_compiling" = yes; then
ac_cv_sizeof_uint8_t=0
else
- cat > conftest.$ac_ext <<EOF
-#line 2596 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#if HAVE_STDINT_H
#include <stdint.h>
#endif
@@ -2610,38 +7582,53 @@ main()
fprintf(f, "%d\n", sizeof(uint8_t));
exit(0);
}
-EOF
-if { (eval echo configure:2615: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_sizeof_uint8_t=`cat conftestval`
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_sizeof_uint8_t=0
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_sizeof_uint8_t=0
fi
-rm -fr conftest*
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
-
fi
-echo "$ac_t""$ac_cv_sizeof_uint8_t" 1>&6
-cat >> confdefs.h <<EOF
+echo "$as_me:$LINENO: result: $ac_cv_sizeof_uint8_t" >&5
+echo "${ECHO_T}$ac_cv_sizeof_uint8_t" >&6
+cat >>confdefs.h <<_ACEOF
#define SIZEOF_UINT8_T $ac_cv_sizeof_uint8_t
-EOF
+_ACEOF
-echo $ac_n "checking size of uint16_t""... $ac_c" 1>&6
-echo "configure:2636: 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
+echo "$as_me:$LINENO: checking size of uint16_t" >&5
+echo $ECHO_N "checking size of uint16_t... $ECHO_C" >&6
+if test "${ac_cv_sizeof_uint16_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test "$cross_compiling" = yes; then
ac_cv_sizeof_uint16_t=0
else
- cat > conftest.$ac_ext <<EOF
-#line 2644 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#if HAVE_STDINT_H
#include <stdint.h>
#endif
@@ -2658,38 +7645,53 @@ main()
fprintf(f, "%d\n", sizeof(uint16_t));
exit(0);
}
-EOF
-if { (eval echo configure:2663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_sizeof_uint16_t=`cat conftestval`
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_sizeof_uint16_t=0
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_sizeof_uint16_t=0
fi
-rm -fr conftest*
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
-
fi
-echo "$ac_t""$ac_cv_sizeof_uint16_t" 1>&6
-cat >> confdefs.h <<EOF
+echo "$as_me:$LINENO: result: $ac_cv_sizeof_uint16_t" >&5
+echo "${ECHO_T}$ac_cv_sizeof_uint16_t" >&6
+cat >>confdefs.h <<_ACEOF
#define SIZEOF_UINT16_T $ac_cv_sizeof_uint16_t
-EOF
+_ACEOF
-echo $ac_n "checking size of uint32_t""... $ac_c" 1>&6
-echo "configure:2684: 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
+echo "$as_me:$LINENO: checking size of uint32_t" >&5
+echo $ECHO_N "checking size of uint32_t... $ECHO_C" >&6
+if test "${ac_cv_sizeof_uint32_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test "$cross_compiling" = yes; then
ac_cv_sizeof_uint32_t=0
else
- cat > conftest.$ac_ext <<EOF
-#line 2692 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#if HAVE_STDINT_H
#include <stdint.h>
#endif
@@ -2706,38 +7708,53 @@ main()
fprintf(f, "%d\n", sizeof(uint32_t));
exit(0);
}
-EOF
-if { (eval echo configure:2711: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; 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
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_sizeof_uint32_t=0
fi
-rm -fr conftest*
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
-
fi
-echo "$ac_t""$ac_cv_sizeof_uint32_t" 1>&6
-cat >> confdefs.h <<EOF
+echo "$as_me:$LINENO: result: $ac_cv_sizeof_uint32_t" >&5
+echo "${ECHO_T}$ac_cv_sizeof_uint32_t" >&6
+cat >>confdefs.h <<_ACEOF
#define SIZEOF_UINT32_T $ac_cv_sizeof_uint32_t
-EOF
+_ACEOF
-echo $ac_n "checking size of uint64_t""... $ac_c" 1>&6
-echo "configure:2732: 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
+echo "$as_me:$LINENO: checking size of uint64_t" >&5
+echo $ECHO_N "checking size of uint64_t... $ECHO_C" >&6
+if test "${ac_cv_sizeof_uint64_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test "$cross_compiling" = yes; then
ac_cv_sizeof_uint64_t=0
else
- cat > conftest.$ac_ext <<EOF
-#line 2740 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#if HAVE_STDINT_H
#include <stdint.h>
#endif
@@ -2754,500 +7771,1534 @@ main()
fprintf(f, "%d\n", sizeof(uint64_t));
exit(0);
}
-EOF
-if { (eval echo configure:2759: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; 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
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_sizeof_uint64_t=0
fi
-rm -fr conftest*
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
-
fi
-echo "$ac_t""$ac_cv_sizeof_uint64_t" 1>&6
-cat >> confdefs.h <<EOF
+echo "$as_me:$LINENO: result: $ac_cv_sizeof_uint64_t" >&5
+echo "${ECHO_T}$ac_cv_sizeof_uint64_t" >&6
+cat >>confdefs.h <<_ACEOF
#define SIZEOF_UINT64_T $ac_cv_sizeof_uint64_t
-EOF
+_ACEOF
+
+
+
+
+
+
+
+
+
-for ac_func in mmap strerror strtoul mkstemp getopt_long
+for ac_func in mmap strerror strtoul mbrtowc mkstemp getopt_long utimes utime wcwidth
do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2783: 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 <<EOF
-#line 2788 "configure"
-#include "confdefs.h"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
/* 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();
-
-int main() {
-
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
/* 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
-$ac_func();
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
#endif
-; return 0; }
-EOF
-if { (eval echo configure:2811: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
-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 <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
fi
done
-echo $ac_n "checking for gzopen in -lz""... $ac_c" 1>&6
-echo "configure:2837: checking for gzopen in -lz" >&5
-ac_lib_var=`echo z'_'gzopen | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+
+echo "$as_me:$LINENO: checking for gzopen in -lz" >&5
+echo $ECHO_N "checking for gzopen in -lz... $ECHO_C" >&6
+if test "${ac_cv_lib_z_gzopen+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_LIBS="$LIBS"
+ ac_check_lib_save_LIBS=$LIBS
LIBS="-lz $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 2845 "configure"
-#include "confdefs.h"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char gzopen();
-
-int main() {
-gzopen()
-; return 0; }
-EOF
-if { (eval echo configure:2856: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_lib=HAVE_LIB`echo z | sed -e 's/[^a-zA-Z0-9_]/_/g' \
- -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_lib 1
-EOF
+ builtin and then its argument prototype would still apply. */
+char gzopen ();
+int
+main ()
+{
+gzopen ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_z_gzopen=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_z_gzopen=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_z_gzopen" >&5
+echo "${ECHO_T}$ac_cv_lib_z_gzopen" >&6
+if test $ac_cv_lib_z_gzopen = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBZ 1
+_ACEOF
LIBS="-lz $LIBS"
-else
- echo "$ac_t""no" 1>&6
fi
-trap '' 1 2 15
-cat > confcache <<\EOF
+ ac_config_files="$ac_config_files Makefile src/Makefile magic/Makefile doc/Makefile"
+cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
-# scripts and configure runs. It is not useful on other systems.
-# If it contains results you don't want to keep, you may remove or edit it.
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
#
-# By default, configure uses ./config.cache as the cache file,
-# creating it if it does not exist already. You can give configure
-# the --cache-file=FILE option to use a different cache file; that is
-# what configure does when it calls configure scripts in
-# subdirectories, so they share the cache.
-# Giving --cache-file=/dev/null disables caching, for debugging configure.
-# config.status only pays attention to the cache file if you give it the
-# --recheck option to rerun configure.
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
#
-EOF
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
# The following way of writing the cache mishandles newlines in values,
# but we know of no workaround that is simple, portable, and efficient.
# So, don't put newlines in cache variables' values.
# 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 | 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 \).
- sed -n \
- -e "s/'/'\\\\''/g" \
- -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
- ;;
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
- ;;
- esac >> confcache
-if cmp -s $cache_file confcache; then
- :
-else
+{
+ (set) 2>&1 |
+ 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 \).
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+} |
+ sed '
+ t clear
+ : clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ : end' >>confcache
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
if test -w $cache_file; then
- echo "updating cache $cache_file"
- cat confcache > $cache_file
+ test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+ cat confcache >$cache_file
else
echo "not updating unwritable cache $cache_file"
fi
fi
rm -f confcache
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-# Any assignment to VPATH causes Sun make to only execute
-# the first set of double-colon rules, so remove it if not needed.
-# If there is a colon in the path, we need to keep it.
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
+s/:*\$(srcdir):*/:/;
+s/:*\${srcdir}:*/:/;
+s/:*@srcdir@:*/:/;
+s/^\([^=]*=[ ]*\):*/\1/;
+s/:*$//;
+s/^[^=]*=[ ]*$//;
+}'
fi
-trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
-
DEFS=-DHAVE_CONFIG_H
-# Without the "./", some shells look in PATH for config.status.
-: ${CONFIG_STATUS=./config.status}
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_i=`echo "$ac_i" |
+ sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+ # 2. Add them.
+ ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
+ ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
-echo creating $CONFIG_STATUS
-rm -f $CONFIG_STATUS
-cat > $CONFIG_STATUS <<EOF
-#! /bin/sh
-# Generated automatically by configure.
+LTLIBOBJS=$ac_ltlibobjs
+
+
+if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${FSECT5_TRUE}" && test -z "${FSECT5_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"FSECT5\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"FSECT5\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
# Run this file to recreate the current configuration.
-# This directory was configured as follows,
-# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-#
-# $0 $ac_configure_args
-#
# Compiler output produced by configure, useful for debugging
-# configure, is in ./config.log if it exists.
+# configure, is in config.log if it exists.
-ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
-for ac_option
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
+fi
+
+# Support unset when possible.
+if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
do
- case "\$ac_option" in
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- 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.13"
- exit 0 ;;
- -help | --help | --hel | --he | --h)
- echo "\$ac_cs_usage"; exit 0 ;;
- *) echo "\$ac_cs_usage"; exit 1 ;;
- esac
+ if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ $as_unset $as_var
+ fi
done
-ac_given_srcdir=$srcdir
-ac_given_INSTALL="$INSTALL"
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
-trap 'rm -fr `echo "Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
-EOF
-cat >> $CONFIG_STATUS <<EOF
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
-# Protect against being on the right side of a sed subst in config.status.
-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
-s%@exec_prefix@%$exec_prefix%g
-s%@prefix@%$prefix%g
-s%@program_transform_name@%$program_transform_name%g
-s%@bindir@%$bindir%g
-s%@sbindir@%$sbindir%g
-s%@libexecdir@%$libexecdir%g
-s%@datadir@%$datadir%g
-s%@sysconfdir@%$sysconfdir%g
-s%@sharedstatedir@%$sharedstatedir%g
-s%@localstatedir@%$localstatedir%g
-s%@libdir@%$libdir%g
-s%@includedir@%$includedir%g
-s%@oldincludedir@%$oldincludedir%g
-s%@infodir@%$infodir%g
-s%@mandir@%$mandir%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%@fsect@%$fsect%g
-s%@FSECT5_TRUE@%$FSECT5_TRUE%g
-s%@FSECT5_FALSE@%$FSECT5_FALSE%g
-s%@CC@%$CC%g
-s%@LN_S@%$LN_S%g
-s%@CPP@%$CPP%g
-CEOF
-EOF
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)$' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
-cat >> $CONFIG_STATUS <<\EOF
-
-# Split the substitutions into bite-sized pieces for seds with
-# small command number limits, like on Digital OSF/1 and HP-UX.
-ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
-ac_file=1 # Number of current file.
-ac_beg=1 # First line for current file.
-ac_end=$ac_max_sed_cmds # Line after last line for current file.
-ac_more_lines=:
-ac_sed_cmds=""
-while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
else
- sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" || {
+ # Find who we are. Look in the path if we contain no path at all
+ # relative or not.
+ case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+ ;;
+ esac
+ # We did not find ourselves, most probably we were run as `sh COMMAND'
+ # in which case we are not to be found in the path.
+ if test "x$as_myself" = x; then
+ as_myself=$0
fi
- if test ! -s conftest.s$ac_file; then
- ac_more_lines=false
- rm -f conftest.s$ac_file
+ if test ! -f "$as_myself"; then
+ { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ case $CONFIG_SHELL in
+ '')
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for as_base in sh bash ksh sh5; do
+ case $as_dir in
+ /*)
+ if ("$as_dir/$as_base" -c '
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+ CONFIG_SHELL=$as_dir/$as_base
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+ fi;;
+ esac
+ done
+done
+;;
+ esac
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line before each line; the second 'sed' does the real
+ # work. The second script uses 'N' to pair each line-number line
+ # with the numbered line, and appends trailing '-' during
+ # substitution so that $LINENO is not a special case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
+ sed '=' <$as_myself |
+ sed '
+ N
+ s,$,-,
+ : loop
+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+ t loop
+ s,-$,,
+ s,^['$as_cr_digits']*\n,,
+ ' >$as_me.lineno &&
+ chmod +x $as_me.lineno ||
+ { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
+echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensible to this).
+ . ./$as_me.lineno
+ # Exit status is that of the last command.
+ exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T=' ' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
+ as_ln_s='cp -p'
else
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f conftest.s$ac_file"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
- fi
- ac_file=`expr $ac_file + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_cmds`
+ as_ln_s='ln -s'
fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+exec 6>&1
+
+# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling. Logging --version etc. is OK.
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+} >&5
+cat >&5 <<_CSEOF
+
+This file was extended by $as_me, which was
+generated by GNU Autoconf 2.57. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+_CSEOF
+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
+echo >&5
+_ACEOF
+
+# Files that config.status was made for.
+if test -n "$ac_config_files"; then
+ echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_headers"; then
+ echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+ echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+ echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number, then exit
+ -q, --quiet do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+ --header=FILE[:TEMPLATE]
+ instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to <bug-autoconf@gnu.org>."
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+config.status
+configured by $0, generated by GNU Autoconf 2.57,
+ with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+srcdir=$srcdir
+INSTALL="$INSTALL"
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value. By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=*)
+ ac_option=`expr "x$1" : 'x\([^=]*\)='`
+ ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ -*)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ *) # This is not an option, so the user has probably given explicit
+ # arguments.
+ ac_option=$1
+ ac_need_defaults=false;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --vers* | -V )
+ echo "$ac_cs_version"; exit 0 ;;
+ --he | --h)
+ # Conflict between --help and --header
+ { { echo "$as_me:$LINENO: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2;}
+ { (exit 1); exit 1; }; };;
+ --help | --hel | -h )
+ echo "$ac_cs_usage"; exit 0 ;;
+ --debug | --d* | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ $ac_shift
+ CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+ ac_need_defaults=false;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2;}
+ { (exit 1); exit 1; }; } ;;
+
+ *) ac_config_targets="$ac_config_targets $1" ;;
+
+ esac
+ shift
done
-if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+ echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+ exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
fi
-EOF
-cat >> $CONFIG_STATUS <<EOF
+_ACEOF
-CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case "$ac_file" in
- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
- *) ac_file_in="${ac_file}.in" ;;
+cat >>$CONFIG_STATUS <<_ACEOF
+#
+# INIT-COMMANDS section.
+#
+
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+_ACEOF
+
+
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_config_target in $ac_config_targets
+do
+ case "$ac_config_target" in
+ # Handling of arguments.
+ "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
+ "magic/Makefile" ) CONFIG_FILES="$CONFIG_FILES magic/Makefile" ;;
+ "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
+ "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+ "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+ *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+ { (exit 1); exit 1; }; };;
esac
+done
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+ test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason to put it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+ trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+ trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
- # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+# Create a (secure) tmp directory for tmp files.
- # Remove last slash and all that follows it. Not all systems have dirname.
- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- # The file is in a subdirectory.
- test ! -d "$ac_dir" && mkdir "$ac_dir"
- ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
- # A "../" for each directory in $ac_dir_suffix.
- ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
- else
- ac_dir_suffix= ac_dots=
+{
+ tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
+ test -n "$tmp" && test -d "$tmp"
+} ||
+{
+ tmp=./confstat$$-$RANDOM
+ (umask 077 && mkdir $tmp)
+} ||
+{
+ echo "$me: cannot create a temporary directory in ." >&2
+ { (exit 1); exit 1; }
+}
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+
+#
+# CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "\$CONFIG_FILES"; then
+ # Protect against being on the right side of a sed subst in config.status.
+ sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
+ s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
+s,@SHELL@,$SHELL,;t t
+s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s,@exec_prefix@,$exec_prefix,;t t
+s,@prefix@,$prefix,;t t
+s,@program_transform_name@,$program_transform_name,;t t
+s,@bindir@,$bindir,;t t
+s,@sbindir@,$sbindir,;t t
+s,@libexecdir@,$libexecdir,;t t
+s,@datadir@,$datadir,;t t
+s,@sysconfdir@,$sysconfdir,;t t
+s,@sharedstatedir@,$sharedstatedir,;t t
+s,@localstatedir@,$localstatedir,;t t
+s,@libdir@,$libdir,;t t
+s,@includedir@,$includedir,;t t
+s,@oldincludedir@,$oldincludedir,;t t
+s,@infodir@,$infodir,;t t
+s,@mandir@,$mandir,;t t
+s,@build_alias@,$build_alias,;t t
+s,@host_alias@,$host_alias,;t t
+s,@target_alias@,$target_alias,;t t
+s,@DEFS@,$DEFS,;t t
+s,@ECHO_C@,$ECHO_C,;t t
+s,@ECHO_N@,$ECHO_N,;t t
+s,@ECHO_T@,$ECHO_T,;t t
+s,@LIBS@,$LIBS,;t t
+s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
+s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
+s,@INSTALL_DATA@,$INSTALL_DATA,;t t
+s,@CYGPATH_W@,$CYGPATH_W,;t t
+s,@PACKAGE@,$PACKAGE,;t t
+s,@VERSION@,$VERSION,;t t
+s,@ACLOCAL@,$ACLOCAL,;t t
+s,@AUTOCONF@,$AUTOCONF,;t t
+s,@AUTOMAKE@,$AUTOMAKE,;t t
+s,@AUTOHEADER@,$AUTOHEADER,;t t
+s,@MAKEINFO@,$MAKEINFO,;t t
+s,@AMTAR@,$AMTAR,;t t
+s,@install_sh@,$install_sh,;t t
+s,@STRIP@,$STRIP,;t t
+s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t
+s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t
+s,@AWK@,$AWK,;t t
+s,@SET_MAKE@,$SET_MAKE,;t t
+s,@am__leading_dot@,$am__leading_dot,;t t
+s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t
+s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t
+s,@MAINT@,$MAINT,;t t
+s,@fsect@,$fsect,;t t
+s,@FSECT5_TRUE@,$FSECT5_TRUE,;t t
+s,@FSECT5_FALSE@,$FSECT5_FALSE,;t t
+s,@CC@,$CC,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@LDFLAGS@,$LDFLAGS,;t t
+s,@CPPFLAGS@,$CPPFLAGS,;t t
+s,@ac_ct_CC@,$ac_ct_CC,;t t
+s,@EXEEXT@,$EXEEXT,;t t
+s,@OBJEXT@,$OBJEXT,;t t
+s,@DEPDIR@,$DEPDIR,;t t
+s,@am__include@,$am__include,;t t
+s,@am__quote@,$am__quote,;t t
+s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t
+s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t
+s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t
+s,@CCDEPMODE@,$CCDEPMODE,;t t
+s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t
+s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t
+s,@LN_S@,$LN_S,;t t
+s,@build@,$build,;t t
+s,@build_cpu@,$build_cpu,;t t
+s,@build_vendor@,$build_vendor,;t t
+s,@build_os@,$build_os,;t t
+s,@host@,$host,;t t
+s,@host_cpu@,$host_cpu,;t t
+s,@host_vendor@,$host_vendor,;t t
+s,@host_os@,$host_os,;t t
+s,@RANLIB@,$RANLIB,;t t
+s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
+s,@LIBTOOL@,$LIBTOOL,;t t
+s,@CPP@,$CPP,;t t
+s,@EGREP@,$EGREP,;t t
+s,@LIBOBJS@,$LIBOBJS,;t t
+s,@LTLIBOBJS@,$LTLIBOBJS,;t t
+CEOF
+
+_ACEOF
+
+ cat >>$CONFIG_STATUS <<\_ACEOF
+ # Split the substitutions into bite-sized pieces for seds with
+ # small command number limits, like on Digital OSF/1 and HP-UX.
+ ac_max_sed_lines=48
+ ac_sed_frag=1 # Number of current file.
+ ac_beg=1 # First line for current file.
+ ac_end=$ac_max_sed_lines # Line after last line for current file.
+ ac_more_lines=:
+ ac_sed_cmds=
+ while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+ else
+ sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+ fi
+ if test ! -s $tmp/subs.frag; then
+ ac_more_lines=false
+ else
+ # The purpose of the label and of the branching condition is to
+ # speed up the sed processing (if there are no `@' at all, there
+ # is no need to browse any of the substitutions).
+ # These are the two extra sed commands mentioned above.
+ (echo ':t
+ /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+ fi
+ ac_sed_frag=`expr $ac_sed_frag + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_lines`
+ fi
+ done
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
fi
+fi # test -n "$CONFIG_FILES"
- case "$ac_given_srcdir" in
- .) srcdir=.
- if test -z "$ac_dots"; then top_srcdir=.
- else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
- /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
- *) # Relative path.
- srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
- top_srcdir="$ac_dots$ac_given_srcdir" ;;
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case $ac_file in
+ - | *:- | *:-:* ) # input from stdin
+ cat >$tmp/stdin
+ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ * ) ac_file_in=$ac_file.in ;;
esac
- case "$ac_given_INSTALL" in
- [/$]*) INSTALL="$ac_given_INSTALL" ;;
- *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+ # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
+ ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p "$ac_dir"
+ else
+ as_dir="$ac_dir"
+ as_dirs=
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ done
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+ { (exit 1); exit 1; }; }; }
+
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
+# absolute.
+ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
+ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
+ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
+ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
+
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
esac
- echo creating "$ac_file"
- rm -f "$ac_file"
- configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
- case "$ac_file" in
- *Makefile*) ac_comsub="1i\\
-# $configure_input" ;;
- *) ac_comsub= ;;
- esac
+ if test x"$ac_file" != x-; then
+ { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+ rm -f "$ac_file"
+ fi
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ if test x"$ac_file" = x-; then
+ configure_input=
+ else
+ configure_input="$ac_file. "
+ fi
+ configure_input=$configure_input"Generated from `echo $ac_file_in |
+ sed 's,.*/,,'` by configure."
+
+ # First look for the input files in the build tree, otherwise in the
+ # src tree.
+ ac_file_inputs=`IFS=:
+ for f in $ac_file_in; do
+ case $f in
+ -) echo $tmp/stdin ;;
+ [\\/$]*)
+ # Absolute (can't be DOS-style, as IFS=:)
+ test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ echo $f;;
+ *) # Relative
+ if test -f "$f"; then
+ # Build tree
+ echo $f
+ elif test -f "$srcdir/$f"; then
+ # Source tree
+ echo $srcdir/$f
+ else
+ # /dev/null tree
+ { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ fi;;
+ esac
+ done` || { (exit 1); exit 1; }
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s,@configure_input@,$configure_input,;t t
+s,@srcdir@,$ac_srcdir,;t t
+s,@abs_srcdir@,$ac_abs_srcdir,;t t
+s,@top_srcdir@,$ac_top_srcdir,;t t
+s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
+s,@builddir@,$ac_builddir,;t t
+s,@abs_builddir@,$ac_abs_builddir,;t t
+s,@top_builddir@,$ac_top_builddir,;t t
+s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
+s,@INSTALL@,$ac_INSTALL,;t t
+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
+ rm -f $tmp/stdin
+ if test x"$ac_file" != x-; then
+ mv $tmp/out $ac_file
+ else
+ cat $tmp/out
+ rm -f $tmp/out
+ fi
- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
- sed -e "$ac_comsub
-s%@configure_input@%$configure_input%g
-s%@srcdir@%$srcdir%g
-s%@top_srcdir@%$top_srcdir%g
-s%@INSTALL@%$INSTALL%g
-" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
-fi; done
-rm -f conftest.s*
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+#
+# CONFIG_HEADER section.
+#
# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
# NAME is the cpp macro being defined and VALUE is the value it is being given.
#
# ac_d sets the value in "#define NAME VALUE" lines.
-ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
-ac_dB='\([ ][ ]*\)[^ ]*%\1#\2'
-ac_dC='\3'
-ac_dD='%g'
-# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
-ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
-ac_uB='\([ ]\)%\1#\2define\3'
+ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)'
+ac_dB='[ ].*$,\1#\2'
+ac_dC=' '
+ac_dD=',;t'
+# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_uB='$,\1#\2define\3'
ac_uC=' '
-ac_uD='\4%g'
-# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
-ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
-ac_eB='$%\1#\2define\3'
-ac_eC=' '
-ac_eD='%g'
-
-if test "${CONFIG_HEADERS+set}" != set; then
-EOF
-cat >> $CONFIG_STATUS <<EOF
- CONFIG_HEADERS="config.h"
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-fi
-for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
+ac_uD=',;t'
+
+for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
# Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case "$ac_file" in
- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
- *) ac_file_in="${ac_file}.in" ;;
+ case $ac_file in
+ - | *:- | *:-:* ) # input from stdin
+ cat >$tmp/stdin
+ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ * ) ac_file_in=$ac_file.in ;;
esac
- echo creating $ac_file
-
- rm -f conftest.frag conftest.in conftest.out
- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
- cat $ac_file_inputs > conftest.in
-
-EOF
-
-# Transform confdefs.h into a sed script conftest.vals that substitutes
-# the proper values into config.h.in to produce config.h. And first:
-# Protect against being on the right side of a sed subst in config.status.
-# Protect against being in an unquoted here document in config.status.
-rm -f conftest.vals
-cat > conftest.hdr <<\EOF
-s/[\\&%]/\\&/g
-s%[\\$`]%\\&%g
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
-s%ac_d%ac_u%gp
-s%ac_u%ac_e%gp
-EOF
-sed -n -f conftest.hdr confdefs.h > conftest.vals
-rm -f conftest.hdr
+ test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+
+ # First look for the input files in the build tree, otherwise in the
+ # src tree.
+ ac_file_inputs=`IFS=:
+ for f in $ac_file_in; do
+ case $f in
+ -) echo $tmp/stdin ;;
+ [\\/$]*)
+ # Absolute (can't be DOS-style, as IFS=:)
+ test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ echo $f;;
+ *) # Relative
+ if test -f "$f"; then
+ # Build tree
+ echo $f
+ elif test -f "$srcdir/$f"; then
+ # Source tree
+ echo $srcdir/$f
+ else
+ # /dev/null tree
+ { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ fi;;
+ esac
+ done` || { (exit 1); exit 1; }
+ # Remove the trailing spaces.
+ sed 's/[ ]*$//' $ac_file_inputs >$tmp/in
+
+_ACEOF
+
+# Transform confdefs.h into two sed scripts, `conftest.defines' and
+# `conftest.undefs', that substitutes the proper values into
+# config.h.in to produce config.h. The first handles `#define'
+# templates, and the second `#undef' templates.
+# And first: Protect against being on the right side of a sed subst in
+# config.status. Protect against being in an unquoted here document
+# in config.status.
+rm -f conftest.defines conftest.undefs
+# Using a here document instead of a string reduces the quoting nightmare.
+# Putting comments in sed scripts is not portable.
+#
+# `end' is used to avoid that the second main sed command (meant for
+# 0-ary CPP macros) applies to n-ary macro definitions.
+# See the Autoconf documentation for `clear'.
+cat >confdef2sed.sed <<\_ACEOF
+s/[\\&,]/\\&/g
+s,[\\$`],\\&,g
+t clear
+: clear
+s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
+t end
+s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
+: end
+_ACEOF
+# If some macros were called several times there might be several times
+# the same #defines, which is useless. Nevertheless, we may not want to
+# sort them, since we want the *last* AC-DEFINE to be honored.
+uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
+sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
+rm -f confdef2sed.sed
# This sed command replaces #undef with comments. This is necessary, for
# example, in the case of _POSIX_SOURCE, which is predefined and required
# on some systems where configure will not decide to define it.
-cat >> conftest.vals <<\EOF
-s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
-EOF
-
-# Break up conftest.vals because some shells have a limit on
-# the size of here documents, and old seds have small limits too.
+cat >>conftest.undefs <<\_ACEOF
+s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
+_ACEOF
+
+# Break up conftest.defines because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
+echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
+echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
+echo ' :' >>$CONFIG_STATUS
+rm -f conftest.tail
+while grep . conftest.defines >/dev/null
+do
+ # Write a limited-size here document to $tmp/defines.sed.
+ echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
+ # Speed up: don't consider the non `#define' lines.
+ echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS
+ # Work around the forget-to-reset-the-flag bug.
+ echo 't clr' >>$CONFIG_STATUS
+ echo ': clr' >>$CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
+ echo 'CEOF
+ sed -f $tmp/defines.sed $tmp/in >$tmp/out
+ rm -f $tmp/in
+ mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
+ rm -f conftest.defines
+ mv conftest.tail conftest.defines
+done
+rm -f conftest.defines
+echo ' fi # grep' >>$CONFIG_STATUS
+echo >>$CONFIG_STATUS
+# Break up conftest.undefs because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo ' # Handle all the #undef templates' >>$CONFIG_STATUS
rm -f conftest.tail
-while :
+while grep . conftest.undefs >/dev/null
do
- ac_lines=`grep -c . conftest.vals`
- # grep -c gives empty output for an empty file on some AIX systems.
- if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
- # Write a limited-size here document to conftest.frag.
- echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
- sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
+ # Write a limited-size here document to $tmp/undefs.sed.
+ echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
+ # Speed up: don't consider the non `#undef'
+ echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS
+ # Work around the forget-to-reset-the-flag bug.
+ echo 't clr' >>$CONFIG_STATUS
+ echo ': clr' >>$CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
echo 'CEOF
- sed -f conftest.frag conftest.in > conftest.out
- rm -f conftest.in
- mv conftest.out conftest.in
-' >> $CONFIG_STATUS
- sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
- rm -f conftest.vals
- mv conftest.tail conftest.vals
-done
-rm -f conftest.vals
-
-cat >> $CONFIG_STATUS <<\EOF
- rm -f conftest.frag conftest.h
- echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
- cat conftest.in >> conftest.h
- rm -f conftest.in
- if cmp -s $ac_file conftest.h 2>/dev/null; then
- echo "$ac_file is unchanged"
- rm -f conftest.h
+ sed -f $tmp/undefs.sed $tmp/in >$tmp/out
+ rm -f $tmp/in
+ mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
+ rm -f conftest.undefs
+ mv conftest.tail conftest.undefs
+done
+rm -f conftest.undefs
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ if test x"$ac_file" = x-; then
+ echo "/* Generated by configure. */" >$tmp/config.h
else
- # Remove last slash and all that follows it. Not all systems have dirname.
- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- # The file is in a subdirectory.
- test ! -d "$ac_dir" && mkdir "$ac_dir"
+ echo "/* $ac_file. Generated by configure. */" >$tmp/config.h
+ fi
+ cat $tmp/in >>$tmp/config.h
+ rm -f $tmp/in
+ if test x"$ac_file" != x-; then
+ if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
+ { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+echo "$as_me: $ac_file is unchanged" >&6;}
+ else
+ ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p "$ac_dir"
+ else
+ as_dir="$ac_dir"
+ as_dirs=
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ done
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+ { (exit 1); exit 1; }; }; }
+
+ rm -f $ac_file
+ mv $tmp/config.h $ac_file
fi
- rm -f $ac_file
- mv conftest.h $ac_file
+ else
+ cat $tmp/config.h
+ rm -f $tmp/config.h
fi
-fi; done
-
-EOF
-cat >> $CONFIG_STATUS <<EOF
+# Compute $ac_file's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $ac_file | $ac_file:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null ||
+$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X$ac_file : 'X\(//\)[^/]' \| \
+ X$ac_file : 'X\(//\)$' \| \
+ X$ac_file : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X$ac_file |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`/stamp-h$_am_stamp_count
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+#
+# CONFIG_COMMANDS section.
+#
+for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
+ ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
+ ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
+$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_dest" : 'X\(//\)[^/]' \| \
+ X"$ac_dest" : 'X\(//\)$' \| \
+ X"$ac_dest" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$ac_dest" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
+# absolute.
+ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
+ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
+ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
+ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
+
+
+ { echo "$as_me:$LINENO: executing $ac_dest commands" >&5
+echo "$as_me: executing $ac_dest commands" >&6;}
+ case $ac_dest in
+ depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named `Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # So let's grep whole file.
+ if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+ dirpart=`(dirname "$mf") 2>/dev/null ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$mf" : 'X\(//\)[^/]' \| \
+ X"$mf" : 'X\(//\)$' \| \
+ X"$mf" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$mf" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ else
+ continue
+ fi
+ grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue
+ # Extract the definition of DEP_FILES from the Makefile without
+ # running `make'.
+ DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n -e '/^U = / s///p' < "$mf"`
+ test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
+ # We invoke sed twice because it is the simplest approach to
+ # changing $(DEPDIR) to its actual value in the expansion.
+ for file in `sed -n -e '
+ /^DEP_FILES = .*\\\\$/ {
+ s/^DEP_FILES = //
+ :loop
+ s/\\\\$//
+ p
+ n
+ /\\\\$/ b loop
+ p
+ }
+ /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`(dirname "$file") 2>/dev/null ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$file" : 'X\(//\)[^/]' \| \
+ X"$file" : 'X\(//\)$' \| \
+ X"$file" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p $dirpart/$fdir
+ else
+ as_dir=$dirpart/$fdir
+ as_dirs=
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ done
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5
+echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;}
+ { (exit 1); exit 1; }; }; }
+
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+done
+ ;;
+ esac
+done
+_ACEOF
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
+cat >>$CONFIG_STATUS <<\_ACEOF
-exit 0
-EOF
+{ (exit 0); exit 0; }
+_ACEOF
chmod +x $CONFIG_STATUS
-rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || { (exit 1); exit 1; }
+fi
diff --git a/contrib/file/configure.in b/contrib/file/configure.in
index 8536b0d..a3b9c5d 100644
--- a/contrib/file/configure.in
+++ b/contrib/file/configure.in
@@ -1,7 +1,8 @@
dnl Process this file with autoconf to produce a configure script.
-AC_INIT(file.c)
-AM_INIT_AUTOMAKE(file, 3.41)
+AC_INIT(src/file.c)
+AM_INIT_AUTOMAKE(file, 4.10)
AM_CONFIG_HEADER(config.h)
+AM_MAINTAINER_MODE
AC_MSG_CHECKING(for builtin ELF support)
AC_ARG_ENABLE(elf,
@@ -52,6 +53,7 @@ dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
+AC_PROG_LIBTOOL
dnl Checks for headers
AC_HEADER_STDC
@@ -64,6 +66,9 @@ AC_CHECK_HEADERS(stdint.h inttypes.h)
AC_CHECK_HEADERS(unistd.h)
AC_CHECK_HEADERS(getopt.h)
AC_CHECK_HEADERS(locale.h)
+AC_CHECK_HEADERS(utime.h)
+AC_CHECK_HEADERS(sys/utime.h)
+AC_CHECK_HEADERS(wchar.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
@@ -72,6 +77,7 @@ AC_TYPE_SIZE_T
AC_STRUCT_ST_RDEV
AC_STRUCT_TIMEZONE_DAYLIGHT
AC_SYS_LARGEFILE
+AC_MBSTATE_T
AC_CHECK_TYPE_STDC(uint8_t, unsigned char)
AC_CHECK_TYPE_STDC(uint16_t, unsigned short)
@@ -92,9 +98,9 @@ AC_CHECK_SIZEOF_STDC_HEADERS(uint32_t, 0)
AC_CHECK_SIZEOF_STDC_HEADERS(uint64_t, 0)
dnl Checks for functions
-AC_CHECK_FUNCS(mmap strerror strtoul mkstemp getopt_long)
+AC_CHECK_FUNCS(mmap strerror strtoul mbrtowc mkstemp getopt_long utimes utime wcwidth)
dnl Checks for libraries
AC_CHECK_LIB(z,gzopen)
-AC_OUTPUT(Makefile)
+AC_OUTPUT(Makefile src/Makefile magic/Makefile doc/Makefile)
diff --git a/contrib/file/file.c b/contrib/file/file.c
index 2ccd8ca..269ae86 100644
--- a/contrib/file/file.c
+++ b/contrib/file/file.c
@@ -1,35 +1,49 @@
/*
+ * Copyright (c) Ian F. Darwin 1986-1995.
+ * Software written by Ian F. Darwin and others;
+ * maintained 1995-present by Christos Zoulas and others.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice immediately at the beginning of the file, without modification,
+ * this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Ian F. Darwin and others.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+/*
* file - find type of a file or files - main program.
- *
- * Copyright (c) Ian F. Darwin, 1987.
- * Written by Ian F. Darwin.
- *
- * 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.
*/
#include "file.h"
+#include "magic.h"
+
+#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
+#include <sys/types.h>
#include <sys/param.h> /* for MAXPATHLEN */
+#include <sys/stat.h>
#include <fcntl.h> /* for open() */
#ifdef RESTORE_TIME
# if (__COHERENT__ >= 0x420)
@@ -48,9 +62,14 @@
#ifdef HAVE_LOCALE_H
#include <locale.h>
#endif
+#ifdef HAVE_WCHAR_H
+#include <wchar.h>
+#endif
#ifdef HAVE_GETOPT_H
#include <getopt.h> /* for long options (is this portable?)*/
+#else
+#undef HAVE_GETOPT_LONG
#endif
#include <netinet/in.h> /* for byte swapping */
@@ -58,80 +77,65 @@
#include "patchlevel.h"
#ifndef lint
-FILE_RCSID("@(#)$Id: file.c,v 1.69 2003/02/27 20:47:46 christos Exp $")
+FILE_RCSID("@(#)$Id: file.c,v 1.93 2004/04/07 14:23:55 christos Exp $")
#endif /* lint */
#ifdef S_IFLNK
-# define USAGE "Usage: %s [-bciknsvzL] [-f namefile] [-m magicfiles] file...\n"
+#define SYMLINKFLAG "L"
#else
-# define USAGE "Usage: %s [-bciknsvz] [-f namefile] [-m magicfiles] file...\n"
+#define SYMLINKFLAG ""
#endif
-#ifdef __EMX__
-static char *apptypeName = NULL;
-int os2_apptype (const char *fn, char *buf, int nb);
-#endif /* __EMX__ */
-
-#ifndef MAGIC
-# define MAGIC "/etc/magic"
-#endif
+# define USAGE "Usage: %s [-bcik" SYMLINKFLAG "nNsvz] [-f namefile] [-F separator] [-m magicfiles] file...\n %s -C -m magicfiles\n"
#ifndef MAXPATHLEN
#define MAXPATHLEN 512
#endif
-int /* Global command-line options */
- debug = 0, /* debugging */
- lflag = 0, /* follow Symlinks (BSD only) */
+private int /* Global command-line options */
bflag = 0, /* brief output format */
- zflag = 0, /* follow (uncompress) compressed files */
- sflag = 0, /* read block special files */
- iflag = 0,
nopad = 0, /* Don't pad output */
- nobuffer = 0, /* Do not buffer stdout */
- kflag = 0; /* Keep going after the first match */
-
-int /* Misc globals */
- nmagic = 0; /* number of valid magic[]s */
+ nobuffer = 0; /* Do not buffer stdout */
-struct magic *magic; /* array of magic entries */
+private const char *magicfile = 0; /* where the magic is */
+private const char *default_magicfile = MAGIC;
+private char *separator = ":"; /* Default field separator */
-const char *magicfile = 0; /* where the magic is */
-const char *default_magicfile = MAGIC;
+private char *progname; /* used throughout */
-char separator = ':'; /* Default field separator */
+private struct magic_set *magic;
-char *progname; /* used throughout */
-int lineno; /* line number in the magic file */
-
-
-static void unwrap(char *fn);
-static void usage(void);
+private void unwrap(char *);
+private void usage(void);
#ifdef HAVE_GETOPT_LONG
-static void help(void);
+private void help(void);
#endif
#if 0
-static int byteconv4(int, int, int);
-static short byteconv2(int, int, int);
+private int byteconv4(int, int, int);
+private short byteconv2(int, int, int);
#endif
int main(int, char *[]);
+private void process(const char *, int);
+private void load(const char *, int);
+
/*
* main - parse arguments and handle options
*/
int
-main(int argc, char **argv)
+main(int argc, char *argv[])
{
int c;
- int action = 0, didsomefiles = 0, errflg = 0, ret = 0, app = 0;
- char *mime, *home, *usermagic;
+ int action = 0, didsomefiles = 0, errflg = 0;
+ int flags = 0;
+ char *home, *usermagic;
struct stat sb;
-#define OPTSTRING "bcdf:F:ikm:nNsvzCL"
+#define OPTSTRING "bcCdf:F:ikLm:nNprsvz"
#ifdef HAVE_GETOPT_LONG
int longindex;
- static struct option long_options[] =
+ private struct option long_options[] =
{
{"version", 0, 0, 'v'},
{"help", 0, 0, 0},
@@ -146,7 +150,11 @@ main(int argc, char **argv)
{"dereference", 0, 0, 'L'},
#endif
{"magic-file", 1, 0, 'm'},
+#if defined(HAVE_UTIME) || defined(HAVE_UTIMES)
+ {"preserve-date", 0, 0, 'p'},
+#endif
{"uncompress", 0, 0, 'z'},
+ {"raw", 0, 0, 'r'},
{"no-buffer", 0, 0, 'n'},
{"no-pad", 0, 0, 'N'},
{"special-files", 0, 0, 's'},
@@ -201,37 +209,29 @@ main(int argc, char **argv)
++bflag;
break;
case 'c':
- action = CHECK;
+ action = FILE_CHECK;
break;
case 'C':
- action = COMPILE;
+ action = FILE_COMPILE;
break;
case 'd':
- ++debug;
+ flags |= MAGIC_DEBUG|MAGIC_CHECK;
break;
case 'f':
- if (!app) {
- ret = apprentice(magicfile, action);
- if (action)
- exit(ret);
- app = 1;
- }
+ if(action)
+ usage();
+ load(magicfile, flags);
unwrap(optarg);
++didsomefiles;
break;
case 'F':
- separator = *optarg;
+ separator = optarg;
break;
case 'i':
- iflag++;
- if ((mime = malloc(strlen(magicfile) + 6)) != NULL) {
- (void)strcpy(mime, magicfile);
- (void)strcat(mime, ".mime");
- magicfile = mime;
- }
+ flags |= MAGIC_MIME;
break;
case 'k':
- kflag = 1;
+ flags |= MAGIC_CONTINUE;
break;
case 'm':
magicfile = optarg;
@@ -242,21 +242,29 @@ main(int argc, char **argv)
case 'N':
++nopad;
break;
+#if defined(HAVE_UTIME) || defined(HAVE_UTIMES)
+ case 'p':
+ flags |= MAGIC_PRESERVE_ATIME;
+ break;
+#endif
+ case 'r':
+ flags |= MAGIC_RAW;
+ break;
case 's':
- sflag++;
+ flags |= MAGIC_DEVICES;
break;
case 'v':
- (void) fprintf(stdout, "%s-%d.%d\n", progname,
+ (void) fprintf(stdout, "%s-%d.%.2d\n", progname,
FILE_VERSION_MAJOR, patchlevel);
(void) fprintf(stdout, "magic file from %s\n",
magicfile);
return 1;
case 'z':
- zflag++;
+ flags |= MAGIC_COMPRESS;
break;
#ifdef S_IFLNK
case 'L':
- ++lflag;
+ flags |= MAGIC_SYMLINK;
break;
#endif
case '?':
@@ -269,11 +277,26 @@ main(int argc, char **argv)
usage();
}
- if (!app) {
- ret = apprentice(magicfile, action);
- if (action)
- exit(ret);
- app = 1;
+ switch(action) {
+ case FILE_CHECK:
+ case FILE_COMPILE:
+ magic = magic_open(flags|MAGIC_CHECK);
+ if (magic == NULL) {
+ (void)fprintf(stderr, "%s: %s\n", progname,
+ strerror(errno));
+ return 1;
+ }
+ c = action == FILE_CHECK ? magic_check(magic, magicfile) :
+ magic_compile(magic, magicfile);
+ if (c == -1) {
+ (void)fprintf(stderr, "%s: %s\n", progname,
+ magic_error(magic));
+ return -1;
+ }
+ return 0;
+ default:
+ load(magicfile, flags);
+ break;
}
if (optind == argc) {
@@ -284,7 +307,7 @@ main(int argc, char **argv)
else {
int i, wid, nw;
for (wid = 0, i = optind; i < argc; i++) {
- nw = strlen(argv[i]);
+ nw = file_mbswidth(argv[i]);
if (nw > wid)
wid = nw;
}
@@ -296,10 +319,27 @@ main(int argc, char **argv)
}
+private void
+load(const char *m, int flags)
+{
+ if (magic)
+ return;
+ magic = magic_open(flags);
+ if (magic == NULL) {
+ (void)fprintf(stderr, "%s: %s\n", progname, strerror(errno));
+ exit(1);
+ }
+ if (magic_load(magic, magicfile) == -1) {
+ (void)fprintf(stderr, "%s: %s\n",
+ progname, magic_error(magic));
+ exit(1);
+ }
+}
+
/*
* unwrap -- read a file of filenames, do each one.
*/
-static void
+private void
unwrap(char *fn)
{
char buf[MAXPATHLEN];
@@ -311,12 +351,13 @@ unwrap(char *fn)
wid = 1;
} else {
if ((f = fopen(fn, "r")) == NULL) {
- error("Cannot open `%s' (%s).\n", fn, strerror(errno));
- /*NOTREACHED*/
+ (void)fprintf(stderr, "%s: Cannot open `%s' (%s).\n",
+ progname, fn, strerror(errno));
+ exit(1);
}
while (fgets(buf, MAXPATHLEN, f) != NULL) {
- cwid = strlen(buf) - 1;
+ cwid = file_mbswidth(buf) - 1;
if (cwid > wid)
wid = cwid;
}
@@ -325,7 +366,7 @@ unwrap(char *fn)
}
while (fgets(buf, MAXPATHLEN, f) != NULL) {
- buf[strlen(buf)-1] = '\0';
+ buf[file_mbswidth(buf)-1] = '\0';
process(buf, wid);
if(nobuffer)
(void) fflush(stdout);
@@ -334,6 +375,23 @@ unwrap(char *fn)
(void) fclose(f);
}
+private void
+process(const char *inname, int wid)
+{
+ const char *type;
+ int std_in = strcmp(inname, "-") == 0;
+
+ if (wid > 0 && !bflag)
+ (void) printf("%s%s%*s ", std_in ? "/dev/stdin" : inname,
+ separator, (int) (nopad ? 0 : (wid - file_mbswidth(inname))), "");
+
+ type = magic_file(magic, std_in ? NULL : inname);
+ if (type == NULL)
+ printf("ERROR: %s\n", magic_error(magic));
+ else
+ printf("%s\n", type);
+}
+
#if 0
/*
@@ -343,7 +401,7 @@ unwrap(char *fn)
* same whether to perform byte swapping
* big_endian whether we are a big endian host
*/
-static int
+private int
byteconv4(int from, int same, int big_endian)
{
if (same)
@@ -370,7 +428,7 @@ byteconv4(int from, int same, int big_endian)
* byteconv2
* Same as byteconv4, but for shorts
*/
-static short
+private short
byteconv2(int from, int same, int big_endian)
{
if (same)
@@ -392,148 +450,44 @@ byteconv2(int from, int same, int big_endian)
}
#endif
-/*
- * process - process input file
- */
-void
-process(const char *inname, int wid)
+size_t
+file_mbswidth(const char *s)
{
- int fd = 0;
- static const char stdname[] = "standard input";
- unsigned char buf[HOWMANY+1]; /* one extra for terminating '\0' */
- struct stat sb;
- int nbytes = 0; /* number of bytes read from a datafile */
- char match = '\0';
-
- if (strcmp("-", inname) == 0) {
- if (fstat(0, &sb)<0) {
- error("cannot fstat `%s' (%s).\n", stdname,
- strerror(errno));
- /*NOTREACHED*/
- }
- inname = stdname;
- }
-
- if (wid > 0 && !bflag)
- (void) printf("%s%c%*s", inname, separator,
- (int) (nopad ? 0 : 1 + (wid - strlen(inname))), "");
-
- if (inname != stdname) {
- /*
- * first try judging the file based on its filesystem status
- */
- if (fsmagic(inname, &sb) != 0) {
- putchar('\n');
- return;
+#if defined(HAVE_WCHAR_H) && defined(HAVE_MBRTOWC) && defined(HAVE_WCWIDTH)
+ size_t bytesconsumed, old_n, n, width = 0;
+ mbstate_t state;
+ wchar_t nextchar;
+ (void)memset(&state, 0, sizeof(mbstate_t));
+ old_n = n = strlen(s);
+
+ while (n > 0) {
+ bytesconsumed = mbrtowc(&nextchar, s, n, &state);
+ if (bytesconsumed == (size_t)(-1) ||
+ bytesconsumed == (size_t)(-2)) {
+ /* Something went wrong, return something reasonable */
+ return old_n;
}
-
- if ((fd = open(inname, O_RDONLY)) < 0) {
- /* We can't open it, but we were able to stat it. */
- if (sb.st_mode & 0002) ckfputs("writable, ", stdout);
- if (sb.st_mode & 0111) ckfputs("executable, ", stdout);
- ckfprintf(stdout, "can't read `%s' (%s).\n",
- inname, strerror(errno));
- return;
- }
- }
-
-
- /*
- * try looking at the first HOWMANY bytes
- */
- if ((nbytes = read(fd, (char *)buf, HOWMANY)) == -1) {
- error("read failed (%s).\n", strerror(errno));
- /*NOTREACHED*/
+ if (s[0] == '\n') {
+ /*
+ * do what strlen() would do, so that caller
+ * is always right
+ */
+ width++;
+ } else
+ width += wcwidth(nextchar);
+
+ s += bytesconsumed, n -= bytesconsumed;
}
-
- if (nbytes == 0)
- ckfputs(iflag ? "application/x-empty" : "empty", stdout);
- else {
- buf[nbytes++] = '\0'; /* null-terminate it */
- match = tryit(inname, buf, nbytes, zflag);
- }
-
-#ifdef BUILTIN_ELF
- if (match == 's' && nbytes > 5) {
- /*
- * We matched something in the file, so this *might*
- * be an ELF file, and the file is at least 5 bytes long,
- * so if it's an ELF file it has at least one byte
- * past the ELF magic number - try extracting information
- * from the ELF headers that can't easily be extracted
- * with rules in the magic file.
- */
- tryelf(fd, buf, nbytes);
- }
-#endif
-
- if (inname != stdname) {
-#ifdef RESTORE_TIME
- /*
- * Try to restore access, modification times if read it.
- * This is really *bad* because it will modify the status
- * time of the file... And of course this will affect
- * backup programs
- */
-# ifdef USE_UTIMES
- struct timeval utsbuf[2];
- utsbuf[0].tv_sec = sb.st_atime;
- utsbuf[1].tv_sec = sb.st_mtime;
-
- (void) utimes(inname, utsbuf); /* don't care if loses */
-# else
- struct utimbuf utbuf;
-
- utbuf.actime = sb.st_atime;
- utbuf.modtime = sb.st_mtime;
- (void) utime(inname, &utbuf); /* don't care if loses */
-# endif
-#endif
- (void) close(fd);
- }
- (void) putchar('\n');
-}
-
-
-int
-tryit(const char *fn, unsigned char *buf, int nb, int zfl)
-{
-
- /*
- * The main work is done here!
- * We have the file name and/or the data buffer to be identified.
- */
-
-#ifdef __EMX__
- /*
- * Ok, here's the right place to add a call to some os-specific
- * routine, e.g.
- */
- if (os2_apptype(fn, buf, nb) == 1)
- return 'o';
+ return width;
+#else
+ return strlen(s);
#endif
- /* try compression stuff */
- if (zfl && zmagic(fn, buf, nb))
- return 'z';
-
- /* try tests in /etc/magic (or surrogate magic file) */
- if (softmagic(buf, nb))
- return 's';
-
- /* try known keywords, check whether it is ASCII */
- if (ascmagic(buf, nb))
- return 'a';
-
- /* abandon hope, all ye who remain here */
- ckfputs(iflag ? "application/octet-stream" : "data", stdout);
- return '\0';
}
-static void
+private void
usage(void)
{
- (void)fprintf(stderr, USAGE, progname);
- (void)fprintf(stderr, "Usage: %s -C [-m magic]\n", progname);
+ (void)fprintf(stderr, USAGE, progname, progname);
#ifdef HAVE_GETOPT_LONG
(void)fputs("Try `file --help' for more information.\n", stderr);
#endif
@@ -541,7 +495,7 @@ usage(void)
}
#ifdef HAVE_GETOPT_LONG
-static void
+private void
help(void)
{
puts(
@@ -556,10 +510,14 @@ help(void)
" conjunction with -m to debug a new magic file\n"
" before installing it\n"
" -f, --files-from FILE read the filenames to be examined from FILE\n"
+" -F, --separator string use string as separator instead of `:'\n"
" -i, --mime output mime type strings\n"
" -k, --keep-going don't stop at the first match\n"
" -L, --dereference causes symlinks to be followed\n"
" -n, --no-buffer do not buffer output\n"
+" -N, --no-pad do not pad output\n"
+" -p, --preserve-date preserve access times on files\n"
+" -r, --raw don't translate unprintable chars to \\ooo\n"
" -s, --special-files treat special (block/char devices) files as\n"
" ordinary ones\n"
" --help display this help and exit\n"
diff --git a/contrib/file/file.h b/contrib/file/file.h
index 874beb9..d5fe2cc 100644
--- a/contrib/file/file.h
+++ b/contrib/file/file.h
@@ -1,111 +1,188 @@
/*
+ * Copyright (c) Ian F. Darwin 1986-1995.
+ * Software written by Ian F. Darwin and others;
+ * maintained 1995-present by Christos Zoulas and others.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice immediately at the beginning of the file, without modification,
+ * this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Ian F. Darwin and others.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+/*
* file.h - definitions for file(1) program
- * @(#)$Id: file.h,v 1.45 2003/02/08 18:33:53 christos Exp $
- *
- * Copyright (c) Ian F. Darwin, 1987.
- * Written by Ian F. Darwin.
- *
- * 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.
+ * @(#)$Id: file.h,v 1.61 2004/05/12 14:53:01 christos Exp $
*/
#ifndef __file_h__
#define __file_h__
-#ifndef __linux__
-#define _LARGEFILE_SOURCE
-#define _LARGEFILE64_SOURCE
-#define _FILE_OFFSET_BITS 64
-#endif
-
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
+#include <stdio.h> /* Include that here, to make sure __P gets defined */
#include <errno.h>
-#include <stdio.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
-#elif defined(HAVE_INTTYPES_H)
+#endif
+#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
/* Do this here and now, because struct stat gets re-defined on solaris */
#include <sys/stat.h>
+#ifndef MAGIC
+#define MAGIC "/etc/magic"
+#endif
+
+#ifdef __EMX__
+#define PATHSEP ';'
+#else
+#define PATHSEP ':'
+#endif
+
+#define private static
+#ifndef protected
+#define protected
+#endif
+#define public
+
#ifndef HOWMANY
# define HOWMANY 65536 /* how much of the file to look at */
#endif
#define MAXMAGIS 4096 /* max entries in /etc/magic */
-#define MAXDESC 50 /* max leng of text description */
+#define MAXDESC 64 /* max leng of text description */
#define MAXstring 32 /* max leng of "string" types */
#define MAGICNO 0xF11E041C
-#define VERSIONNO 1
+#define VERSIONNO 2
+#define FILE_MAGICSIZE (32 * 4)
-#define CHECK 1
-#define COMPILE 2
-
-#ifndef __GNUC__
-#define __attribute__(a)
-#endif
+#define FILE_LOAD 0
+#define FILE_CHECK 1
+#define FILE_COMPILE 2
struct magic {
+ /* Word 1 */
uint16_t cont_level; /* level of ">" */
uint8_t nospflag; /* supress space character */
uint8_t flag;
#define INDIR 1 /* if '>(...)' appears, */
#define UNSIGNED 2 /* comparison is unsigned */
#define OFFADD 4 /* if '>&' appears, */
+ /* Word 2 */
uint8_t reln; /* relation (0=eq, '>'=gt, etc) */
uint8_t vallen; /* length of string value, if any */
uint8_t type; /* int, short, long or string. */
uint8_t in_type; /* type of indirrection */
-#define BYTE 1
-#define SHORT 2
-#define LONG 4
-#define STRING 5
-#define DATE 6
-#define BESHORT 7
-#define BELONG 8
-#define BEDATE 9
-#define LESHORT 10
-#define LELONG 11
-#define LEDATE 12
-#define PSTRING 13
-#define LDATE 14
-#define BELDATE 15
-#define LELDATE 16
-#define REGEX 17
+#define FILE_BYTE 1
+#define FILE_SHORT 2
+#define FILE_LONG 4
+#define FILE_STRING 5
+#define FILE_DATE 6
+#define FILE_BESHORT 7
+#define FILE_BELONG 8
+#define FILE_BEDATE 9
+#define FILE_LESHORT 10
+#define FILE_LELONG 11
+#define FILE_LEDATE 12
+#define FILE_PSTRING 13
+#define FILE_LDATE 14
+#define FILE_BELDATE 15
+#define FILE_LELDATE 16
+#define FILE_REGEX 17
+
+#define FILE_FORMAT_NAME \
+/* 0 */ "invalid 0", \
+/* 1 */ "byte", \
+/* 2 */ "short", \
+/* 3 */ "invalid 3", \
+/* 4 */ "long", \
+/* 5 */ "string", \
+/* 6 */ "date", \
+/* 7 */ "beshort", \
+/* 8 */ "belong", \
+/* 9 */ "bedate" \
+/* 10 */ "leshort", \
+/* 11 */ "lelong", \
+/* 12 */ "ledate", \
+/* 13 */ "pstring", \
+/* 14 */ "ldate", \
+/* 15 */ "beldate", \
+/* 16 */ "leldate", \
+/* 17 */ "regex",
+
+#define FILE_FMT_NUM "cduxXi"
+#define FILE_FMT_STR "s"
+
+#define FILE_FORMAT_STRING \
+/* 0 */ NULL, \
+/* 1 */ FILE_FMT_NUM, \
+/* 2 */ FILE_FMT_NUM, \
+/* 3 */ NULL, \
+/* 4 */ FILE_FMT_NUM, \
+/* 5 */ FILE_FMT_STR, \
+/* 6 */ FILE_FMT_STR, \
+/* 7 */ FILE_FMT_NUM, \
+/* 8 */ FILE_FMT_NUM, \
+/* 9 */ FILE_FMT_STR, \
+/* 10 */ FILE_FMT_NUM, \
+/* 11 */ FILE_FMT_NUM, \
+/* 12 */ FILE_FMT_STR, \
+/* 13 */ FILE_FMT_STR, \
+/* 14 */ FILE_FMT_STR, \
+/* 15 */ FILE_FMT_STR, \
+/* 16 */ FILE_FMT_STR, \
+/* 17 */ FILE_FMT_STR,
+
+ /* Word 3 */
uint8_t in_op; /* operator for indirection */
uint8_t mask_op; /* operator for mask */
-#define OPAND 1
-#define OPOR 2
-#define OPXOR 3
-#define OPADD 4
-#define OPMINUS 5
-#define OPMULTIPLY 6
-#define OPDIVIDE 7
-#define OPMODULO 8
-#define OPINVERSE 0x80
- int32_t offset; /* offset to magic number */
- int32_t in_offset; /* offset from indirection */
+ uint8_t dummy1;
+ uint8_t dummy2;
+#define FILE_OPS "&|^+-*/%"
+#define FILE_OPAND 0
+#define FILE_OPOR 1
+#define FILE_OPXOR 2
+#define FILE_OPADD 3
+#define FILE_OPMINUS 4
+#define FILE_OPMULTIPLY 5
+#define FILE_OPDIVIDE 6
+#define FILE_OPMODULO 7
+#define FILE_OPINVERSE 0x80
+ /* Word 4 */
+ uint32_t offset; /* offset to magic number */
+ /* Word 5 */
+ uint32_t in_offset; /* offset from indirection */
+ /* Word 6 */
+ uint32_t mask; /* mask before comparison with value */
+ /* Word 7 */
+ uint32_t dummy3;
+ /* Word 8 */
+ uint32_t dummp4;
+ /* Words 9-16 */
union VALUETYPE {
uint8_t b;
uint16_t h;
@@ -115,9 +192,9 @@ struct magic {
uint8_t hs[2]; /* 2 bytes of a fixed-endian "short" */
uint8_t hl[4]; /* 4 bytes of a fixed-endian "long" */
} value; /* either number or string */
- uint32_t mask; /* mask before comparison with value */
+ /* Words 17..31 */
char desc[MAXDESC]; /* description */
-} __attribute__((__packed__));
+};
#define BIT(A) (1 << (A))
#define STRING_IGNORE_LOWERCASE BIT(0)
@@ -131,48 +208,58 @@ struct magic {
/* list of magic entries */
struct mlist {
struct magic *magic; /* array of magic entries */
- uint32_t nmagic; /* number of entries in array */
+ uint32_t nmagic; /* number of entries in array */
+ int mapped; /* allocation type: 0 => apprentice_file
+ * 1 => apprentice_map + malloc
+ * 2 => apprentice_map + mmap */
struct mlist *next, *prev;
};
-extern int apprentice(const char *, int);
-extern int ascmagic(unsigned char *, int);
-extern void error(const char *, ...);
-extern void ckfputs(const char *, FILE *);
+struct magic_set {
+ struct mlist *mlist;
+ struct cont {
+ size_t len;
+ int32_t *off;
+ } c;
+ struct out {
+ /* Accumulation buffer */
+ char *buf;
+ char *ptr;
+ size_t len;
+ size_t size;
+ /* Printable buffer */
+ char *pbuf;
+ size_t psize;
+ } o;
+ int error;
+ int flags;
+ int haderr;
+};
+
struct stat;
-extern int fsmagic(const char *, struct stat *);
-extern char *fmttime(long, int);
-extern int is_compress(const unsigned char *, int *);
-extern int is_tar(unsigned char *, int);
-extern void magwarn(const char *, ...);
-extern void mdump(struct magic *);
-extern void process(const char *, int);
-extern void showstr(FILE *, const char *, int);
-extern int softmagic(unsigned char *, int);
-extern int tryit(const char *, unsigned char *, int, int);
-extern int zmagic(const char *, unsigned char *, int);
-extern void ckfprintf(FILE *, const char *, ...);
-extern uint32_t signextend(struct magic *, unsigned int32);
-extern void tryelf(int, unsigned char *, int);
-extern int pipe2file(int, void *, size_t);
-
-
-extern char *progname; /* the program name */
-extern const char *magicfile; /* name of the magic file */
-extern int lineno; /* current line number in magic file */
-
-extern struct mlist mlist; /* list of arrays of magic entries */
-
-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 iflag; /* Output types as mime-types */
-
-#ifdef NEED_GETOPT
-extern int optind; /* From getopt(3) */
-extern char *optarg;
-#endif
+protected char *file_fmttime(uint32_t, int);
+protected int file_buffer(struct magic_set *, const void *, size_t);
+protected int file_fsmagic(struct magic_set *, const char *, struct stat *);
+protected int file_pipe2file(struct magic_set *, int, const void *, size_t);
+protected int file_printf(struct magic_set *, const char *, ...);
+protected int file_reset(struct magic_set *);
+protected int file_tryelf(struct magic_set *, int, const unsigned char *, size_t);
+protected int file_zmagic(struct magic_set *, const unsigned char *, size_t);
+protected int file_ascmagic(struct magic_set *, const unsigned char *, size_t);
+protected int file_is_tar(struct magic_set *, const unsigned char *, size_t);
+protected int file_softmagic(struct magic_set *, const unsigned char *, size_t);
+protected struct mlist *file_apprentice(struct magic_set *, const char *, int);
+protected uint32_t file_signextend(struct magic_set *, struct magic *, uint32_t);
+protected void file_delmagic(struct magic *, int type, size_t entries);
+protected void file_badread(struct magic_set *);
+protected void file_badseek(struct magic_set *);
+protected void file_oomem(struct magic_set *);
+protected void file_error(struct magic_set *, int, const char *, ...);
+protected void file_magwarn(const char *, ...);
+protected void file_mdump(struct magic *);
+protected void file_showstr(FILE *, const char *, size_t);
+protected size_t file_mbswidth(const char *);
+protected const char *file_getbuffer(struct magic_set *);
#ifndef HAVE_STRERROR
extern int sys_nerr;
@@ -193,5 +280,6 @@ extern char *sys_errlist[];
static const char *rcsid(const char *p) { \
return rcsid(p = id); \
}
+#else
#endif /* __file_h__ */
diff --git a/contrib/file/file.man b/contrib/file/file.man
index 7d0ce41..f13ed8e 100644
--- a/contrib/file/file.man
+++ b/contrib/file/file.man
@@ -1,12 +1,12 @@
.TH FILE __CSECTION__ "Copyright but distributable"
-.\" $Id: file.man,v 1.44 2003/02/27 20:47:46 christos Exp $
+.\" $Id: file.man,v 1.54 2003/10/27 18:09:08 christos Exp $
.SH NAME
file
\- determine file type
.SH SYNOPSIS
.B file
[
-.B \-bciknNsvzL
+.B \-bcikLnNprsvz
]
[
.B \-f
@@ -14,18 +14,19 @@ file
]
[
.B \-F
-separator ]
+.I separator
+]
[
-.B \-m
+.B \-m
.I magicfiles
]
.I file
-\*[Am]...
+\&...
.br
.B file
.B -C
[
-.B \-m
+.B \-m
magicfile ]
.SH DESCRIPTION
This manual page documents version __VERSION__ of the
@@ -57,7 +58,7 @@ Exceptions are well-known file formats (core files, tar archives)
that are known to contain binary data.
When modifying the file
.I __MAGIC__
-or the program itself,
+or the program itself,
.B "preserve these keywords" .
People depend on knowing that all the readable files in a directory
have the word ``text'' printed.
@@ -80,13 +81,13 @@ Any known file types appropriate to the system you are running on
implement them)
are intuited if they are defined in
the system header file
-.IR \*[Lt]sys/stat.h\*[Gt] .
+.IR <sys/stat.h> .
.PP
The magic number tests are used to check for files with data in
particular fixed formats.
The canonical example of this is a binary executable (compiled program)
.I a.out
-file, whose format is defined in
+file, whose format is defined in
.I a.out.h
and possibly
.I exec.h
@@ -100,7 +101,7 @@ offset into the file can usually be described in this way.
The information identifying these files is read from the compiled
magic file
.I __MAGIC__.mgc ,
-or
+or
.I __MAGIC__
if the compile file does not exist.
.PP
@@ -138,13 +139,13 @@ For example, the keyword
.B .br
indicates that the file is most likely a
.BR troff (1)
-input file, just as the keyword
+input file, just as the keyword
.B struct
indicates a C program.
These tests are less reliable than the previous
two groups, so they are performed last.
The language test routines also test for some miscellany
-(such as
+(such as
.BR tar (1)
archives).
.PP
@@ -152,36 +153,36 @@ Any file that cannot be identified as having been written
in any of the character sets listed above is simply said to be ``data''.
.SH OPTIONS
.TP 8
-.B \-b
+.B "\-b, \-\-brief"
Do not prepend filenames to output lines (brief mode).
.TP 8
-.B \-c
+.B "\-c, \-\-checking\-printout"
Cause a checking printout of the parsed form of the magic file.
-This is usually used in conjunction with
+This is usually used in conjunction with
.B \-m
to debug a new magic file before installing it.
.TP 8
-.B \-C
+.B "\-C, \-\-compile"
Write a magic.mgc output file that contains a pre-parsed version of
file.
.TP 8
-.BI \-f " namefile"
-Read the names of the files to be examined from
+.BI "\-f, \-\-files\-from" " namefile"
+Read the names of the files to be examined from
.I namefile
-(one per line)
+(one per line)
before the argument list.
-Either
+Either
.I namefile
or at least one filename argument must be present;
to test the standard input, use ``\-'' as a filename argument.
.TP 8
-.BI \-F " separator"
-Use the specified separator character instead of ``:''.
+.BI "\-F, \-\-separator" " separator"
+Use the specified string as the separator between the filename and the
+file result returned. Defaults to ``:''.
.TP 8
-.B \-i
+.B "\-i, \-\-mime"
Causes the file command to output mime type strings rather than the more
-traditional human readable ones.
-Thus it may say
+traditional human readable ones. Thus it may say
``text/plain; charset=us-ascii''
rather
than ``ASCII text''.
@@ -191,33 +192,44 @@ text file types, directories etc), and makes use of an alternative
``magic'' file.
(See ``FILES'' section, below).
.TP 8
-.B \-k
+.B "\-k, \-\-keep\-going"
Don't stop at the first match, keep going.
.TP 8
-.BI \-m " list"
+.B "\-L, \-\-dereference"
+option causes symlinks to be followed, as the like-named option in
+.BR ls (1).
+(on systems that support symbolic links).
+.TP 8
+.BI "\-m, \-\-magic\-file" " list"
Specify an alternate list of files containing magic numbers.
This can be a single file, or a colon-separated list of files.
+If a compiled magic file is found alongside, it will be used instead.
+With the \-i or \-\-mime option, the program adds ".mime" to each file name.
.TP 8
-.B \-n
+.B "\-n, \-\-no\-buffer"
Force stdout to be flushed after checking each file.
This is only useful if checking a list of files.
It is intended to be used by programs that want filetype output from a pipe.
.TP 8
-.B \-N
-Don't pad output to align filenames nicely.
-.TP 8
-.B \-v
-Print the version of the program and exit.
+.B "\-N, \-\-no\-pad"
+Don't pad filenames so that they align in the output.
.TP 8
-.B \-z
-Try to look inside compressed files.
+.B "\-p, \-\-preserve\-date"
+On systems that support
+.BR utime (2)
+or
+.BR utimes(2),
+attempt to preserve the access time of files analyzed, to pretend that
+.BR file (2)
+never read them.
.TP 8
-.B \-L
-option causes symlinks to be followed, as the like-named option in
-.BR ls (1).
-(on systems that support symbolic links).
+.B "\-r, \-\-raw"
+Don't translate unprintable characters to \eooo.
+Normally
+.B file
+translates unprintable characters to their octal representation.
.TP 8
-.B \-s
+.B "\-s, \-\-special\-files"
Normally,
.B file
only attempts to read and determine the type of argument files which
@@ -237,21 +249,40 @@ This option also causes
to disregard the file size as reported by
.BR stat (2)
since on some systems it reports a zero size for raw disk partitions.
+.TP 8
+.B "\-v, \-\-version"
+Print the version of the program and exit.
+.TP 8
+.B "\-z, \-\-uncompress"
+Try to look inside compressed files.
+.TP 8
+.B "\-\-help"
+Print a help message and exit.
.SH FILES
+.TP
.I __MAGIC__.mgc
-\- default compiled list of magic numbers
-.PP
+Default compiled list of magic numbers
+.TP
.I __MAGIC__
-\- default list of magic numbers
-.PP
+Default list of magic numbers
+.TP
+.I __MAGIC__.mime.mgc
+Default compiled list of magic numbers, used to output mime types when
+the -i option is specified.
+.TP
.I __MAGIC__.mime
-\- default list of magic numbers, used to output mime types when the -i option
+Default list of magic numbers, used to output mime types when the -i option
is specified.
+.TP
+.I /etc/magic
+Local additions to magic wisdom.
.SH ENVIRONMENT
The environment variable
.B MAGIC
-can be used to set the default magic number files.
+can be used to set the default magic number file name.
+.B file
+adds ".mime" and/or ".mgc" to the value of this variable as appropriate.
.SH SEE ALSO
.BR magic (__FSECTION__)
\- description of magic file format.
@@ -261,25 +292,26 @@ can be used to set the default magic number files.
.SH STANDARDS CONFORMANCE
This program is believed to exceed the System V Interface Definition
of FILE(CMD), as near as one can determine from the vague language
-contained therein.
+contained therein.
Its behaviour is mostly compatible with the System V program of the same name.
This version knows more magic, however, so it will produce
-different (albeit more accurate) output in many cases.
+different (albeit more accurate) output in many cases.
.PP
-The one significant difference
+The one significant difference
between this version and System V
is that this version treats any white space
as a delimiter, so that spaces in pattern strings must be escaped.
For example,
.br
-\*[Gt]10 string language impress\ (imPRESS data)
+>10 string language impress\ (imPRESS data)
.br
in an existing magic file would have to be changed to
.br
-\*[Gt]10 string language\e impress (imPRESS data)
+>10 string language\e impress (imPRESS data)
.br
In addition, in this version, if a pattern string contains a backslash,
-it must be escaped. For example
+it must be escaped.
+For example
.br
0 string \ebegindata Andrew Toolkit document
.br
@@ -292,16 +324,16 @@ SunOS releases 3.2 and later from Sun Microsystems include a
.BR file (1)
command derived from the System V one, but with some extensions.
My version differs from Sun's only in minor ways.
-It includes the extension of the `\*[Am]' operator, used as,
+It includes the extension of the `&' operator, used as,
for example,
.br
-\*[Gt]16 long\*[Am]0x7fffffff \*[Gt]0 not stripped
+>16 long&0x7fffffff >0 not stripped
.SH MAGIC DIRECTORY
The magic file entries have been collected from various sources,
mainly USENET, and contributed by various authors.
Christos Zoulas (address below) will collect additional
or corrected magic file entries.
-A consolidation of magic file entries
+A consolidation of magic file entries
will be distributed periodically.
.PP
The order of entries in the magic file is significant.
@@ -311,7 +343,7 @@ If your old
.B file
command uses a magic file,
keep the old magic file around for comparison purposes
-(rename it to
+(rename it to
.IR __MAGIC__.orig ).
.SH EXAMPLES
.nf
@@ -324,7 +356,7 @@ file: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
$ file -s /dev/wd0{b,d}
/dev/wd0b: data
/dev/wd0d: x86 boot sector
-$ file -s /dev/hda{,1,2,3,4,5,6,7,8,9,10} # Linux
+$ 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
@@ -337,22 +369,6 @@ $ file -s /dev/hda{,1,2,3,4,5,6,7,8,9,10} # Linux
/dev/hda9: empty
/dev/hda10: empty
-$ file -s /dev/rwd0e # BSD
-/dev/rwd0e:
-Unix Fast File system (little-endian),
-last mounted on /usr,
-last written at Mon Feb 10 13:22:40 2003,
-clean flag 2,
-number of blocks 28754208,
-number of data blocks 27812712,
-number of cylinder groups 3566,
-block size 8192,
-fragment size 1024,
-minimum percentage of free blocks 5,
-rotational delay 0ms,
-disk rotational speed 60rps,
-TIME optimization
-
$ file -i file.c file /dev/{wd0a,hda}
file.c: text/x-c
file: application/x-executable, dynamically linked (uses shared libs),
@@ -362,7 +378,7 @@ not stripped
.fi
.SH HISTORY
-There has been a
+There has been a
.B file
command in every \s-1UNIX\s0 since at least Research Version 4
(man page dated November, 1973).
@@ -371,14 +387,14 @@ the external list of magic number types.
This slowed the program down slightly but made it a lot more flexible.
.PP
This program, based on the System V version,
-was written by Ian Darwin \*[Lt]ian@darwinsys.com\*[Gt]
+was written by Ian Darwin <ian@darwinsys.com>
without looking at anybody else's source code.
.PP
John Gilmore revised the code extensively, making it better than
the first version.
Geoff Collyer found several inadequacies
and provided some magic file entries.
-Contributions by the `\*[Am]' operator by Rob McMahon, cudcv@warwick.ac.uk, 1989.
+Contributions by the `&' operator by Rob McMahon, cudcv@warwick.ac.uk, 1989.
.PP
Guy Harris, guy@netapp.com, made many changes from 1993 to the present.
.PP
@@ -411,7 +427,7 @@ were written by John Gilmore from his public-domain
program, and are not covered by the above license.
.SH BUGS
There must be a better way to automate the construction of the Magic
-file from all the glop in Magdir.
+file from all the glop in magdir.
What is it?
Better yet, the magic file should be compiled into binary (say,
.BR ndbm (3)
@@ -447,11 +463,11 @@ commands vs man page macros.
Regular expression support would make this easy.
.PP
The program doesn't grok \s-2FORTRAN\s0.
-It should be able to figure \s-2FORTRAN\s0 by seeing some keywords which
+It should be able to figure \s-2FORTRAN\s0 by seeing some keywords which
appear indented at the start of line.
Regular expression support would make this easy.
.PP
-The list of keywords in
+The list of keywords in
.I ascmagic
probably belongs in the Magic file.
This could be done by using some keyword like `*' for the offset value.
@@ -464,13 +480,13 @@ Complain about conflicts in the magic file entries.
Make a rule that the magic entries sort based on file offset rather
than position within the magic file?
.PP
-The program should provide a way to give an estimate
+The program should provide a way to give an estimate
of ``how good'' a guess is.
We end up removing guesses (e.g. ``From '' as first 5 chars of file) because
they are not as good as other guesses (e.g. ``Newsgroups:'' versus
``Return-Path:'').
-Still, if the others don't pan out, it should be
-possible to use the first guess.
+Still, if the others don't pan out, it should be possible to use the
+first guess.
.PP
This program is slower than some vendors' file commands.
The new support for multiple character codes makes it even slower.
diff --git a/contrib/file/fsmagic.c b/contrib/file/fsmagic.c
index fc6a29b..18bdd60 100644
--- a/contrib/file/fsmagic.c
+++ b/contrib/file/fsmagic.c
@@ -1,37 +1,48 @@
/*
+ * Copyright (c) Ian F. Darwin 1986-1995.
+ * Software written by Ian F. Darwin and others;
+ * maintained 1995-present by Christos Zoulas and others.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice immediately at the beginning of the file, without modification,
+ * this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Ian F. Darwin and others.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+/*
* fsmagic - magic based on filesystem info - directory, special files, etc.
- *
- * Copyright (c) Ian F. Darwin, 1987.
- * Written by Ian F. Darwin.
- *
- * 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.
*/
#include "file.h"
+#include "magic.h"
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdlib.h>
-/* Since major is a function on SVR4, we can't use `ifndef major'. */
+#include <sys/stat.h>
+/* Since major is a function on SVR4, we cannot use `ifndef major'. */
#ifdef MAJOR_IN_MKDEV
# include <sys/mkdev.h>
# define HAVE_MAJOR
@@ -51,54 +62,74 @@
#undef HAVE_MAJOR
#ifndef lint
-FILE_RCSID("@(#)$Id: fsmagic.c,v 1.36 2002/07/03 19:00:41 christos Exp $")
+FILE_RCSID("@(#)$Id: fsmagic.c,v 1.43 2003/10/14 19:29:55 christos Exp $")
#endif /* lint */
-int
-fsmagic(const char *fn, struct stat *sb)
+protected int
+file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb)
{
int ret = 0;
+#ifdef S_IFLNK
+ char buf[BUFSIZ+4];
+ int nch;
+ struct stat tstatbuf;
+#endif
+
+ if (fn == NULL)
+ return 0;
/*
* Fstat is cheaper but fails for files you don't have read perms on.
* On 4.2BSD and similar systems, use lstat() to identify symlinks.
*/
#ifdef S_IFLNK
- if (!lflag)
+ if ((ms->flags & MAGIC_SYMLINK) == 0)
ret = lstat(fn, sb);
else
#endif
ret = stat(fn, sb); /* don't merge into if; see "ret =" above */
if (ret) {
- ckfprintf(stdout,
- /* Yes, I do mean stdout. */
- /* No \n, caller will provide. */
- "can't stat `%s' (%s).", fn, strerror(errno));
+ if (ms->flags & MAGIC_ERROR) {
+ file_error(ms, errno, "cannot stat `%s'", fn);
+ return -1;
+ }
+ if (file_printf(ms, "cannot open (%s)",
+ fn, strerror(errno)) == -1)
+ return -1;
return 1;
}
- if (iflag) {
+ if ((ms->flags & MAGIC_MIME) != 0) {
if ((sb->st_mode & S_IFMT) != S_IFREG) {
- ckfputs("application/x-not-regular-file", stdout);
+ if (file_printf(ms, "application/x-not-regular-file")
+ == -1)
+ return -1;
return 1;
}
}
else {
#ifdef S_ISUID
- if (sb->st_mode & S_ISUID) ckfputs("setuid ", stdout);
+ if (sb->st_mode & S_ISUID)
+ if (file_printf(ms, "setuid ") == -1)
+ return -1;
#endif
#ifdef S_ISGID
- if (sb->st_mode & S_ISGID) ckfputs("setgid ", stdout);
+ if (sb->st_mode & S_ISGID)
+ if (file_printf(ms, "setgid ") == -1)
+ return -1;
#endif
#ifdef S_ISVTX
- if (sb->st_mode & S_ISVTX) ckfputs("sticky ", stdout);
+ if (sb->st_mode & S_ISVTX)
+ if (file_printf(ms, "sticky ") == -1)
+ return -1;
#endif
}
switch (sb->st_mode & S_IFMT) {
case S_IFDIR:
- ckfputs("directory", stdout);
+ if (file_printf(ms, "directory") == -1)
+ return -1;
return 1;
#ifdef S_IFCHR
case S_IFCHR:
@@ -107,20 +138,22 @@ fsmagic(const char *fn, struct stat *sb)
* like ordinary files. Otherwise, just report that they
* are block special files and go on to the next file.
*/
- if (sflag)
+ if ((ms->flags & MAGIC_DEVICES) != 0)
break;
#ifdef HAVE_ST_RDEV
# ifdef dv_unit
- (void) printf("character special (%d/%d/%d)",
- major(sb->st_rdev),
- dv_unit(sb->st_rdev),
- dv_subunit(sb->st_rdev));
+ if (file_printf(ms, "character special (%d/%d/%d)",
+ major(sb->st_rdev), dv_unit(sb->st_rdev),
+ dv_subunit(sb->st_rdev)) == -1)
+ return -1;
# else
- (void) printf("character special (%ld/%ld)",
- (long) major(sb->st_rdev), (long) minor(sb->st_rdev));
+ if (file_printf(ms, "character special (%ld/%ld)",
+ (long) major(sb->st_rdev), (long) minor(sb->st_rdev)) == -1)
+ return -1;
# endif
#else
- (void) printf("character special");
+ if (file_printf(ms, "character special") == -1)
+ return -1;
#endif
return 1;
#endif
@@ -131,98 +164,132 @@ fsmagic(const char *fn, struct stat *sb)
* like ordinary files. Otherwise, just report that they
* are block special files and go on to the next file.
*/
- if (sflag)
+ if ((ms->flags & MAGIC_DEVICES) != 0)
break;
#ifdef HAVE_ST_RDEV
# ifdef dv_unit
- (void) printf("block special (%d/%d/%d)",
- major(sb->st_rdev),
- dv_unit(sb->st_rdev),
- dv_subunit(sb->st_rdev));
+ if (file_printf(ms, "block special (%d/%d/%d)",
+ major(sb->st_rdev), dv_unit(sb->st_rdev),
+ dv_subunit(sb->st_rdev)) == -1)
+ return -1;
# else
- (void) printf("block special (%ld/%ld)",
- (long) major(sb->st_rdev), (long) minor(sb->st_rdev));
+ if (file_printf(ms, "block special (%ld/%ld)",
+ (long)major(sb->st_rdev), (long)minor(sb->st_rdev)) == -1)
+ return -1;
# endif
#else
- (void) printf("block special");
+ if (file_printf(ms, "block special") == -1)
+ return -1;
#endif
return 1;
#endif
/* TODO add code to handle V7 MUX and Blit MUX files */
#ifdef S_IFIFO
case S_IFIFO:
- ckfputs("fifo (named pipe)", stdout);
+ if (file_printf(ms, "fifo (named pipe)") == -1)
+ return -1;
return 1;
#endif
#ifdef S_IFDOOR
case S_IFDOOR:
- ckfputs("door", stdout);
+ if (file_printf(ms, "door") == -1)
+ return -1;
return 1;
#endif
#ifdef S_IFLNK
case S_IFLNK:
- {
- char buf[BUFSIZ+4];
- int nch;
- struct stat tstatbuf;
-
- if ((nch = readlink(fn, buf, BUFSIZ-1)) <= 0) {
- ckfprintf(stdout, "unreadable symlink (%s).",
- strerror(errno));
- return 1;
+ if ((nch = readlink(fn, buf, BUFSIZ-1)) <= 0) {
+ if (ms->flags & MAGIC_ERROR) {
+ file_error(ms, errno, "unreadable symlink `%s'",
+ fn);
+ return -1;
}
- buf[nch] = '\0'; /* readlink(2) forgets this */
+ if (file_printf(ms,
+ "unreadable symlink `%s' (%s)", fn,
+ strerror(errno)) == -1)
+ return -1;
+ return 1;
+ }
+ buf[nch] = '\0'; /* readlink(2) forgets this */
- /* If broken symlink, say so and quit early. */
- if (*buf == '/') {
- if (stat(buf, &tstatbuf) < 0) {
- ckfprintf(stdout,
- "broken symbolic link to %s", buf);
- return 1;
- }
- }
- else {
- char *tmp;
- char buf2[BUFSIZ+BUFSIZ+4];
+ /* If broken symlink, say so and quit early. */
+ if (*buf == '/') {
+ if (stat(buf, &tstatbuf) < 0) {
+ if (ms->flags & MAGIC_ERROR) {
+ file_error(ms, errno,
+ "broken symbolic link to `%s'", buf);
+ return -1;
+ }
+ if (file_printf(ms, "broken symbolic link to `%s'",
+ buf) == -1)
+ return -1;
+ return 1;
+ }
+ }
+ else {
+ char *tmp;
+ char buf2[BUFSIZ+BUFSIZ+4];
- if ((tmp = strrchr(fn, '/')) == NULL) {
+ if ((tmp = strrchr(fn, '/')) == NULL) {
tmp = buf; /* in current directory anyway */
- }
- else {
- strcpy (buf2, fn); /* take directory part */
- buf2[tmp-fn+1] = '\0';
- strcat (buf2, buf); /* plus (relative) symlink */
+ } else {
+ if (tmp - fn + 1 > BUFSIZ) {
+ if (ms->flags & MAGIC_ERROR) {
+ file_error(ms, 0,
+ "path too long: `%s'", buf);
+ return -1;
+ }
+ if (file_printf(ms,
+ "path too long: `%s'", fn) == -1)
+ return -1;
+ return 1;
+ }
+ (void)strcpy(buf2, fn); /* take dir part */
+ buf2[tmp - fn + 1] = '\0';
+ (void)strcat(buf2, buf); /* plus (rel) link */
tmp = buf2;
- }
- if (stat(tmp, &tstatbuf) < 0) {
- ckfprintf(stdout,
- "broken symbolic link to %s", buf);
- return 1;
- }
- }
-
- /* Otherwise, handle it. */
- if (lflag) {
- process(buf, strlen(buf));
+ }
+ if (stat(tmp, &tstatbuf) < 0) {
+ if (ms->flags & MAGIC_ERROR) {
+ file_error(ms, errno,
+ "broken symbolic link to `%s'",
+ buf);
+ return -1;
+ }
+ if (file_printf(ms,
+ "broken symbolic link to `%s'", buf) == -1)
+ return -1;
return 1;
- } else { /* just print what it points to */
- ckfputs("symbolic link to ", stdout);
- ckfputs(buf, stdout);
}
}
- return 1;
+
+ /* Otherwise, handle it. */
+ if ((ms->flags & MAGIC_SYMLINK) != 0) {
+ const char *p;
+ ms->flags &= MAGIC_SYMLINK;
+ p = magic_file(ms, buf);
+ ms->flags |= MAGIC_SYMLINK;
+ return p != NULL ? 1 : -1;
+ } else { /* just print what it points to */
+ if (file_printf(ms, "symbolic link to `%s'",
+ buf) == -1)
+ return -1;
+ }
+ return 1;
#endif
#ifdef S_IFSOCK
#ifndef __COHERENT__
case S_IFSOCK:
- ckfputs("socket", stdout);
+ if (file_printf(ms, "socket") == -1)
+ return -1;
return 1;
#endif
#endif
case S_IFREG:
break;
default:
- error("invalid mode 0%o.\n", sb->st_mode);
+ file_error(ms, 0, "invalid mode 0%o", sb->st_mode);
+ return -1;
/*NOTREACHED*/
}
@@ -238,8 +305,10 @@ fsmagic(const char *fn, struct stat *sb)
* the fact that it is empty will be detected and reported correctly
* when we read the file.)
*/
- if (!sflag && sb->st_size == 0) {
- ckfputs(iflag ? "application/x-empty" : "empty", stdout);
+ if ((ms->flags & MAGIC_DEVICES) == 0 && sb->st_size == 0) {
+ if (file_printf(ms, (ms->flags & MAGIC_MIME) ?
+ "application/x-empty" : "empty") == -1)
+ return -1;
return 1;
}
return 0;
diff --git a/contrib/file/funcs.c b/contrib/file/funcs.c
new file mode 100644
index 0000000..44cbdf1
--- /dev/null
+++ b/contrib/file/funcs.c
@@ -0,0 +1,186 @@
+/*
+ * Copyright (c) Christos Zoulas 2003.
+ * All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice immediately at the beginning of the file, without modification,
+ * this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#include "file.h"
+#include "magic.h"
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#ifndef lint
+FILE_RCSID("@(#)$Id: funcs.c,v 1.12 2004/06/04 14:40:20 christos Exp $")
+#endif /* lint */
+/*
+ * Like printf, only we print to a buffer and advance it.
+ */
+protected int
+file_printf(struct magic_set *ms, const char *fmt, ...)
+{
+ va_list ap;
+ size_t len;
+ char *buf;
+
+ va_start(ap, fmt);
+
+ if ((len = vsnprintf(ms->o.ptr, ms->o.len, fmt, ap)) >= ms->o.len) {
+ va_end(ap);
+ if ((buf = realloc(ms->o.buf, len + 1024)) == NULL) {
+ file_oomem(ms);
+ return -1;
+ }
+ ms->o.ptr = buf + (ms->o.ptr - ms->o.buf);
+ ms->o.buf = buf;
+ ms->o.len = ms->o.size - (ms->o.ptr - ms->o.buf);
+ ms->o.size = len + 1024;
+
+ va_start(ap, fmt);
+ len = vsnprintf(ms->o.ptr, ms->o.len, fmt, ap);
+ }
+ ms->o.ptr += len;
+ ms->o.len -= len;
+ va_end(ap);
+ return 0;
+}
+
+/*
+ * error - print best error message possible
+ */
+/*VARARGS*/
+protected void
+file_error(struct magic_set *ms, int error, const char *f, ...)
+{
+ va_list va;
+ /* Only the first error is ok */
+ if (ms->haderr)
+ return;
+ va_start(va, f);
+ (void)vsnprintf(ms->o.buf, ms->o.size, f, va);
+ va_end(va);
+ if (error > 0) {
+ size_t len = strlen(ms->o.buf);
+ (void)snprintf(ms->o.buf + len, ms->o.size - len, " (%s)",
+ strerror(error));
+ }
+ ms->haderr++;
+ ms->error = error;
+}
+
+
+protected void
+file_oomem(struct magic_set *ms)
+{
+ file_error(ms, errno, "cannot allocate memory");
+}
+
+protected void
+file_badseek(struct magic_set *ms)
+{
+ file_error(ms, errno, "error seeking");
+}
+
+protected void
+file_badread(struct magic_set *ms)
+{
+ file_error(ms, errno, "error reading");
+}
+
+#ifndef COMPILE_ONLY
+protected int
+file_buffer(struct magic_set *ms, const void *buf, size_t nb)
+{
+ int m;
+ /* try compression stuff */
+ if ((m = file_zmagic(ms, buf, nb)) == 0) {
+ /* Check if we have a tar file */
+ if ((m = file_is_tar(ms, buf, nb)) == 0) {
+ /* try tests in /etc/magic (or surrogate magic file) */
+ if ((m = file_softmagic(ms, buf, nb)) == 0) {
+ /* try known keywords, check whether it is ASCII */
+ if ((m = file_ascmagic(ms, buf, nb)) == 0) {
+ /* abandon hope, all ye who remain here */
+ if (file_printf(ms, ms->flags & MAGIC_MIME ?
+ "application/octet-stream" : "data") == -1)
+ return -1;
+ m = 1;
+ }
+ }
+ }
+ }
+ return m;
+}
+#endif
+
+protected int
+file_reset(struct magic_set *ms)
+{
+ if (ms->mlist == NULL) {
+ file_error(ms, 0, "no magic files loaded");
+ return -1;
+ }
+ ms->o.ptr = ms->o.buf;
+ ms->haderr = 0;
+ ms->error = -1;
+ return 0;
+}
+
+protected const char *
+file_getbuffer(struct magic_set *ms)
+{
+ char *nbuf, *op, *np;
+ size_t nsize;
+
+ if (ms->haderr)
+ return NULL;
+
+ if (ms->flags & MAGIC_RAW)
+ return ms->o.buf;
+
+ nsize = ms->o.len * 4 + 1;
+ if (ms->o.psize < nsize) {
+ if ((nbuf = realloc(ms->o.pbuf, nsize)) == NULL) {
+ file_oomem(ms);
+ return NULL;
+ }
+ ms->o.psize = nsize;
+ ms->o.pbuf = nbuf;
+ }
+
+ for (np = ms->o.pbuf, op = ms->o.buf; *op; op++) {
+ if (isprint((unsigned char)*op)) {
+ *np++ = *op;
+ } else {
+ *np++ = '\\';
+ *np++ = ((*op >> 6) & 3) + '0';
+ *np++ = ((*op >> 3) & 7) + '0';
+ *np++ = ((*op >> 0) & 7) + '0';
+ }
+ }
+ *np = '\0';
+ return ms->o.pbuf;
+}
diff --git a/contrib/file/is_tar.c b/contrib/file/is_tar.c
index de7a169..fbee318 100644
--- a/contrib/file/is_tar.c
+++ b/contrib/file/is_tar.c
@@ -1,29 +1,85 @@
/*
+ * Copyright (c) Ian F. Darwin 1986-1995.
+ * Software written by Ian F. Darwin and others;
+ * maintained 1995-present by Christos Zoulas and others.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice immediately at the beginning of the file, without modification,
+ * this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Ian F. Darwin and others.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+/*
* is_tar() -- figure out whether file is a tar archive.
*
* Stolen (by the author!) from the public domain tar program:
* 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.17 2002/07/03 18:26:38 christos Exp $
*
* Comments changed and some code/comments reformatted
* for file command by Ian Darwin.
*/
#include "file.h"
+#include "magic.h"
#include <string.h>
#include <ctype.h>
#include <sys/types.h>
#include "tar.h"
#ifndef lint
-FILE_RCSID("@(#)$Id: is_tar.c,v 1.17 2002/07/03 18:26:38 christos Exp $")
+FILE_RCSID("@(#)$Id: is_tar.c,v 1.24 2003/11/11 20:01:46 christos Exp $")
#endif
#define isodigit(c) ( ((c) >= '0') && ((c) <= '7') )
-static int from_oct(int, char *); /* Decode octal number */
+private int is_tar(const unsigned char *, size_t);
+private int from_oct(int, const char *); /* Decode octal number */
+
+protected int
+file_is_tar(struct magic_set *ms, const unsigned char *buf, size_t nbytes)
+{
+ /*
+ * Do the tar test first, because if the first file in the tar
+ * archive starts with a dot, we can confuse it with an nroff file.
+ */
+ switch (is_tar(buf, nbytes)) {
+ case 1:
+ if (file_printf(ms, (ms->flags & MAGIC_MIME) ?
+ "application/x-tar" : "tar archive") == -1)
+ return -1;
+ return 1;
+ case 2:
+ if (file_printf(ms, (ms->flags & MAGIC_MIME) ?
+ "application/x-tar, POSIX" : "POSIX tar archive") == -1)
+ return -1;
+ return 1;
+ default:
+ return 0;
+ }
+}
/*
* Return
@@ -31,13 +87,13 @@ static int from_oct(int, char *); /* Decode octal number */
* 1 for old UNIX tar file,
* 2 for Unix Std (POSIX) tar file.
*/
-int
-is_tar(unsigned char *buf, int nbytes)
+private int
+is_tar(const unsigned char *buf, size_t nbytes)
{
- union record *header = (union record *)buf;
+ const union record *header = (const union record *)(const void *)buf;
int i;
int sum, recsum;
- char *p;
+ const char *p;
if (nbytes < sizeof(union record))
return 0;
@@ -48,7 +104,7 @@ is_tar(unsigned char *buf, int nbytes)
p = header->charptr;
for (i = sizeof(union record); --i >= 0;) {
/*
- * We can't use unsigned char here because of old compilers,
+ * We cannot use unsigned char here because of old compilers,
* e.g. V7.
*/
sum += 0xFF & *p++;
@@ -74,8 +130,8 @@ is_tar(unsigned char *buf, int nbytes)
*
* Result is -1 if the field is invalid (all blank, or nonoctal).
*/
-static int
-from_oct(int digs, char *where)
+private int
+from_oct(int digs, const char *where)
{
int value;
diff --git a/contrib/file/libmagic.man b/contrib/file/libmagic.man
new file mode 100644
index 0000000..c60a044
--- /dev/null
+++ b/contrib/file/libmagic.man
@@ -0,0 +1,228 @@
+.\"
+.\" Copyright (c) Christos Zoulas 2003.
+.\" All Rights Reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice immediately at the beginning of the file, without modification,
+.\" this list of conditions, and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.Dd March 22, 2003
+.Dt MAGIC 3
+.Os
+.Sh NAME
+.Nm magic_open ,
+.Nm magic_close ,
+.Nm magic_error ,
+.Nm magic_file ,
+.Nm magic_buffer ,
+.Nm magic_setflags ,
+.Nm magic_check ,
+.Nm magic_compile ,
+.Nm magic_load
+.Nd Magic number recognition library.
+.Sh LIBRARY
+.Lb libmagic
+.Sh SYNOPSIS
+.In magic.h
+.Ft magic_t
+.Fn magic_open "int flags"
+.Ft void
+.Fn magic_close "magic_t cookie"
+.Ft const char *
+.Fn magic_error "magic_t cookie"
+.Ft int
+.Fn magic_errno "magic_t cookie"
+.Ft const char *
+.Fn magic_file "magic_t cookie, const char *filename"
+.Ft const char *
+.Fn magic_buffer "magic_t cookie, const void *buffer, size_t length"
+.Ft int
+.Fn magic_setflags "magic_t cookie, int flags"
+.Ft int
+.Fn magic_check "magic_t cookie, const char *filename"
+.Ft int
+.Fn magic_compile "magic_t cookie, const char *filename"
+.Ft int
+.Fn magic_load "magic_t cookie, const char *filename"
+.Sh DESCRIPTION
+These functions
+operate on the magic database file
+which is described
+in
+.Xr magic __FSECTION__ .
+.Pp
+The function
+.Fn magic_open
+creates a magic cookie pointer and returns it. It returns NULL if
+there was an error allocating the magic cookie. The
+.Ar flags
+argument specifies how the other magic functions should behave:
+.Bl -tag -width MAGIC_COMPRESS
+.It Dv MAGIC_NONE
+No special handling.
+.It Dv MAGIC_DEBUG
+Print debugging messages to stderr.
+.It Dv MAGIC_SYMLINK
+If the file queried is a symlink, follow it.
+.It Dv MAGIC_COMPRESS
+If the file is compressed, unpack it and look at the contents.
+.It Dv MAGIC_DEVICES
+If the file is a block or character special device, then open the device
+and try to look in its contents.
+.It Dv MAGIC_MIME
+Return a mime string, instead of a textual description.
+.It Dv MAGIC_CONTINUE
+Return all matches, not just the first.
+.It Dv MAGIC_CHECK
+Check the magic database for consistency and print warnings to stderr.
+.It Dv MAGIC_PRESERVE_ATIME
+On systems that support
+.Xr utime 2
+or
+.Xr utimes 2 ,
+attempt to preserve the access time of files analyzed.
+.It Dv MAGIC_RAW
+Don't translate unprintable characters to a \eooo octal representation.
+.It Dv MAGIC_ERROR
+Treat operating system errors while trying to open files and follow symlinks
+as real errors, instead of printing them in the magic buffer.
+.El
+.Pp
+The
+.Fn magic_close
+function closes the
+.Xr magic __FSECTION__
+database and deallocates any resources used.
+.Pp
+The
+.Fn magic_error
+function returns a textual explanation of the last error, or NULL if there was
+no error.
+.Pp
+The
+.Fn magic_errno
+function returns the last operating system error number (
+.Xr errno 3 )
+that was encountered by a system call.
+.Pp
+The
+.Fn magic_file
+function returns a textual description of the contents of the
+.Ar filename
+argument, or NULL if an error occurred.
+If the
+.Ar filename
+is NULL, then stdin is used.
+.Pp
+The
+.Fn magic_buffer
+function returns a textual description of the contents of the
+.Ar buffer
+argument with
+.Ar length
+bytes size.
+.Pp
+The
+.Fn magic_setflags
+function, sets the
+.Ar flags
+described above.
+.Pp
+The
+.Fn magic_check
+function can be used to check the validity of entries in the colon
+separated database files passed in as
+.Ar filename ,
+or NULL for the default database. It returns 0 on success and -1 on
+failure.
+.Pp
+The
+.Fn magic_compile
+function can be used to compile the the colon
+separated list of database files passed in as
+.Ar filename ,
+or NULL for the default database. It returns 0 on success and -1 on
+failure. The compiled files created are named from the
+.Xr basename 1
+of each file argument with ".mgc" appended to it.
+.Pp
+The
+.Fn magic_load
+function must be used to load the the colon
+separated list of database files passed in as
+.Ar filename ,
+or NULL for the default database file
+before any magic queries can performed.
+.Pp
+The default database file is named by the MAGIC environment variable. If
+that variable is not set, the default database file name is __MAGIC__.
+.Pp
+.Fn magic_load
+adds ".mime" and/or ".mgc" to the database filename as appropriate.
+.Sh RETURN VALUES
+The function
+.Fn magic_open
+returns a magic cookie on success and NULL on failure setting errno to
+an appropriate value. It will set errno to EINVAL if an unsupported
+value for flags was given.
+The
+.Fn magic_load ,
+.Fn magic_compile ,
+and
+.Fn magic_check
+functions return 0 on success and -1 on failure.
+The
+.Fn magic_file ,
+and
+.Fn magic_buffer
+functions return a string on success and NULL on failure. The
+.Fn magic_error
+function returns a textual description of the errors of the above
+functions, or NULL if there was no error.
+Finally,
+.Fn magic_setflags
+returns -1 on systems that don't support
+.Xr utime 2 ,
+or
+.Xr utimes 2
+when
+.Dv MAGIC_PRESERVE_ATIME
+is set.
+.Sh FILES
+.Bl -tag -width __MAGIC__.mime.mgc -compact
+.It Pa __MAGIC__.mime
+The non-compiled default magic mime database.
+.It Pa __MAGIC__.mime.mgc
+The compiled default magic mime database.
+.It Pa __MAGIC__
+The non-compiled default magic database.
+.It Pa __MAGIC__.mgc
+The compiled default magic database.
+.El
+.Sh SEE ALSO
+.Xr file __CSECTION__ ,
+.Xr magic __FSECTION__
+.Sh AUTHORS
+Måns Rullgård Initial libmagic implementation,
+and configuration.
+Christos Zoulas API cleanup, error code and allocation handling.
diff --git a/contrib/file/magic.c b/contrib/file/magic.c
new file mode 100644
index 0000000..0ecf2d3
--- /dev/null
+++ b/contrib/file/magic.c
@@ -0,0 +1,343 @@
+/*
+ * Copyright (c) Christos Zoulas 2003.
+ * All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice immediately at the beginning of the file, without modification,
+ * this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "file.h"
+#include "magic.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/param.h> /* for MAXPATHLEN */
+#include <sys/stat.h>
+#include <fcntl.h> /* for open() */
+#ifdef QUICK
+#include <sys/mman.h>
+#endif
+
+#if defined(HAVE_UTIMES)
+# include <sys/time.h>
+#elif defined(HAVE_UTIME)
+# if defined(HAVE_SYS_UTIME_H)
+# include <sys/utime.h>
+# elif defined(HAVE_UTIME_H)
+# include <utime.h>
+# endif
+#endif
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h> /* for read() */
+#endif
+
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#endif
+
+#include <netinet/in.h> /* for byte swapping */
+
+#include "patchlevel.h"
+
+#ifndef lint
+FILE_RCSID("@(#)$Id: magic.c,v 1.22 2004/07/24 19:55:17 christos Exp $")
+#endif /* lint */
+
+#ifdef __EMX__
+private char *apptypeName = NULL;
+protected int file_os2_apptype(struct magic_set *ms, const char *fn,
+ const void *buf, size_t nb);
+#endif /* __EMX__ */
+
+private void free_mlist(struct mlist *);
+private void close_and_restore(const struct magic_set *, const char *, int,
+ const struct stat *);
+
+public struct magic_set *
+magic_open(int flags)
+{
+ struct magic_set *ms;
+
+ if ((ms = malloc(sizeof(struct magic_set))) == NULL)
+ return NULL;
+
+ if (magic_setflags(ms, flags) == -1) {
+ free(ms);
+ errno = EINVAL;
+ return NULL;
+ }
+
+ ms->o.ptr = ms->o.buf = malloc(ms->o.size = 1024);
+ ms->o.len = 0;
+ if (ms->o.buf == NULL) {
+ free(ms);
+ return NULL;
+ }
+ ms->o.pbuf = malloc(ms->o.psize = 1024);
+ if (ms->o.pbuf == NULL) {
+ free(ms->o.buf);
+ free(ms);
+ return NULL;
+ }
+ ms->c.off = malloc((ms->c.len = 10) * sizeof(*ms->c.off));
+ if (ms->c.off == NULL) {
+ free(ms->o.pbuf);
+ free(ms->o.buf);
+ free(ms);
+ return NULL;
+ }
+ ms->haderr = 0;
+ ms->error = -1;
+ ms->mlist = NULL;
+ return ms;
+}
+
+private void
+free_mlist(struct mlist *mlist)
+{
+ struct mlist *ml;
+
+ if (mlist == NULL)
+ return;
+
+ for (ml = mlist->next; ml != mlist;) {
+ struct mlist *next = ml->next;
+ struct magic *mg = ml->magic;
+ file_delmagic(mg, ml->mapped, ml->nmagic);
+ free(ml);
+ ml = next;
+ }
+ free(ml);
+}
+
+public void
+magic_close(ms)
+ struct magic_set *ms;
+{
+ free_mlist(ms->mlist);
+ free(ms->o.buf);
+ free(ms->c.off);
+ free(ms);
+}
+
+/*
+ * load a magic file
+ */
+public int
+magic_load(struct magic_set *ms, const char *magicfile)
+{
+ struct mlist *ml = file_apprentice(ms, magicfile, FILE_LOAD);
+ if (ml) {
+ free_mlist(ms->mlist);
+ ms->mlist = ml;
+ return 0;
+ }
+ return -1;
+}
+
+public int
+magic_compile(struct magic_set *ms, const char *magicfile)
+{
+ struct mlist *ml = file_apprentice(ms, magicfile, FILE_COMPILE);
+ free_mlist(ml);
+ return ml ? 0 : -1;
+}
+
+public int
+magic_check(struct magic_set *ms, const char *magicfile)
+{
+ struct mlist *ml = file_apprentice(ms, magicfile, FILE_CHECK);
+ free_mlist(ml);
+ return ml ? 0 : -1;
+}
+
+private void
+close_and_restore(const struct magic_set *ms, const char *name, int fd,
+ const struct stat *sb)
+{
+ (void) close(fd);
+ if (fd != STDIN_FILENO && (ms->flags & MAGIC_PRESERVE_ATIME) != 0) {
+ /*
+ * Try to restore access, modification times if read it.
+ * This is really *bad* because it will modify the status
+ * time of the file... And of course this will affect
+ * backup programs
+ */
+#ifdef HAVE_UTIMES
+ struct timeval utsbuf[2];
+ utsbuf[0].tv_sec = sb->st_atime;
+ utsbuf[1].tv_sec = sb->st_mtime;
+
+ (void) utimes(name, utsbuf); /* don't care if loses */
+#elif defined(HAVE_UTIME_H) || defined(HAVE_SYS_UTIME_H)
+ struct utimbuf utbuf;
+
+ utbuf.actime = sb->st_atime;
+ utbuf.modtime = sb->st_mtime;
+ (void) utime(name, &utbuf); /* don't care if loses */
+#endif
+ }
+}
+
+#ifndef COMPILE_ONLY
+/*
+ * find type of named file
+ */
+public const char *
+magic_file(struct magic_set *ms, const char *inname)
+{
+ int fd = 0;
+ unsigned char buf[HOWMANY+1]; /* one extra for terminating '\0' */
+ struct stat sb;
+ ssize_t nbytes = 0; /* number of bytes read from a datafile */
+
+ if (file_reset(ms) == -1)
+ return NULL;
+
+ switch (file_fsmagic(ms, inname, &sb)) {
+ case -1:
+ return NULL;
+ case 0:
+ break;
+ default:
+ return file_getbuffer(ms);
+ }
+
+#ifndef STDIN_FILENO
+#define STDIN_FILENO 0
+#endif
+ if (inname == NULL)
+ fd = STDIN_FILENO;
+ else if ((fd = open(inname, O_RDONLY)) < 0) {
+ /* We cannot open it, but we were able to stat it. */
+ if (sb.st_mode & 0222)
+ if (file_printf(ms, "writable, ") == -1)
+ return NULL;
+ if (sb.st_mode & 0111)
+ if (file_printf(ms, "executable, ") == -1)
+ return NULL;
+ if (S_ISREG(sb.st_mode))
+ if (file_printf(ms, "regular file, ") == -1)
+ return NULL;
+ if (file_printf(ms, "no read permission") == -1)
+ return NULL;
+ return file_getbuffer(ms);
+ }
+
+ /*
+ * try looking at the first HOWMANY bytes
+ */
+ if ((nbytes = read(fd, (char *)buf, HOWMANY)) == -1) {
+ file_error(ms, errno, "cannot read `%s'", inname);
+ goto done;
+ }
+
+ if (nbytes == 0) {
+ if (file_printf(ms, (ms->flags & MAGIC_MIME) ?
+ "application/x-empty" : "empty") == -1)
+ goto done;
+ goto gotit;
+ } else if (nbytes == 1) {
+ if (file_printf(ms, "very short file (no magic)") == -1)
+ goto done;
+ goto gotit;
+ } else {
+ buf[nbytes] = '\0'; /* null-terminate it */
+#ifdef __EMX__
+ switch (file_os2_apptype(ms, inname, buf, nbytes)) {
+ case -1:
+ goto done;
+ case 0:
+ break;
+ default:
+ goto gotit;
+ }
+#endif
+ if (file_buffer(ms, buf, (size_t)nbytes) == -1)
+ goto done;
+#ifdef BUILTIN_ELF
+ if (nbytes > 5) {
+ /*
+ * We matched something in the file, so this *might*
+ * be an ELF file, and the file is at least 5 bytes
+ * long, so if it's an ELF file it has at least one
+ * byte past the ELF magic number - try extracting
+ * information from the ELF headers that cannot easily
+ * be extracted with rules in the magic file.
+ */
+ file_tryelf(ms, fd, buf, (size_t)nbytes);
+ }
+#endif
+ }
+gotit:
+ close_and_restore(ms, inname, fd, &sb);
+ return file_getbuffer(ms);
+done:
+ close_and_restore(ms, inname, fd, &sb);
+ return NULL;
+}
+
+
+public const char *
+magic_buffer(struct magic_set *ms, const void *buf, size_t nb)
+{
+ if (file_reset(ms) == -1)
+ return NULL;
+ /*
+ * The main work is done here!
+ * We have the file name and/or the data buffer to be identified.
+ */
+ if (file_buffer(ms, buf, nb) == -1) {
+ return NULL;
+ }
+ return file_getbuffer(ms);
+}
+#endif
+
+public const char *
+magic_error(struct magic_set *ms)
+{
+ return ms->haderr ? ms->o.buf : NULL;
+}
+
+public int
+magic_errno(struct magic_set *ms)
+{
+ return ms->haderr ? ms->error : 0;
+}
+
+public int
+magic_setflags(struct magic_set *ms, int flags)
+{
+#if !defined(HAVE_UTIME) && !defined(HAVE_UTIMES)
+ if (flags & MAGIC_PRESERVE_ATIME)
+ return -1;
+#endif
+ ms->flags = flags;
+ return 0;
+}
diff --git a/contrib/file/magic.h b/contrib/file/magic.h
new file mode 100644
index 0000000..eefb8bf5
--- /dev/null
+++ b/contrib/file/magic.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) Christos Zoulas 2003.
+ * All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice immediately at the beginning of the file, without modification,
+ * this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef _MAGIC_H
+#define _MAGIC_H
+
+#include <sys/types.h>
+
+#define MAGIC_NONE 0x000 /* No flags */
+#define MAGIC_DEBUG 0x001 /* Turn on debugging */
+#define MAGIC_SYMLINK 0x002 /* Follow symlinks */
+#define MAGIC_COMPRESS 0x004 /* Check inside compressed files */
+#define MAGIC_DEVICES 0x008 /* Look at the contents of devices */
+#define MAGIC_MIME 0x010 /* Return a mime string */
+#define MAGIC_CONTINUE 0x020 /* Return all matches */
+#define MAGIC_CHECK 0x040 /* Print warnings to stderr */
+#define MAGIC_PRESERVE_ATIME 0x080 /* Restore access time on exit */
+#define MAGIC_RAW 0x100 /* Don't translate unprintable chars */
+#define MAGIC_ERROR 0x200 /* Handle ENOENT etc as real errors */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct magic_set *magic_t;
+magic_t magic_open(int);
+void magic_close(magic_t);
+
+const char *magic_file(magic_t, const char *);
+const char *magic_buffer(magic_t, const void *, size_t);
+
+const char *magic_error(magic_t);
+int magic_setflags(magic_t, int);
+
+int magic_load(magic_t, const char *);
+int magic_compile(magic_t, const char *);
+int magic_check(magic_t, const char *);
+int magic_errno(magic_t);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif /* _MAGIC_H */
diff --git a/contrib/file/magic.man b/contrib/file/magic.man
index 0d957bc..6917bc0 100644
--- a/contrib/file/magic.man
+++ b/contrib/file/magic.man
@@ -40,16 +40,20 @@ A two-byte value (on most systems) in this machine's native byte order.
A four-byte value (on most systems) in this machine's native byte order.
.IP string
A string of bytes.
-The string type specification can be optionally followed by /[Bbc]*.
+The string type specification can be optionally followed
+by /[Bbc]*.
The ``B'' flag compacts whitespace in the target, which must
contain at least one whitespace character.
-If the magic has "n" consecutive
-blanks, the target needs at least "n" consecutive blanks to match.
+If the magic has
+.I n
+consecutive blanks, the target needs at least
+.I n
+consecutive blanks to match.
The ``b'' flag treats every blank in the target as an optional blank.
-Finally the ``c''
-flag, specifies case insensitive matching: lowercase characters in the magic
-match both lower and upper case characters in the targer, whereas upper case
-characters in the magic, only much uppercase characters in the target.
+Finally the ``c'' flag, specifies case insensitive matching: lowercase
+characters in the magic match both lower and upper case characters in the
+targer, whereas upper case characters in the magic, only much uppercase
+characters in the target.
.IP date
A four-byte value interpreted as a UNIX date.
.IP ldate
@@ -61,7 +65,7 @@ A two-byte value (on most systems) in big-endian byte order.
A four-byte value (on most systems) in big-endian byte order.
.IP bedate
A four-byte value (on most systems) in big-endian byte order,
-interpreted as a unix date.
+interpreted as a Unix date.
.IP leshort
A two-byte value (on most systems) in little-endian byte order.
.IP lelong
@@ -76,7 +80,7 @@ than UTC.
.RE
.PP
The numeric types may optionally be followed by
-.B \*[Am]
+.B &
and a numeric value,
to specify that the value is to be AND'ed with the
numeric value before any comparisons are done.
@@ -85,7 +89,8 @@ Prepending a
to the type indicates that ordered comparisons should be unsigned.
.IP test
The value to be compared with the value from the file.
-If the type is numeric, this value
+If the type is
+numeric, this value
is specified in C form; if it is a string, it is specified as a C string
with the usual escapes permitted (e.g. \en for new-line).
.IP
@@ -94,17 +99,17 @@ may be preceded by a character indicating the operation to be performed.
It may be
.BR = ,
to specify that the value from the file must equal the specified value,
-.BR \*[Lt] ,
+.BR < ,
to specify that the value from the file must be less than the specified
value,
-.BR \*[Gt] ,
+.BR > ,
to specify that the value from the file must be greater than the specified
value,
-.BR \*[Am] ,
-to specify that the value from the file must have set all of the bits
+.BR & ,
+to specify that the value from the file must have set all of the bits
that are set in the specified value,
.BR ^ ,
-to specify that the value from the file must have clear any of the bits
+to specify that the value from the file must have clear any of the bits
that are set in the specified value, or
.BR x ,
to specify that any value will match.
@@ -120,24 +125,24 @@ is octal, and
is hexadecimal.
.IP
For string values, the byte string from the
-file must match the specified byte string.
+file must match the specified byte string.
The operators
.BR = ,
-.B \*[Lt]
+.B <
and
-.B \*[Gt]
+.B >
(but not
-.BR \*[Am] )
+.BR & )
can be applied to strings.
The length used for matching is that of the string argument
in the magic file.
This means that a line can match any string, and
then presumably print that string, by doing
-.B \*[Gt]\e0
+.B >\e0
(because all strings are greater than the null string).
.IP message
-The message to be printed if the comparison succeeds.
-If the string contains a
+The message to be printed if the comparison succeeds. If the string
+contains a
.BR printf (3)
format specification, the value from the file (with any specified masking
performed) is printed using the message as the format string.
@@ -145,12 +150,12 @@ performed) is printed using the message as the format string.
Some file formats contain additional information which is to be printed
along with the file type.
A line which begins with the character
-.B \*[Gt]
+.B >
indicates additional tests and messages to be printed.
The number of
-.B \*[Gt]
+.B >
on the line indicates the level of the test; a line with no
-.B \*[Gt]
+.B >
at the beginning is considered to be at level 0.
Each line at level
.IB n \(pl1
@@ -166,7 +171,7 @@ The next line at level
.I n
terminates this.
If the first character following the last
-.B \*[Gt]
+.B >
is a
.B (
then the string after the parenthesis is interpreted as an indirect offset.
@@ -175,12 +180,12 @@ the file.
The value at that offset is read, and is used again as an offset
in the file.
Indirect offsets are of the form:
-.BI (( x [.[bslBSL]][+-][ y ]).
-The value of
+.BI (( x [.[bslBSL]][+\-][ y ]).
+The value of
.I x
-is used as an offset in the file.
-A byte, short or long is read at that offset depending on the
-.B [bslBSL]
+is used as an offset in the file. A byte, short or long is read at that offset
+depending on the
+.B [bslBSL]
type specifier.
The capitalized types interpret the number as a big endian
value, whereas the small letter versions interpret the number as a little
@@ -194,14 +199,14 @@ Sometimes you do not know the exact offset as this depends on the length of
preceding fields.
You can specify an offset relative to the end of the
last uplevel field (of course this may only be done for sublevel tests, i.e.
-test beginning with
-.B \*[Gt]
+test beginning with
+.B >
).
Such a relative offset is specified using
-.B \*[Am]
+.B &
as a prefix to the offset.
.SH BUGS
-The formats
+The formats
.IR long ,
.IR belong ,
.IR lelong ,
@@ -213,7 +218,7 @@ The formats
and
.I ledate
are system-dependent; perhaps they should be specified as a number
-of bytes (2B, 4B, etc),
+of bytes (2B, 4B, etc),
since the files being recognized typically come from
a system on which the lengths are invariant.
.PP
@@ -226,13 +231,13 @@ indirect offsets.
.\" From: guy@sun.uucp (Guy Harris)
.\" Newsgroups: net.bugs.usg
.\" Subject: /etc/magic's format isn't well documented
-.\" Message-ID: \*[Lt]2752@sun.uucp\*[Gt]
+.\" Message-ID: <2752@sun.uucp>
.\" Date: 3 Sep 85 08:19:07 GMT
.\" Organization: Sun Microsystems, Inc.
.\" Lines: 136
-.\"
+.\"
.\" Here's a manual page for the format accepted by the "file" made by adding
.\" the changes I posted to the S5R2 version.
.\"
.\" Modified for Ian Darwin's version of the file command.
-.\" @(#)$Id: magic.man,v 1.21 2003/02/27 20:47:46 christos Exp $
+.\" @(#)$Id: magic.man,v 1.27 2003/09/12 19:43:30 christos Exp $
diff --git a/contrib/file/magic.mime b/contrib/file/magic.mime
index c9ae6ba..d314c4f 100644
--- a/contrib/file/magic.mime
+++ b/contrib/file/magic.mime
@@ -11,10 +11,103 @@
# Localstuff: file(1) magic for locally observed files
# Add any locally observed files here.
+# Real Audio (Magic .ra\0375)
+0 belong 0x2e7261fd audio/x-pn-realaudio
+0 string .RMF application/vnd.rn-realmedia
+
+#video/x-pn-realvideo
+#video/vnd.rn-realvideo
+#application/vnd.rn-realmedia
+# sigh, there are many mimes for that but the above are the most common.
+
+# Taken from magic, converted to magic.mime
+# mime types according to http://www.geocities.com/nevilo/mod.htm:
+# audio/it .it
+# audio/x-zipped-it .itz
+# audio/xm fasttracker modules
+# audio/x-s3m screamtracker modules
+# audio/s3m screamtracker modules
+# audio/x-zipped-mod mdz
+# audio/mod mod
+# audio/x-mod All modules (mod, s3m, 669, mtm, med, xm, it, mdz, stm, itz, xmz, s3z)
+
+# Taken from loader code from mikmod version 2.14
+# by Steve McIntyre (stevem@chiark.greenend.org.uk)
+# <doj@cubic.org> added title printing on 2003-06-24
+0 string MAS_UTrack_V00
+>14 string >/0 audio/x-mod
+#audio/x-tracker-module
+
+#0 string UN05 MikMod UNI format module sound data
+
+0 string Extended\ Module: audio/x-mod
+#audio/x-tracker-module
+##>17 string >\0 Title: "%s"
+
+21 string/c !SCREAM! audio/x-mod
+#audio/x-screamtracker-module
+21 string BMOD2STM audio/x-mod
+#audio/x-screamtracker-module
+1080 string M.K. audio/x-mod
+#audio/x-protracker-module
+#>0 string >\0 Title: "%s"
+1080 string M!K! audio/x-mod
+#audio/x-protracker-module
+#>0 string >\0 Title: "%s"
+1080 string FLT4 audio/x-mod
+#audio/x-startracker-module
+#>0 string >\0 Title: "%s"
+1080 string FLT8 audio/x-mod
+#audio/x-startracker-module
+#>0 string >\0 Title: "%s"
+1080 string 4CHN audio/x-mod
+#audio/x-fasttracker-module
+#>0 string >\0 Title: "%s"
+1080 string 6CHN audio/x-mod
+#audio/x-fasttracker-module
+#>0 string >\0 Title: "%s"
+1080 string 8CHN audio/x-mod
+#audio/x-fasttracker-module
+#>0 string >\0 Title: "%s"
+1080 string CD81 audio/x-mod
+#audio/x-oktalyzer-tracker-module
+#>0 string >\0 Title: "%s"
+1080 string OKTA audio/x-mod
+#audio/x-oktalyzer-tracker-module
+#>0 string >\0 Title: "%s"
+# Not good enough.
+#1082 string CH
+#>1080 string >/0 %.2s-channel Fasttracker "oktalyzer" module sound data
+1080 string 16CN audio/x-mod
+#audio/x-taketracker-module
+#>0 string >\0 Title: "%s"
+1080 string 32CN audio/x-mod
+#audio/x-taketracker-module
+#>0 string >\0 Title: "%s"
+
+# Impuse tracker module (it)
+0 string IMPM audio/x-mod
+#>4 string >\0 "%s"
+#>40 leshort !0 compatible w/ITv%x
+#>42 leshort !0 created w/ITv%x
+
#------------------------------------------------------------------------------
# end local stuff
#------------------------------------------------------------------------------
+# xml based formats!
+
+# svg
+
+0 string \<?xml
+# text/xml
+>38 string \<\!DOCTYPE\040svg image/svg+xml
+
+
+# xml
+0 string \<?xml text/xml
+
+
#------------------------------------------------------------------------------
# Java
@@ -61,6 +154,8 @@
# IFF/8SVX audio data
8 string 8SVX audio/x-aiff
+
+
# Creative Labs AUDIO stuff
# Standard MIDI data
0 string MThd audio/unknown
@@ -92,13 +187,15 @@
>8 string AVI video/x-msvideo
#
0 belong 0x2e7261fd application/x-realaudio
+>8 string CDRA image/x-coreldraw
+
# MPEG Layer 3 sound files
0 beshort &0xffe0 audio/mpeg
#MP3 with ID3 tag
0 string ID3 audio/mpeg
# Ogg/Vorbis
-0 string OggS audio/x-ogg
+0 string OggS application/ogg
#------------------------------------------------------------------------------
# c-lang: file(1) magic for C programs or various scripts
@@ -143,6 +240,8 @@
#
# zsh/ash/ae/nawk/gawk magic from cameron@cs.unsw.oz.au (Cameron Simpson)
+0 string #!/bin/zsh application/x-shellscript
+0 string #!/usr/bin/zsh application/x-shellscript
0 string #!/usr/local/bin/zsh application/x-shellscript
0 string #!\ /usr/local/bin/zsh application/x-shellscript
0 string #!/usr/local/bin/ash application/x-shellscript
@@ -198,6 +297,9 @@
0 string PK\003\004 application/x-zip
+# RAR archiver (Greg Roelofs, newt@uchicago.edu)
+0 string Rar! application/x-rar
+
# According to gzip.h, this is the correct byte order for packed data.
0 string \037\036 application/octet-stream
#
@@ -253,7 +355,7 @@
0 lelong&0x8080ffff 0x0000041a application/x-arc squeezed
0 lelong&0x8080ffff 0x0000061a application/x-arc crunched
-0 leshort 0xea60 application/octet-stream x-arj
+0 leshort 0xea60 application/x-arj
# LHARC/LHA archiver (Greg Roelofs, newt@uchicago.edu)
2 string -lh0- application/x-lharc lh0
@@ -304,6 +406,7 @@
0 string \<!doctype\ HTML text/html
0 string \<!DOCTYPE\ HTML text/html
0 string \<!doctype\ html text/html
+0 string \<!doctype\ HTML text/html
#------------------------------------------------------------------------------
# images: file(1) magic for image formats (see also "c-lang" for XPM bitmaps)
@@ -376,6 +479,18 @@
#0 string CP color pointer
#0 string BA bitmap array
+# CDROM Filesystems
+32769 string CD001 application/x-iso9660
+
+# Newer StuffIt archives (grant@netbsd.org)
+0 string StuffIt application/x-stuffit
+#>162 string >0 : %s
+
+# BinHex is the Macintosh ASCII-encoded file format (see also "apple")
+# Daniel Quinlan, quinlan@yggdrasil.com
+11 string must\ be\ converted\ with\ BinHex\ 4 application/mac-binhex40
+##>41 string x \b, version %.3s
+
#------------------------------------------------------------------------------
# lisp: file(1) magic for lisp programs
@@ -397,6 +512,7 @@
0 string Forward\ to message/rfc822 7bit
0 string Pipe\ to message/rfc822 7bit
0 string Return-Path: message/rfc822 7bit
+0 string Received: message/rfc822
0 string Path: message/news 8bit
0 string Xref: message/news 8bit
0 string From: message/rfc822 7bit
@@ -456,8 +572,8 @@
#>34 string >\0 (%s)
# Texinfo and GNU Info, from Daniel Quinlan (quinlan@yggdrasil.com)
-#0 string \\input\ texinfo Texinfo source text
-#0 string This\ is\ Info\ file GNU Info text
+0 string \\input\ texinfo text/x-texinfo
+0 string This\ is\ Info\ file text/x-info
# correct TeX magic for Linux (and maybe more)
# from Peter Tobias (tobias@server.et-inf.fho-emden.de)
@@ -543,9 +659,249 @@
# MNG Video Format, <URL:http://www.libpng.org/pub/mng/spec/>
0 string \x8aMNG video/x-mng
+0 string \x8aJNG video/x-jng
#------------------------------------------------------------------------------
# Hierarchical Data Format, used to facilitate scientific data exchange
# specifications at http://hdf.ncsa.uiuc.edu/
0 belong 0x0e031301 Hierarchical Data Format (version 4) data
0 string \211HDF\r\n\032 Hierarchical Data Format (version 5) data
+
+# Adobe Photoshop
+0 string 8BPS image/x-photoshop
+
+# Felix von Leitner <felix-file@fefe.de>
+0 string d8:announce application/x-bittorrent
+
+
+# lotus 1-2-3 document
+0 belong 0x00001a00 application/x-123
+0 belong 0x00000200 application/x-123
+
+# MS Access database
+4 string Standard\ Jet\ DB application/msaccess
+
+## magic for XBase files
+#0 byte 0x02
+#>8 leshort >0
+#>>12 leshort 0 application/x-dbf
+#
+#0 byte 0x03
+#>8 leshort >0
+#>>12 leshort 0 application/x-dbf
+#
+#0 byte 0x04
+#>8 leshort >0
+#>>12 leshort 0 application/x-dbf
+#
+#0 byte 0x05
+#>8 leshort >0
+#>>12 leshort 0 application/x-dbf
+#
+#0 byte 0x30
+#>8 leshort >0
+#>>12 leshort 0 application/x-dbf
+#
+#0 byte 0x43
+#>8 leshort >0
+#>>12 leshort 0 application/x-dbf
+#
+#0 byte 0x7b
+#>8 leshort >0
+#>>12 leshort 0 application/x-dbf
+#
+#0 byte 0x83
+#>8 leshort >0
+#>>12 leshort 0 application/x-dbf
+#
+#0 byte 0x8b
+#>8 leshort >0
+#>>12 leshort 0 application/x-dbf
+#
+#0 byte 0x8e
+#>8 leshort >0
+#>>12 leshort 0 application/x-dbf
+#
+#0 byte 0xb3
+#>8 leshort >0
+#>>12 leshort 0 application/x-dbf
+#
+#0 byte 0xf5
+#>8 leshort >0
+#>>12 leshort 0 application/x-dbf
+#
+#0 leshort 0x0006 application/x-dbt
+
+# Debian has entries for the old PGP formats:
+# pgp: file(1) magic for Pretty Good Privacy
+# see http://lists.gnupg.org/pipermail/gnupg-devel/1999-September/016052.html
+0 beshort 0x9900 text/PGP key public ring
+0 beshort 0x9501 text/PGP key security ring
+0 beshort 0x9500 text/PGP key security ring
+0 beshort 0xa600 text/PGP encrypted data
+0 string -----BEGIN\040PGP text/PGP armored data
+>15 string PUBLIC\040KEY\040BLOCK- public key block
+>15 string MESSAGE- message
+>15 string SIGNED\040MESSAGE- signed message
+>15 string PGP\040SIGNATURE- signature
+0 beshort 0x8501 data
+#
+# GnuPG Magic:
+#
+0 beshort 0x9901 text/GnuPG key public ring
+0 beshort 0x8501 text/OpenPGP data
+
+# flash: file(1) magic for Macromedia Flash file format
+#
+# See
+#
+# http://www.macromedia.com/software/flash/open/
+#
+0 string FWS
+>3 byte x application/x-shockwave-flash
+
+# The following paramaters are created for Namazu.
+# <http://www.namazu.org/>
+#
+# 1999/08/13
+#0 string \<!--\ MHonArc text/html; x-type=mhonarc
+0 string BZh application/x-bzip2
+
+# 1999/09/09
+# VRML (suggested by Masao Takaku)
+0 string #VRML\ V1.0\ ascii model/vrml
+0 string #VRML\ V2.0\ utf8 model/vrml
+
+#------------------------------------------------------------------------------
+# ichitaro456: file(1) magic for Just System Word Processor Ichitaro
+#
+# Contributor kenzo-:
+# Reversed-engineered JS Ichitaro magic numbers
+#
+
+0 string DOC
+>43 byte 0x14 application/ichitaro4
+>144 string JDASH application/ichitaro4
+
+0 string DOC
+>43 byte 0x15 application/ichitaro5
+
+0 string DOC
+>43 byte 0x16 application/ichitaro6
+
+#------------------------------------------------------------------------------
+# office97: file(1) magic for MicroSoft Office files
+#
+# Contributor kenzo-:
+# Reversed-engineered MS Office magic numbers
+#
+
+#0 string \320\317\021\340\241\261\032\341
+#>48 byte 0x1B application/excel
+
+2080 string Microsoft\ Excel\ 5.0\ Worksheet application/excel
+2114 string Biff5 application/excel
+
+0 string \224\246\056 application/msword
+
+0 belong 0x31be0000 application/msword
+
+0 string PO^Q` application/msword
+
+0 string \320\317\021\340\241\261\032\341
+>546 string bjbj application/msword
+>546 string jbjb application/msword
+
+512 string R\0o\0o\0t\0\ \0E\0n\0t\0r\0y application/msword
+
+2080 string Microsoft\ Word\ 6.0\ Document application/msword
+2080 string Documento\ Microsoft\ Word\ 6 application/msword
+2112 string MSWordDoc application/msword
+
+#0 string \320\317\021\340\241\261\032\341 application/powerpoint
+0 string \320\317\021\340\241\261\032\341 application/msword
+
+0 string #\ PaCkAgE\ DaTaStReAm application/x-svr4-package
+
+
+# WinNT/WinCE PE files (Warner Losh, imp@village.org)
+#
+128 string PE\000\000 application/octet-stream
+0 string PE\000\000 application/octet-stream
+
+# miscellaneous formats
+0 string LZ application/octet-stream
+
+
+# .EXE formats (Greg Roelofs, newt@uchicago.edu)
+#
+0 string MZ
+>24 string @ application/octet-stream
+
+0 string MZ
+>30 string Copyright\ 1989-1990\ PKWARE\ Inc. application/x-zip
+
+0 string MZ
+>30 string PKLITE\ Copr. application/x-zip
+
+0 string MZ
+>36 string LHa's\ SFX application/x-lha
+
+0 string MZ application/octet-stream
+
+# LHA archiver
+2 string -lh
+>6 string - application/x-lha
+
+
+# Zoo archiver
+20 lelong 0xfdc4a7dc application/x-zoo
+
+# ARC archiver
+0 lelong&0x8080ffff 0x0000081a application/x-arc
+0 lelong&0x8080ffff 0x0000091a application/x-arc
+0 lelong&0x8080ffff 0x0000021a application/x-arc
+0 lelong&0x8080ffff 0x0000031a application/x-arc
+0 lelong&0x8080ffff 0x0000041a application/x-arc
+0 lelong&0x8080ffff 0x0000061a application/x-arc
+
+# Microsoft Outlook's Transport Neutral Encapsulation Format (TNEF)
+0 lelong 0x223e9f78 application/ms-tnef
+
+
+#
+# QuickTime format
+# Contributer: Peter Breton
+#
+
+0 string MOVI video/quicktime
+4 string moov video/quicktime
+4 string mdat video/quicktime
+
+# Video Formate
+0 string RIFF
+# AVI == Audio Video Interleave
+>8 string AVI\
+#>0xbc string >\0 video/x-%s
+
+>>0xbc string DIV3 video/x-DivX-3
+>>0xbc string div3 video/x-divX-3
+>>0xbc string DIV4 video/x-DivX-4
+>>0x70 string DX50 video/x-DIVX-5
+>>0x70 string MP4 video/x-MPEG-4
+>>0xbc string DIVX video/x-DivX
+>8 string WAVE audio/x-wav
+
+# From: stephane.loeuillet@tiscali.f
+# http://www.djvuzone.org/
+0 string AT&TFORM image/x.djvu
+
+# Danny Milosavljevic <danny.milo@gmx.net>
+# this are adrift (adventure game standard) game files, extension .taf
+# depending on version magic continues with 0x93453E6139FA (V 4.0)
+# 0x9445376139FA (V 3.90)
+# 0x9445366139FA (V 3.80)
+# this is from source (http://www.adrift.org.uk/) and I have some taf
+# files, and checked them.
+#0 belong 0x3C423FC9
+#>4 belong 0x6A87C2CF application/x-adrift
diff --git a/contrib/file/magic2mime b/contrib/file/magic2mime
index 9c6b4ec..c83ee59 100755
--- a/contrib/file/magic2mime
+++ b/contrib/file/magic2mime
@@ -1,6 +1,6 @@
#! /usr/local/bin/perl
# -*- PERL -*-
-# $Id: magic2mime,v 1.1 1998/02/15 23:18:53 christos Exp $
+# $Id: magic2mime,v 1.2 2003/03/23 04:17:27 christos Exp $
# Copyright (c) 1996, 1997 vax@linkdead.paranoia.com (VaX#n8)
#
# Usage: echo 'your-file-output-here' | file_to_ctype.pl
diff --git a/contrib/file/names.h b/contrib/file/names.h
index ea4e85c..ad93280 100644
--- a/contrib/file/names.h
+++ b/contrib/file/names.h
@@ -1,16 +1,43 @@
/*
+ * Copyright (c) Ian F. Darwin 1986-1995.
+ * Software written by Ian F. Darwin and others;
+ * maintained 1995-present by Christos Zoulas and others.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice immediately at the beginning of the file, without modification,
+ * this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Ian F. Darwin and others.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+/*
* Names.h - names and types used by ascmagic in file(1).
* These tokens are here because they can appear anywhere in
* the first HOWMANY bytes, while tokens in MAGIC must
* appear at fixed offsets into the file. Don't make HOWMANY
* too high unless you have a very fast CPU.
*
- * Copyright (c) Ian F. Darwin, 1987.
- * Written by Ian F. Darwin.
- *
- * See LEGAL.NOTICE
- *
- * $Id: names.h,v 1.19 2002/05/16 15:01:41 christos Exp $
+ * $Id: names.h,v 1.24 2004/03/22 19:09:12 christos Exp $
*/
/*
@@ -33,10 +60,11 @@
#define L_HTML 11 /* HTML */
#define L_BCPL 12 /* BCPL */
#define L_M4 13 /* M4 */
+#define L_PO 14 /* PO */
static const struct {
- char *human;
- char *mime;
+ const char *human;
+ const char *mime;
} types[] = {
{ "C program", "text/x-c", },
{ "C++ program", "text/x-c++" },
@@ -44,7 +72,7 @@ static const struct {
{ "make commands", "text/x-makefile" },
{ "PL/1 program", "text/x-pl1" },
{ "assembler program", "text/x-asm" },
- { "English", "text/plain, English" },
+ { "English", "text/plain" },
{ "Pascal program", "text/x-pascal" },
{ "mail", "text/x-mail" },
{ "news", "text/x-news" },
@@ -52,7 +80,8 @@ static const struct {
{ "HTML document", "text/html", },
{ "BCPL program", "text/x-bcpl" },
{ "M4 macro language pre-processor", "text/x-m4" },
- { "can't happen error on names.h/types", "error/x-error" },
+ { "PO (gettext message catalogue)", "text/x-po" },
+ { "cannot happen error on names.h/types", "error/x-error" },
{ 0, 0}
};
@@ -98,6 +127,7 @@ static struct names {
} names[] = {
/* These must be sorted by eye for optimal hit rate */
/* Add to this list only after substantial meditation */
+ {"msgid", L_PO},
{"dnl", L_M4},
{"import", L_JAVA},
{"\"libhdr\"", L_BCPL},
@@ -154,6 +184,8 @@ static struct names {
{"HREF=", L_HTML},
{"<body", L_HTML},
{"<BODY", L_HTML},
+ {"<html", L_HTML},
+ {"<HTML", L_HTML},
{NULL, 0}
};
#define NNAMES ((sizeof(names)/sizeof(struct names)) - 1)
diff --git a/contrib/file/patchlevel.h b/contrib/file/patchlevel.h
index bec3067..e5e1b01 100644
--- a/contrib/file/patchlevel.h
+++ b/contrib/file/patchlevel.h
@@ -1,11 +1,54 @@
-#define FILE_VERSION_MAJOR 3
-#define patchlevel 41
+#define FILE_VERSION_MAJOR 4
+#define patchlevel 10
/*
* Patchlevel file for Ian Darwin's MAGIC command.
- * $Id: patchlevel.h,v 1.41 2003/02/27 20:53:45 christos Exp $
+ * $Id: patchlevel.h,v 1.53 2004/07/24 20:40:46 christos Exp $
*
* $Log: patchlevel.h,v $
+ * Revision 1.53 2004/07/24 20:40:46 christos
+ * welcome to 4.10
+ *
+ * Revision 1.52 2004/04/07 00:32:25 christos
+ * welcome to 4.09
+ *
+ * Revision 1.51 2004/03/22 21:17:11 christos
+ * welcome to 4.08.
+ *
+ * Revision 1.50 2003/12/23 17:34:04 christos
+ * 4.07
+ *
+ * Revision 1.49 2003/10/15 02:08:27 christos
+ * welcome to 4.06
+ *
+ * Revision 1.48 2003/09/12 19:41:14 christos
+ * this is 4.04
+ *
+ * Revision 1.47 2003/05/23 21:38:21 christos
+ * welcome to 4.03
+ *
+ * Revision 1.46 2003/04/02 18:57:43 christos
+ * prepare for 4.02
+ *
+ * Revision 1.45 2003/03/26 15:37:25 christos
+ * - Pass lint
+ * - make NULL in magic_file mean stdin
+ * - Fix "-" argument to file to pass NULL to magic_file
+ * - avoid pointer casts by using memcpy
+ * - rename magic_buf -> magic_buffer
+ * - keep only the first error
+ * - manual page: new sentence, new line
+ * - fix typo in api function (magic_buf -> magic_buffer)
+ *
+ * Revision 1.44 2003/03/23 22:23:31 christos
+ * finish librarification.
+ *
+ * Revision 1.43 2003/03/23 21:16:26 christos
+ * update copyrights.
+ *
+ * Revision 1.42 2003/03/23 04:06:05 christos
+ * Library re-organization
+ *
* Revision 1.41 2003/02/27 20:53:45 christos
* - fix memory allocation problem (Jeff Johnson)
* - fix stack overflow corruption (David Endler)
diff --git a/contrib/file/print.c b/contrib/file/print.c
index 0b1a0e4..ee1926d 100644
--- a/contrib/file/print.c
+++ b/contrib/file/print.c
@@ -1,31 +1,42 @@
/*
+ * Copyright (c) Ian F. Darwin 1986-1995.
+ * Software written by Ian F. Darwin and others;
+ * maintained 1995-present by Christos Zoulas and others.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice immediately at the beginning of the file, without modification,
+ * this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Ian F. Darwin and others.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+/*
* print.c - debugging printout routines
- *
- * Copyright (c) Ian F. Darwin, 1987.
- * Written by Ian F. Darwin.
- *
- * 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.
*/
#include "file.h"
+#include <stdio.h>
+#include <errno.h>
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
@@ -35,21 +46,21 @@
#include <time.h>
#ifndef lint
-FILE_RCSID("@(#)$Id: print.c,v 1.39 2002/07/09 15:46:23 christos Exp $")
+FILE_RCSID("@(#)$Id: print.c,v 1.44 2003/09/12 19:39:44 christos Exp $")
#endif /* lint */
#define SZOF(a) (sizeof(a) / sizeof(a[0]))
#ifndef COMPILE_ONLY
-void
-mdump(struct magic *m)
+protected void
+file_mdump(struct magic *m)
{
- static const char *typ[] = { "invalid", "byte", "short", "invalid",
+ private const char *typ[] = { "invalid", "byte", "short", "invalid",
"long", "string", "date", "beshort",
"belong", "bedate", "leshort", "lelong",
"ledate", "pstring", "ldate", "beldate",
"leldate", "regex" };
- static const char optyp[] = { '@', '&', '|', '^', '+', '-',
+ private const char optyp[] = { '@', '&', '|', '^', '+', '-',
'*', '/', '%' };
(void) fputc('[', stderr);
(void) fprintf(stderr, ">>>>>>>> %d" + 8 - (m->cont_level & 7),
@@ -60,7 +71,7 @@ mdump(struct magic *m)
/* Note: type is unsigned */
(m->in_type < SZOF(typ)) ?
typ[m->in_type] : "*bad*");
- if (m->in_op & OPINVERSE)
+ if (m->in_op & FILE_OPINVERSE)
(void) fputc('~', stderr);
(void) fprintf(stderr, "%c%d),",
((m->in_op&0x7F) < SZOF(optyp)) ?
@@ -70,13 +81,14 @@ mdump(struct magic *m)
(void) fprintf(stderr, " %s%s", (m->flag & UNSIGNED) ? "u" : "",
/* Note: type is unsigned */
(m->type < SZOF(typ)) ? typ[m->type] : "*bad*");
- if (m->mask_op & OPINVERSE)
+ if (m->mask_op & FILE_OPINVERSE)
(void) fputc('~', stderr);
if (m->mask) {
- ((m->mask_op&0x7F) < SZOF(optyp)) ?
- (void) fputc(optyp[m->mask_op&0x7F], stderr) :
- (void) fputc('?', stderr);
- if(STRING != m->type || PSTRING != m->type)
+ if ((m->mask_op & 0x7F) < SZOF(optyp))
+ fputc(optyp[m->mask_op&0x7F], stderr);
+ else
+ fputc('?', stderr);
+ if(FILE_STRING != m->type || FILE_PSTRING != m->type)
(void) fprintf(stderr, "%.8x", m->mask);
else {
if (m->mask & STRING_IGNORE_LOWERCASE)
@@ -93,29 +105,31 @@ mdump(struct magic *m)
if (m->reln != 'x') {
switch (m->type) {
- case BYTE:
- case SHORT:
- case LONG:
- case LESHORT:
- case LELONG:
- case BESHORT:
- case BELONG:
+ case FILE_BYTE:
+ case FILE_SHORT:
+ case FILE_LONG:
+ case FILE_LESHORT:
+ case FILE_LELONG:
+ case FILE_BESHORT:
+ case FILE_BELONG:
(void) fprintf(stderr, "%d", m->value.l);
break;
- case STRING:
- case PSTRING:
- case REGEX:
- showstr(stderr, m->value.s, -1);
+ case FILE_STRING:
+ case FILE_PSTRING:
+ case FILE_REGEX:
+ file_showstr(stderr, m->value.s, ~0U);
break;
- case DATE:
- case LEDATE:
- case BEDATE:
- (void)fprintf(stderr, "%s,", fmttime(m->value.l, 1));
+ case FILE_DATE:
+ case FILE_LEDATE:
+ case FILE_BEDATE:
+ (void)fprintf(stderr, "%s,",
+ file_fmttime(m->value.l, 1));
break;
- case LDATE:
- case LELDATE:
- case BELDATE:
- (void)fprintf(stderr, "%s,", fmttime(m->value.l, 0));
+ case FILE_LDATE:
+ case FILE_LELDATE:
+ case FILE_BELDATE:
+ (void)fprintf(stderr, "%s,",
+ file_fmttime(m->value.l, 0));
break;
default:
(void) fputs("*bad*", stderr);
@@ -126,72 +140,24 @@ mdump(struct magic *m)
}
#endif
-/*
- * ckfputs - fputs, but with error checking
- * ckfprintf - fprintf, but with error checking
- */
-void
-ckfputs(const char *str, FILE *fil)
-{
- if (fputs(str,fil) == EOF)
- error("write failed.\n");
-}
-
-/*VARARGS*/
-void
-ckfprintf(FILE *f, const char *fmt, ...)
-{
- va_list va;
-
- va_start(va, fmt);
- (void) vfprintf(f, fmt, va);
- if (ferror(f))
- error("write failed.\n");
- va_end(va);
-}
-
-/*
- * error - print best error message possible and exit
- */
/*VARARGS*/
-void
-error(const char *f, ...)
+protected void
+file_magwarn(const char *f, ...)
{
va_list va;
-
va_start(va, f);
- /* cuz we use stdout for most, stderr here */
- (void) fflush(stdout);
-
- if (progname != NULL)
- (void) fprintf(stderr, "%s: ", progname);
- (void) vfprintf(stderr, f, va);
- va_end(va);
- exit(1);
-}
-/*VARARGS*/
-void
-magwarn(const char *f, ...)
-{
- va_list va;
-
- va_start(va, f);
/* cuz we use stdout for most, stderr here */
(void) fflush(stdout);
- if (progname != NULL)
- (void) fprintf(stderr, "%s: %s, %d: ",
- progname, magicfile, lineno);
+ (void) fprintf(stderr, "WARNING: ");
(void) vfprintf(stderr, f, va);
va_end(va);
fputc('\n', stderr);
}
-
-#ifndef COMPILE_ONLY
-char *
-fmttime(long v, int local)
+protected char *
+file_fmttime(uint32_t v, int local)
{
char *pp, *rt;
time_t t = (time_t)v;
@@ -201,9 +167,9 @@ fmttime(long v, int local)
pp = ctime(&t);
} else {
#ifndef HAVE_DAYLIGHT
- static int daylight = 0;
+ private int daylight = 0;
#ifdef HAVE_TM_ISDST
- static time_t now = (time_t)0;
+ private time_t now = (time_t)0;
if (now == (time_t)0) {
struct tm *tm1;
@@ -223,4 +189,3 @@ fmttime(long v, int local)
*rt = '\0';
return pp;
}
-#endif
diff --git a/contrib/file/readelf.c b/contrib/file/readelf.c
index 2259558..ccfa491 100644
--- a/contrib/file/readelf.c
+++ b/contrib/file/readelf.c
@@ -1,3 +1,31 @@
+/*
+ * Copyright (c) Christos Zoulas 2003.
+ * All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice immediately at the beginning of the file, without modification,
+ * this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
#include "file.h"
#ifdef BUILTIN_ELF
@@ -11,20 +39,24 @@
#include "readelf.h"
#ifndef lint
-FILE_RCSID("@(#)$Id: readelf.c,v 1.26 2003/02/25 15:30:00 christos Exp $")
+FILE_RCSID("@(#)$Id: readelf.c,v 1.42 2004/07/24 20:57:22 christos Exp $")
#endif
#ifdef ELFCORE
-static void dophn_core(int, int, int, off_t, int, size_t);
+private int dophn_core(struct magic_set *, int, int, int, off_t, int, size_t);
#endif
-static void dophn_exec(int, int, int, off_t, int, size_t);
-static void doshn(int, int, int, off_t, int, size_t);
+private int dophn_exec(struct magic_set *, int, int, int, off_t, int, size_t);
+private int doshn(struct magic_set *, int, int, int, off_t, int, size_t);
+private size_t donote(struct magic_set *, unsigned char *, size_t, size_t, int,
+ int, size_t);
-static uint16_t getu16(int, uint16_t);
-static uint32_t getu32(int, uint32_t);
-static uint64_t getu64(int, uint64_t);
+#define ELF_ALIGN(a) ((((a) + align - 1) / align) * align)
-static uint16_t
+private uint16_t getu16(int, uint16_t);
+private uint32_t getu32(int, uint32_t);
+private uint64_t getu64(int, uint64_t);
+
+private uint16_t
getu16(int swap, uint16_t value)
{
union {
@@ -43,7 +75,7 @@ getu16(int swap, uint16_t value)
return value;
}
-static uint32_t
+private uint32_t
getu32(int swap, uint32_t value)
{
union {
@@ -64,7 +96,7 @@ getu32(int swap, uint32_t value)
return value;
}
-static uint64_t
+private uint64_t
getu64(int swap, uint64_t value)
{
union {
@@ -110,205 +142,33 @@ getu64(int swap, uint64_t value)
#define ph_offset (class == ELFCLASS32 \
? getu32(swap, ph32.p_offset) \
: getu64(swap, ph64.p_offset))
-#define ph_align (class == ELFCLASS32 \
- ? (ph32.p_align ? getu32(swap, ph32.p_align) : 4) \
- : (ph64.p_align ? getu64(swap, ph64.p_align) : 4))
+#define ph_align (size_t)((class == ELFCLASS32 \
+ ? (off_t) (ph32.p_align ? \
+ getu32(swap, ph32.p_align) : 4) \
+ : (off_t) (ph64.p_align ? \
+ getu64(swap, ph64.p_align) : 4)))
+#define ph_filesz (size_t)((class == ELFCLASS32 \
+ ? getu32(swap, ph32.p_filesz) \
+ : getu64(swap, ph64.p_filesz)))
+#define ph_memsz (size_t)((class == ELFCLASS32 \
+ ? getu32(swap, ph32.p_memsz) \
+ : getu64(swap, ph64.p_memsz)))
#define nh_size (class == ELFCLASS32 \
- ? sizeof *nh32 \
- : sizeof *nh64)
+ ? sizeof nh32 \
+ : sizeof nh64)
#define nh_type (class == ELFCLASS32 \
- ? getu32(swap, nh32->n_type) \
- : getu32(swap, nh64->n_type))
+ ? 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))
+ ? 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))
+ ? getu32(swap, nh32.n_descsz) \
+ : getu32(swap, nh64.n_descsz))
#define prpsoffsets(i) (class == ELFCLASS32 \
? prpsoffsets32[i] \
: prpsoffsets64[i])
-static void
-doshn(int class, int swap, int fd, off_t off, int num, size_t size)
-{
- Elf32_Shdr sh32;
- Elf64_Shdr sh64;
-
- if (size != sh_size)
- error("corrupted section header size.\n");
-
- if (lseek(fd, off, SEEK_SET) == -1)
- error("lseek failed (%s).\n", strerror(errno));
-
- for ( ; num; num--) {
- if (read(fd, sh_addr, sh_size) == -1)
- error("read failed (%s).\n", strerror(errno));
- if (shs_type == SHT_SYMTAB /* || shs_type == SHT_DYNSYM */) {
- (void) printf (", not stripped");
- return;
- }
- }
- (void) printf (", stripped");
-}
-
-/*
- * Look through the program headers of an executable image, searching
- * for a PT_INTERP section; if one is found, it's dynamically linked,
- * otherwise it's statically linked.
- */
-static void
-dophn_exec(int class, int swap, int fd, off_t off, int num, size_t size)
-{
- Elf32_Phdr ph32;
- Elf32_Nhdr *nh32 = NULL;
- Elf64_Phdr ph64;
- Elf64_Nhdr *nh64 = NULL;
- char *linking_style = "statically";
- char *shared_libraries = "";
- char nbuf[BUFSIZ];
- int bufsize;
- size_t offset, nameoffset;
- off_t savedoffset;
-
- if (size != ph_size)
- error("corrupted program header size.\n");
- if (lseek(fd, off, SEEK_SET) == -1)
- error("lseek failed (%s).\n", strerror(errno));
-
- for ( ; num; num--) {
- if (read(fd, ph_addr, ph_size) == -1)
- error("read failed (%s).\n", strerror(errno));
- if ((savedoffset = lseek(fd, 0, SEEK_CUR)) == -1)
- error("lseek failed (%s).\n", strerror(errno));
-
- switch (ph_type) {
- case PT_DYNAMIC:
- linking_style = "dynamically";
- break;
- case PT_INTERP:
- shared_libraries = " (uses shared libs)";
- break;
- case PT_NOTE:
- /*
- * This is a PT_NOTE section; loop through all the notes
- * in the section.
- */
- if (lseek(fd, (off_t) ph_offset, SEEK_SET) == -1)
- error("lseek failed (%s).\n", strerror(errno));
- bufsize = read(fd, nbuf, sizeof(nbuf));
- if (bufsize == -1)
- error(": " "read failed (%s).\n",
- strerror(errno));
- offset = 0;
- for (;;) {
- if (offset >= bufsize)
- break;
- if (class == ELFCLASS32)
- nh32 = (Elf32_Nhdr *)&nbuf[offset];
- else
- nh64 = (Elf64_Nhdr *)&nbuf[offset];
- offset += nh_size;
-
- if (offset + nh_namesz >= bufsize) {
- /*
- * We're past the end of the buffer.
- */
- break;
- }
-
- nameoffset = offset;
- offset += nh_namesz;
- offset = ((offset+ph_align-1)/ph_align)*ph_align;
-
- if ((nh_namesz == 0) && (nh_descsz == 0)) {
- /*
- * We're out of note headers.
- */
- break;
- }
-
- if (offset + nh_descsz >= bufsize)
- break;
-
- if (nh_namesz == 4 &&
- strcmp(&nbuf[nameoffset], "GNU") == 0 &&
- nh_type == NT_GNU_VERSION &&
- nh_descsz == 16) {
- uint32_t *desc =
- (uint32_t *)&nbuf[offset];
-
- printf(", for GNU/");
- switch (getu32(swap, desc[0])) {
- case GNU_OS_LINUX:
- printf("Linux");
- break;
- case GNU_OS_HURD:
- printf("Hurd");
- break;
- case GNU_OS_SOLARIS:
- printf("Solaris");
- break;
- default:
- printf("<unknown>");
- }
- printf(" %d.%d.%d",
- getu32(swap, desc[1]),
- getu32(swap, desc[2]),
- getu32(swap, desc[3]));
- }
-
- if (nh_namesz == 7 &&
- strcmp(&nbuf[nameoffset], "NetBSD") == 0 &&
- nh_type == NT_NETBSD_VERSION &&
- nh_descsz == 4) {
- printf(", for NetBSD");
- /*
- * Version number is stuck at 199905,
- * and hence is basically content-free.
- */
- }
-
- if (nh_namesz == 8 &&
- strcmp(&nbuf[nameoffset], "FreeBSD") == 0 &&
- nh_type == NT_FREEBSD_VERSION &&
- nh_descsz == 4) {
- uint32_t desc = getu32(swap,
- *(uint32_t *)&nbuf[offset]);
- printf(", for FreeBSD");
- /*
- * Contents is __FreeBSD_version,
- * whose relation to OS versions is
- * defined by a huge table in the
- * Porters' Handbook. Happily, the
- * first three digits are the version
- * number, at least in versions of
- * FreeBSD that use this note.
- */
-
- printf(" %d.%d", desc / 100000,
- desc / 10000 % 10);
- if (desc / 1000 % 10 > 0)
- printf(".%d",
- desc / 1000 % 10);
- }
-
- if (nh_namesz == 8 &&
- strcmp(&nbuf[nameoffset], "OpenBSD") == 0 &&
- nh_type == NT_OPENBSD_VERSION &&
- nh_descsz == 4) {
- printf(", for OpenBSD");
- /* Content of note is always 0 */
- }
- }
- if ((lseek(fd, savedoffset + offset, SEEK_SET)) == -1)
- error("lseek failed (%s).\n", strerror(errno));
- break;
- }
- }
- printf(", %s linked%s", linking_style, shared_libraries);
-}
-
#ifdef ELFCORE
size_t prpsoffsets32[] = {
8, /* FreeBSD */
@@ -351,36 +211,39 @@ size_t prpsoffsets64[] = {
#define OS_STYLE_FREEBSD 1
#define OS_STYLE_NETBSD 2
-static const char *os_style_names[] = {
+private const char *os_style_names[] = {
"SVR4",
"FreeBSD",
"NetBSD",
};
-static void
-dophn_core(int class, int swap, int fd, off_t off, int num, size_t size)
+private int
+dophn_core(struct magic_set *ms, int class, int swap, int fd, off_t off,
+ int num, size_t size)
{
Elf32_Phdr ph32;
- Elf32_Nhdr *nh32 = NULL;
Elf64_Phdr ph64;
- Elf64_Nhdr *nh64 = NULL;
- size_t offset, nameoffset, noffset, reloffset;
- unsigned char c;
- int i, j;
- char nbuf[BUFSIZ];
- int bufsize;
- int os_style = -1;
-
- if (size != ph_size)
- error("corrupted program header size.\n");
+ size_t offset;
+ unsigned char nbuf[BUFSIZ];
+ ssize_t bufsize;
+
+ if (size != ph_size) {
+ if (file_printf(ms, ", corrupted program header size") == -1)
+ return -1;
+ return 0;
+ }
/*
* Loop through all the program headers.
*/
for ( ; num; num--) {
- if (lseek(fd, off, SEEK_SET) == -1)
- error("lseek failed (%s).\n", strerror(errno));
- if (read(fd, ph_addr, ph_size) == -1)
- error("read failed (%s).\n", strerror(errno));
+ if (lseek(fd, off, SEEK_SET) == (off_t)-1) {
+ file_badseek(ms);
+ return -1;
+ }
+ if (read(fd, ph_addr, ph_size) == -1) {
+ file_badread(ms);
+ return -1;
+ }
off += size;
if (ph_type != PT_NOTE)
continue;
@@ -389,173 +252,478 @@ dophn_core(int class, int swap, int fd, off_t off, int num, size_t size)
* This is a PT_NOTE section; loop through all the notes
* in the section.
*/
- 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)
- error(": " "read failed (%s).\n", strerror(errno));
+ if (lseek(fd, (off_t) ph_offset, SEEK_SET) == (off_t)-1) {
+ file_badseek(ms);
+ return -1;
+ }
+ bufsize = read(fd, nbuf, sizeof(nbuf));
+ if (bufsize == -1) {
+ file_badread(ms);
+ return -1;
+ }
offset = 0;
for (;;) {
- if (offset >= bufsize)
+ if (offset >= (size_t)bufsize)
break;
- if (class == ELFCLASS32)
- nh32 = (Elf32_Nhdr *)&nbuf[offset];
- else
- nh64 = (Elf64_Nhdr *)&nbuf[offset];
- offset += nh_size;
-
- /*
- * Check whether this note has the name "CORE" or
- * "FreeBSD", or "NetBSD-CORE".
- */
- if (offset + nh_namesz >= bufsize) {
- /*
- * We're past the end of the buffer.
- */
+ offset = donote(ms, nbuf, offset, (size_t)bufsize,
+ class, swap, 4);
+ if (offset == 0)
break;
+
+ }
+ }
+ return 0;
+}
+#endif
+
+private size_t
+donote(struct magic_set *ms, unsigned char *nbuf, size_t offset, size_t size,
+ int class, int swap, size_t align)
+{
+ Elf32_Nhdr nh32;
+ Elf64_Nhdr nh64;
+ size_t noff, doff;
+#ifdef ELFCORE
+ int os_style = -1;
+#endif
+ uint32_t namesz, descsz;
+
+ if (class == ELFCLASS32)
+ memcpy(&nh32, &nbuf[offset], sizeof(nh32));
+ else
+ memcpy(&nh64, &nbuf[offset], sizeof(nh64));
+ offset += nh_size;
+
+ namesz = nh_namesz;
+ descsz = nh_descsz;
+ if ((namesz == 0) && (descsz == 0)) {
+ /*
+ * We're out of note headers.
+ */
+ return offset;
+ }
+
+ if (namesz & 0x80000000) {
+ (void)file_printf(ms, ", bad note name size 0x%lx",
+ (unsigned long)namesz);
+ return offset;
+ }
+
+ if (descsz & 0x80000000) {
+ (void)file_printf(ms, ", bad note description size 0x%lx",
+ (unsigned long)descsz);
+ return offset;
+ }
+
+
+ noff = offset;
+ doff = ELF_ALIGN(offset + namesz);
+
+ if (offset + namesz > size) {
+ /*
+ * We're past the end of the buffer.
+ */
+ return doff;
+ }
+
+ offset = ELF_ALIGN(doff + descsz);
+ if (offset + descsz > size) {
+ return offset;
+ }
+
+ if (namesz == 4 && strcmp((char *)&nbuf[noff], "GNU") == 0 &&
+ nh_type == NT_GNU_VERSION && descsz == 16) {
+ uint32_t desc[4];
+ (void)memcpy(desc, &nbuf[doff], sizeof(desc));
+
+ if (file_printf(ms, ", for GNU/") == -1)
+ return size;
+ switch (getu32(swap, desc[0])) {
+ case GNU_OS_LINUX:
+ if (file_printf(ms, "Linux") == -1)
+ return size;
+ break;
+ case GNU_OS_HURD:
+ if (file_printf(ms, "Hurd") == -1)
+ return size;
+ break;
+ case GNU_OS_SOLARIS:
+ if (file_printf(ms, "Solaris") == -1)
+ return size;
+ break;
+ default:
+ if (file_printf(ms, "<unknown>") == -1)
+ return size;
+ }
+ if (file_printf(ms, " %d.%d.%d", getu32(swap, desc[1]),
+ getu32(swap, desc[2]), getu32(swap, desc[3])) == -1)
+ return size;
+ return size;
+ }
+
+ if (namesz == 7 && strcmp((char *)&nbuf[noff], "NetBSD") == 0 &&
+ nh_type == NT_NETBSD_VERSION && descsz == 4) {
+ uint32_t desc;
+ (void)memcpy(&desc, &nbuf[doff], sizeof(desc));
+ desc = getu32(swap, desc);
+
+ if (file_printf(ms, ", for NetBSD") == -1)
+ return size;
+ /*
+ * The version number used to be stuck as 199905, and was thus
+ * basically content-free. Newer versions of NetBSD have fixed
+ * this and now use the encoding of __NetBSD_Version__:
+ *
+ * MMmmrrpp00
+ *
+ * M = major version
+ * m = minor version
+ * r = release ["",A-Z,Z[A-Z] but numeric]
+ * p = patchlevel
+ */
+ if (desc > 100000000U) {
+ u_int ver_patch = (desc / 100) % 100;
+ u_int ver_rel = (desc / 10000) % 100;
+ u_int ver_min = (desc / 1000000) % 100;
+ u_int ver_maj = desc / 100000000;
+
+ if (file_printf(ms, " %u.%u", ver_maj, ver_min) == -1)
+ return size;
+ if (ver_rel == 0 && ver_patch != 0) {
+ if (file_printf(ms, ".%u", ver_patch) == -1)
+ return size;
+ } else if (ver_rel != 0) {
+ while (ver_rel > 26) {
+ file_printf(ms, "Z");
+ ver_rel -= 26;
+ }
+ file_printf(ms, "%c", 'A' + ver_rel - 1);
}
+ }
+ return size;
+ }
- nameoffset = offset;
- offset += nh_namesz;
- offset = ((offset + 3)/4)*4;
+ if (namesz == 8 && strcmp((char *)&nbuf[noff], "FreeBSD") == 0 &&
+ nh_type == NT_FREEBSD_VERSION && descsz == 4) {
+ uint32_t desc;
+ (void)memcpy(&desc, &nbuf[doff], sizeof(desc));
+ desc = getu32(swap, desc);
+ if (file_printf(ms, ", for FreeBSD") == -1)
+ return size;
- /*
- * Sigh. The 2.0.36 kernel in Debian 2.1, at
- * least, doesn't correctly implement name
- * sections, in core dumps, as specified by
- * the "Program Linking" section of "UNIX(R) System
- * V Release 4 Programmer's Guide: ANSI C and
- * Programming Support Tools", because my copy
- * clearly says "The first 'namesz' bytes in 'name'
- * contain a *null-terminated* [emphasis mine]
- * character representation of the entry's owner
- * or originator", but the 2.0.36 kernel code
- * doesn't include the terminating null in the
- * name....
- */
- if (os_style == -1) {
- if ((nh_namesz == 4 &&
- strncmp(&nbuf[nameoffset],
- "CORE", 4) == 0) ||
- (nh_namesz == 5 &&
- strcmp(&nbuf[nameoffset],
- "CORE") == 0)) {
- os_style = OS_STYLE_SVR4;
- } else
- if ((nh_namesz == 8 &&
- strcmp(&nbuf[nameoffset],
- "FreeBSD") == 0)) {
- os_style = OS_STYLE_FREEBSD;
- } else
- if ((nh_namesz >= 11 &&
- strncmp(&nbuf[nameoffset],
- "NetBSD-CORE", 11) == 0)) {
- os_style = OS_STYLE_NETBSD;
- } else
- continue;
- printf(", %s-style", os_style_names[os_style]);
+ /*
+ * Contents is __FreeBSD_version, whose relation to OS
+ * versions is defined by a huge table in the Porters'
+ * Handbook. For up to 5.x, the first three digits are
+ * the version number. For 5.x and higher, the scheme
+ * is: <major><two digit minor> <0 if release branch,
+ * otherwise 1>xx
+ */
+ if (desc / 100000 < 5) {
+ if (desc / 10000 % 10 == 9) {
+ if (file_printf(ms, " %d.%d", desc / 100000,
+ 9 + desc / 1000 % 10) == -1)
+ return size;
+ } else {
+ if (file_printf(ms, " %d.%d", desc / 100000,
+ desc / 10000 % 10) == -1)
+ return size;
+ if (desc / 1000 % 10 > 0)
+ if (file_printf(ms, ".%d", desc / 1000 % 10)
+ == -1)
+ return size;
+ }
+ if (desc / 10000 % 10 > 5) {
+ desc %= 1000;
+ if (desc >= 100) {
+ if (file_printf(ms, "-STABLE (rev %d)",
+ desc % 100) == -1)
+ return size;
+ } else if (desc != 0) {
+ if (file_printf(ms, ".%d", desc) == -1)
+ return size;
+ }
}
+ } else {
+ if (file_printf(ms, " %d.%d", desc / 100000,
+ desc / 1000 % 100) == -1)
+ return size;
+ desc %= 1000;
+ if (desc >= 100) {
+ if (file_printf(ms, "-CURRENT (rev %d)",
+ desc % 100) == -1)
+ return size;
+ } else if (desc != 0) {
+ if (file_printf(ms, ".%d", desc / 10) == -1)
+ return size;
+ }
+ }
+ return size;
+ }
- if (os_style == OS_STYLE_NETBSD &&
- nh_type == NT_NETBSD_CORE_PROCINFO) {
- uint32_t signo;
+ if (namesz == 8 && strcmp((char *)&nbuf[noff], "OpenBSD") == 0 &&
+ nh_type == NT_OPENBSD_VERSION && descsz == 4) {
+ if (file_printf(ms, ", for OpenBSD") == -1)
+ return size;
+ /* Content of note is always 0 */
+ return size;
+ }
+ /*
+ * Sigh. The 2.0.36 kernel in Debian 2.1, at
+ * least, doesn't correctly implement name
+ * sections, in core dumps, as specified by
+ * the "Program Linking" section of "UNIX(R) System
+ * V Release 4 Programmer's Guide: ANSI C and
+ * Programming Support Tools", because my copy
+ * clearly says "The first 'namesz' bytes in 'name'
+ * contain a *null-terminated* [emphasis mine]
+ * character representation of the entry's owner
+ * or originator", but the 2.0.36 kernel code
+ * doesn't include the terminating null in the
+ * name....
+ */
+ if ((namesz == 4 && strncmp((char *)&nbuf[noff], "CORE", 4) == 0) ||
+ (namesz == 5 && strcmp((char *)&nbuf[noff], "CORE") == 0)) {
+ os_style = OS_STYLE_SVR4;
+ }
+
+ if ((namesz == 8 && strcmp((char *)&nbuf[noff], "FreeBSD") == 0)) {
+ os_style = OS_STYLE_FREEBSD;
+ }
+
+ if ((namesz >= 11 && strncmp((char *)&nbuf[noff], "NetBSD-CORE", 11)
+ == 0)) {
+ os_style = OS_STYLE_NETBSD;
+ }
+
+#ifdef ELFCORE
+ if (os_style != -1)
+ if (file_printf(ms, ", %s-style", os_style_names[os_style]) == -1)
+ return size;
+
+ if (os_style == OS_STYLE_NETBSD && nh_type == NT_NETBSD_CORE_PROCINFO) {
+ uint32_t signo;
+ /*
+ * Extract the program name. It is at
+ * offset 0x7c, and is up to 32-bytes,
+ * including the terminating NUL.
+ */
+ if (file_printf(ms, ", from '%.31s'", &nbuf[doff + 0x7c]) == -1)
+ return size;
+
+ /*
+ * Extract the signal number. It is at
+ * offset 0x08.
+ */
+ memcpy(&signo, &nbuf[doff + 0x08],
+ sizeof(signo));
+ if (file_printf(ms, " (signal %u)", getu32(swap, signo)) == -1)
+ return size;
+ return size;
+ } else if (os_style != OS_STYLE_NETBSD && nh_type == NT_PRPSINFO) {
+ size_t i, j;
+ unsigned char c;
+ /*
+ * Extract the program name. We assume
+ * it to be 16 characters (that's what it
+ * is in SunOS 5.x and Linux).
+ *
+ * Unfortunately, it's at a different offset
+ * in varous OSes, so try multiple offsets.
+ * If the characters aren't all printable,
+ * reject it.
+ */
+ for (i = 0; i < NOFFSETS; i++) {
+ size_t reloffset = prpsoffsets(i);
+ size_t noffset = doff + reloffset;
+ for (j = 0; j < 16; j++, noffset++, reloffset++) {
/*
- * Extract the program name. It is at
- * offset 0x7c, and is up to 32-bytes,
- * including the terminating NUL.
- */
- printf(", from '%.31s'", &nbuf[offset + 0x7c]);
-
- /*
- * Extract the signal number. It is at
- * offset 0x08.
+ * Make sure we're not past
+ * the end of the buffer; if
+ * we are, just give up.
*/
- memcpy(&signo, &nbuf[offset + 0x08],
- sizeof(signo));
- printf(" (signal %u)", getu32(swap, signo));
- } else
- if (os_style != OS_STYLE_NETBSD &&
- nh_type == NT_PRPSINFO) {
+ if (noffset >= size)
+ goto tryanother;
+
/*
- * Extract the program name. We assume
- * it to be 16 characters (that's what it
- * is in SunOS 5.x and Linux).
- *
- * Unfortunately, it's at a different offset
- * in varous OSes, so try multiple offsets.
- * If the characters aren't all printable,
- * reject it.
+ * Make sure we're not past
+ * the end of the contents;
+ * if we are, this obviously
+ * isn't the right offset.
*/
- for (i = 0; i < NOFFSETS; i++) {
- reloffset = prpsoffsets(i);
- noffset = offset + reloffset;
- for (j = 0; j < 16;
- j++, noffset++, reloffset++) {
- /*
- * Make sure we're not past
- * the end of the buffer; if
- * we are, just give up.
- */
- if (noffset >= bufsize)
- goto tryanother;
-
- /*
- * Make sure we're not past
- * the end of the contents;
- * if we are, this obviously
- * isn't the right offset.
- */
- if (reloffset >= nh_descsz)
- goto tryanother;
-
- c = nbuf[noffset];
- if (c == '\0') {
- /*
- * A '\0' at the
- * beginning is
- * obviously wrong.
- * Any other '\0'
- * means we're done.
- */
- if (j == 0)
- goto tryanother;
- else
- break;
- } else {
- /*
- * A nonprintable
- * character is also
- * wrong.
- */
-#define isquote(c) (strchr("'\"`", (c)) != NULL)
- if (!isprint(c) ||
- isquote(c))
- goto tryanother;
- }
- }
+ if (reloffset >= descsz)
+ goto tryanother;
+ c = nbuf[noffset];
+ if (c == '\0') {
/*
- * Well, that worked.
+ * A '\0' at the
+ * beginning is
+ * obviously wrong.
+ * Any other '\0'
+ * means we're done.
*/
- printf(", from '%.16s'",
- &nbuf[offset + prpsoffsets(i)]);
- break;
-
- tryanother:
- ;
+ if (j == 0)
+ goto tryanother;
+ else
+ break;
+ } else {
+ /*
+ * A nonprintable
+ * character is also
+ * wrong.
+ */
+#define isquote(c) (strchr("'\"`", (c)) != NULL)
+ if (!isprint(c) || isquote(c))
+ goto tryanother;
}
- break;
}
- offset += nh_descsz;
- offset = ((offset + 3)/4)*4;
+
+ /*
+ * Well, that worked.
+ */
+ if (file_printf(ms, ", from '%.16s'",
+ &nbuf[doff + prpsoffsets(i)]) == -1)
+ return size;
+ return size;
+
+ tryanother:
+ ;
}
+ return offset;
}
-}
#endif
+ return offset;
+}
+
+private int
+doshn(struct magic_set *ms, int class, int swap, int fd, off_t off, int num,
+ size_t size)
+{
+ Elf32_Shdr sh32;
+ Elf64_Shdr sh64;
+
+ if (size != sh_size) {
+ if (file_printf(ms, ", corrupted section header size") == -1)
+ return -1;
+ return 0;
+ }
+
+ if (lseek(fd, off, SEEK_SET) == (off_t)-1) {
+ file_badseek(ms);
+ return -1;
+ }
+
+ for ( ; num; num--) {
+ if (read(fd, sh_addr, sh_size) == -1) {
+ file_badread(ms);
+ return -1;
+ }
+ if (shs_type == SHT_SYMTAB /* || shs_type == SHT_DYNSYM */) {
+ if (file_printf(ms, ", not stripped") == -1)
+ return -1;
+ return 0;
+ }
+ }
+ if (file_printf(ms, ", stripped") == -1)
+ return -1;
+ return 0;
+}
+
+/*
+ * Look through the program headers of an executable image, searching
+ * for a PT_INTERP section; if one is found, it's dynamically linked,
+ * otherwise it's statically linked.
+ */
+private int
+dophn_exec(struct magic_set *ms, int class, int swap, int fd, off_t off,
+ int num, size_t size)
+{
+ Elf32_Phdr ph32;
+ Elf64_Phdr ph64;
+ const char *linking_style = "statically";
+ const char *shared_libraries = "";
+ unsigned char nbuf[BUFSIZ];
+ int bufsize;
+ size_t offset, align;
+ off_t savedoffset;
+
+ if (size != ph_size) {
+ if (file_printf(ms, ", corrupted program header size") == -1)
+ return -1;
+ return 0;
+ }
+ if (lseek(fd, off, SEEK_SET) == (off_t)-1) {
+ file_badseek(ms);
+ return -1;
+ }
+
+ for ( ; num; num--) {
+ if (read(fd, ph_addr, ph_size) == -1) {
+ file_badread(ms);
+ return -1;
+ }
+ if ((savedoffset = lseek(fd, (off_t)0, SEEK_CUR)) == (off_t)-1) {
+ file_badseek(ms);
+ return -1;
+ }
+
+ switch (ph_type) {
+ case PT_DYNAMIC:
+ linking_style = "dynamically";
+ break;
+ case PT_INTERP:
+ shared_libraries = " (uses shared libs)";
+ break;
+ case PT_NOTE:
+ if ((align = ph_align) & 0x80000000) {
+ if (file_printf(ms,
+ ", invalid note alignment 0x%lx",
+ (unsigned long)align) == -1)
+ return -1;
+ align = 4;
+ }
+ /*
+ * This is a PT_NOTE section; loop through all the notes
+ * in the section.
+ */
+ if (lseek(fd, (off_t) ph_offset, SEEK_SET)
+ == (off_t)-1) {
+ file_badseek(ms);
+ return -1;
+ }
+ bufsize = read(fd, nbuf, sizeof(nbuf));
+ if (bufsize == -1) {
+ file_badread(ms);
+ return -1;
+ }
+ offset = 0;
+ for (;;) {
+ if (offset >= (size_t)bufsize)
+ break;
+ offset = donote(ms, nbuf, offset,
+ (size_t)bufsize, class, swap, align);
+ if (offset == 0)
+ break;
+ }
+ if (lseek(fd, savedoffset, SEEK_SET) == (off_t)-1) {
+ file_badseek(ms);
+ return -1;
+ }
+ break;
+ }
+ }
+ if (file_printf(ms, ", %s linked%s", linking_style, shared_libraries)
+ == -1)
+ return -1;
+ return 0;
+}
+
-void
-tryelf(int fd, unsigned char *buf, int nbytes)
+protected int
+file_tryelf(struct magic_set *ms, int fd, const unsigned char *buf,
+ size_t nbytes)
{
union {
int32_t l;
@@ -565,10 +733,10 @@ tryelf(int fd, unsigned char *buf, int nbytes)
int swap;
/*
- * If we can't seek, it must be a pipe, socket or fifo.
+ * If we cannot seek, it must be a pipe, socket or fifo.
*/
if((lseek(fd, (off_t)0, SEEK_SET) == (off_t)-1) && (errno == ESPIPE))
- fd = pipe2file(fd, buf, nbytes);
+ fd = file_pipe2file(ms, fd, buf, nbytes);
/*
* ELF executables have multiple section headers in arbitrary
@@ -579,7 +747,7 @@ tryelf(int fd, unsigned char *buf, int nbytes)
if (buf[EI_MAG0] != ELFMAG0
|| (buf[EI_MAG1] != ELFMAG1 && buf[EI_MAG1] != OLFMAG1)
|| buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3)
- return;
+ return 0;
class = buf[4];
@@ -587,88 +755,90 @@ tryelf(int fd, unsigned char *buf, int nbytes)
if (class == ELFCLASS32) {
Elf32_Ehdr elfhdr;
if (nbytes <= sizeof (Elf32_Ehdr))
- return;
+ return 0;
u.l = 1;
(void) memcpy(&elfhdr, buf, sizeof elfhdr);
swap = (u.c[sizeof(int32_t) - 1] + 1) != elfhdr.e_ident[5];
- if (getu16(swap, elfhdr.e_type) == ET_CORE)
+ if (getu16(swap, elfhdr.e_type) == ET_CORE) {
#ifdef ELFCORE
- dophn_core(class, swap,
- fd,
- getu32(swap, elfhdr.e_phoff),
- getu16(swap, elfhdr.e_phnum),
- getu16(swap, elfhdr.e_phentsize));
+ if (dophn_core(ms, class, swap, fd,
+ (off_t)getu32(swap, elfhdr.e_phoff),
+ getu16(swap, elfhdr.e_phnum),
+ (size_t)getu16(swap, elfhdr.e_phentsize)) == -1)
+ return -1;
#else
;
#endif
- else {
+ } 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));
+ if (dophn_exec(ms, class, swap,
+ fd, (off_t)getu32(swap, elfhdr.e_phoff),
+ getu16(swap, elfhdr.e_phnum),
+ (size_t)getu16(swap, elfhdr.e_phentsize))
+ == -1)
+ return -1;
}
- doshn(class, swap,
- fd,
- getu32(swap, elfhdr.e_shoff),
- getu16(swap, elfhdr.e_shnum),
- getu16(swap, elfhdr.e_shentsize));
+ if (doshn(ms, class, swap, fd,
+ (off_t)getu32(swap, elfhdr.e_shoff),
+ getu16(swap, elfhdr.e_shnum),
+ (size_t)getu16(swap, elfhdr.e_shentsize)) == -1)
+ return -1;
}
- return;
+ return 1;
}
if (class == ELFCLASS64) {
Elf64_Ehdr elfhdr;
if (nbytes <= sizeof (Elf64_Ehdr))
- return;
+ return 0;
u.l = 1;
(void) memcpy(&elfhdr, buf, sizeof elfhdr);
swap = (u.c[sizeof(int32_t) - 1] + 1) != elfhdr.e_ident[5];
- if (getu16(swap, elfhdr.e_type) == ET_CORE)
+ if (getu16(swap, elfhdr.e_type) == ET_CORE) {
#ifdef ELFCORE
- dophn_core(class, swap,
- fd,
+ if (dophn_core(ms, class, swap, fd,
#ifdef USE_ARRAY_FOR_64BIT_TYPES
- getu32(swap, elfhdr.e_phoff[1]),
+ (off_t)getu32(swap, elfhdr.e_phoff[1]),
#else
- getu64(swap, elfhdr.e_phoff),
+ (off_t)getu64(swap, elfhdr.e_phoff),
#endif
- getu16(swap, elfhdr.e_phnum),
- getu16(swap, elfhdr.e_phentsize));
+ getu16(swap, elfhdr.e_phnum),
+ (size_t)getu16(swap, elfhdr.e_phentsize)) == -1)
+ return -1;
#else
;
#endif
- else
- {
+ } else {
if (getu16(swap, elfhdr.e_type) == ET_EXEC) {
- dophn_exec(class, swap,
- fd,
+ if (dophn_exec(ms, class, swap, fd,
#ifdef USE_ARRAY_FOR_64BIT_TYPES
- getu32(swap, elfhdr.e_phoff[1]),
+ (off_t)getu32(swap, elfhdr.e_phoff[1]),
#else
- getu64(swap, elfhdr.e_phoff),
+ (off_t)getu64(swap, elfhdr.e_phoff),
#endif
- getu16(swap, elfhdr.e_phnum),
- getu16(swap, elfhdr.e_phentsize));
+ getu16(swap, elfhdr.e_phnum),
+ (size_t)getu16(swap, elfhdr.e_phentsize))
+ == -1)
+ return -1;
}
- doshn(class, swap,
- fd,
+ if (doshn(ms, class, swap, fd,
#ifdef USE_ARRAY_FOR_64BIT_TYPES
- getu32(swap, elfhdr.e_shoff[1]),
+ (off_t)getu32(swap, elfhdr.e_shoff[1]),
#else
- getu64(swap, elfhdr.e_shoff),
+ (off_t)getu64(swap, elfhdr.e_shoff),
#endif
- getu16(swap, elfhdr.e_shnum),
- getu16(swap, elfhdr.e_shentsize));
+ getu16(swap, elfhdr.e_shnum),
+ (size_t)getu16(swap, elfhdr.e_shentsize)) == -1)
+ return -1;
}
- return;
+ return 1;
}
+ return 0;
}
#endif
diff --git a/contrib/file/readelf.h b/contrib/file/readelf.h
index f7494de..391b54d 100644
--- a/contrib/file/readelf.h
+++ b/contrib/file/readelf.h
@@ -1,8 +1,33 @@
-/* $NetBSD: readelf.h,v 1.9 2002/05/18 07:00:47 pooka Exp $ */
-
/*
- * readelf.h
- * @(#)Id: readelf.h,v 1.9 2002/05/16 18:45:56 christos Exp
+ * Copyright (c) Christos Zoulas 2003.
+ * All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice immediately at the beginning of the file, without modification,
+ * this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+/*
+ * @(#)Id: readelf.h,v 1.9 2002/05/16 18:45:56 christos Exp
*
* Provide elf data structures for non-elf machines, allowing file
* non-elf hosts to determine if an elf binary is stripped.
diff --git a/contrib/file/softmagic.c b/contrib/file/softmagic.c
index d1ef94d..4e063b9 100644
--- a/contrib/file/softmagic.c
+++ b/contrib/file/softmagic.c
@@ -1,31 +1,41 @@
/*
+ * Copyright (c) Ian F. Darwin 1986-1995.
+ * Software written by Ian F. Darwin and others;
+ * maintained 1995-present by Christos Zoulas and others.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice immediately at the beginning of the file, without modification,
+ * this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Ian F. Darwin and others.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+/*
* softmagic - interpret variable magic from MAGIC
- *
- * Copyright (c) Ian F. Darwin, 1987.
- * Written by Ian F. Darwin.
- *
- * 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.
*/
#include "file.h"
+#include "magic.h"
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
@@ -34,17 +44,18 @@
#ifndef lint
-FILE_RCSID("@(#)$Id: softmagic.c,v 1.54 2003/02/25 13:04:32 christos Exp $")
+FILE_RCSID("@(#)$Id: softmagic.c,v 1.66 2004/07/24 20:38:56 christos Exp $")
#endif /* lint */
-static int match(struct magic *, uint32_t, unsigned char *, int);
-static int mget(union VALUETYPE *, unsigned char *, struct magic *, int);
-static int mcheck(union VALUETYPE *, struct magic *);
-static int32_t mprint(union VALUETYPE *, struct magic *);
-static void mdebug(int32_t, char *, int);
-static int mconvert(union VALUETYPE *, struct magic *);
-
-extern int kflag;
+private int match(struct magic_set *, struct magic *, uint32_t,
+ const unsigned char *, size_t);
+private int mget(struct magic_set *, union VALUETYPE *, const unsigned char *,
+ struct magic *, size_t);
+private int mcheck(struct magic_set *, union VALUETYPE *, struct magic *);
+private int32_t mprint(struct magic_set *, union VALUETYPE *, struct magic *);
+private void mdebug(uint32_t, const char *, size_t);
+private int mconvert(struct magic_set *, union VALUETYPE *, struct magic *);
+private int check_mem(struct magic_set *, unsigned int);
/*
* softmagic - lookup one file in database
@@ -52,13 +63,12 @@ extern int kflag;
* Passed the name and FILE * of one file to be typed.
*/
/*ARGSUSED1*/ /* nbytes passed for regularity, maybe need later */
-int
-softmagic(unsigned char *buf, int nbytes)
+protected int
+file_softmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes)
{
struct mlist *ml;
-
- for (ml = mlist.next; ml != &mlist; ml = ml->next)
- if (match(ml->magic, ml->nmagic, buf, nbytes))
+ for (ml = ms->mlist->next; ml != ms->mlist; ml = ml->next)
+ if (match(ms, ml->magic, ml->nmagic, buf, nbytes))
return 1;
return 0;
@@ -91,44 +101,53 @@ softmagic(unsigned char *buf, int nbytes)
* If a continuation matches, we bump the current continuation level
* so that higher-level continuations are processed.
*/
-static int
-match(struct magic *magic, uint32_t nmagic, unsigned char *s, int nbytes)
+private int
+match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
+ const unsigned char *s, size_t nbytes)
{
- int magindex = 0;
- int cont_level = 0;
+ uint32_t magindex = 0;
+ unsigned int cont_level = 0;
int need_separator = 0;
union VALUETYPE p;
- static int32_t *tmpoff = NULL;
- static size_t tmplen = 0;
int32_t oldoff = 0;
int returnval = 0; /* if a match is found it is set to 1*/
int firstline = 1; /* a flag to print X\n X\n- X */
- if (tmpoff == NULL)
- if ((tmpoff = (int32_t *) malloc(
- (tmplen = 20) * sizeof(*tmpoff))) == NULL)
- error("out of memory\n");
+ if (check_mem(ms, cont_level) == -1)
+ return -1;
for (magindex = 0; magindex < nmagic; magindex++) {
/* if main entry matches, print it... */
- if (!mget(&p, s, &magic[magindex], nbytes) ||
- !mcheck(&p, &magic[magindex])) {
- /*
- * main entry didn't match,
- * flush its continuations
- */
- while (magindex < nmagic &&
- magic[magindex + 1].cont_level != 0)
- magindex++;
- continue;
+ int flush = !mget(ms, &p, s, &magic[magindex], nbytes);
+ switch (mcheck(ms, &p, &magic[magindex])) {
+ case -1:
+ return -1;
+ case 0:
+ flush++;
+ break;
+ default:
+ break;
+ }
+ if (flush) {
+ /*
+ * main entry didn't match,
+ * flush its continuations
+ */
+ while (magindex < nmagic - 1 &&
+ magic[magindex + 1].cont_level != 0)
+ magindex++;
+ continue;
}
- if (! firstline) { /* we found another match */
+ if (!firstline) { /* we found another match */
/* put a newline and '-' to do some simple formatting*/
- printf("\n- ");
+ if (file_printf(ms, "\n- ") == -1)
+ return -1;
}
- tmpoff[cont_level] = mprint(&p, &magic[magindex]);
+ if ((ms->c.off[cont_level] = mprint(ms, &p, &magic[magindex]))
+ == -1)
+ return -1;
/*
* If we printed something, we'll need to print
* a blank before we print something else.
@@ -136,107 +155,130 @@ match(struct magic *magic, uint32_t nmagic, unsigned char *s, int nbytes)
if (magic[magindex].desc[0])
need_separator = 1;
/* and any continuations that match */
- if (++cont_level >= tmplen)
- if ((tmpoff = (int32_t *) realloc(tmpoff,
- (tmplen += 20) * sizeof(*tmpoff))) == NULL)
- error("out of memory\n");
+ if (check_mem(ms, ++cont_level) == -1)
+ return -1;
+
while (magic[magindex+1].cont_level != 0 &&
++magindex < nmagic) {
- if (cont_level >= magic[magindex].cont_level) {
- if (cont_level > magic[magindex].cont_level) {
- /*
- * We're at the end of the level
- * "cont_level" continuations.
- */
- cont_level = magic[magindex].cont_level;
- }
- if (magic[magindex].flag & OFFADD) {
- oldoff=magic[magindex].offset;
- magic[magindex].offset +=
- tmpoff[cont_level-1];
+ if (cont_level < magic[magindex].cont_level)
+ continue;
+ if (cont_level > magic[magindex].cont_level) {
+ /*
+ * We're at the end of the level
+ * "cont_level" continuations.
+ */
+ cont_level = magic[magindex].cont_level;
+ }
+ if (magic[magindex].flag & OFFADD) {
+ oldoff=magic[magindex].offset;
+ magic[magindex].offset += ms->c.off[cont_level-1];
+ }
+ if (!mget(ms, &p, s, &magic[magindex], nbytes))
+ goto done;
+
+ switch (mcheck(ms, &p, &magic[magindex])) {
+ case -1:
+ return -1;
+ case 0:
+ break;
+ default:
+ /*
+ * This continuation matched.
+ * Print its message, with
+ * a blank before it if
+ * the previous item printed
+ * and this item isn't empty.
+ */
+ /* space if previous printed */
+ if (need_separator
+ && (magic[magindex].nospflag == 0)
+ && (magic[magindex].desc[0] != '\0')) {
+ if (file_printf(ms, " ") == -1)
+ return -1;
+ need_separator = 0;
}
- if (mget(&p, s, &magic[magindex], nbytes) &&
- mcheck(&p, &magic[magindex])) {
- /*
- * This continuation matched.
- * Print its message, with
- * a blank before it if
- * the previous item printed
- * and this item isn't empty.
- */
- /* space if previous printed */
- if (need_separator
- && (magic[magindex].nospflag == 0)
- && (magic[magindex].desc[0] != '\0')
- ) {
- (void) putchar(' ');
- need_separator = 0;
- }
- tmpoff[cont_level] =
- mprint(&p, &magic[magindex]);
- if (magic[magindex].desc[0])
- need_separator = 1;
+ if ((ms->c.off[cont_level] = mprint(ms, &p,
+ &magic[magindex])) == -1)
+ return -1;
+ if (magic[magindex].desc[0])
+ need_separator = 1;
- /*
- * If we see any continuations
- * at a higher level,
- * process them.
- */
- if (++cont_level >= tmplen)
- if ((tmpoff =
- (int32_t *) realloc(tmpoff,
- (tmplen += 20)
- * sizeof(*tmpoff))) == NULL)
- error("out of memory\n");
- }
- if (magic[magindex].flag & OFFADD) {
- magic[magindex].offset = oldoff;
- }
+ /*
+ * If we see any continuations
+ * at a higher level,
+ * process them.
+ */
+ if (check_mem(ms, ++cont_level) == -1)
+ return -1;
+ }
+done:
+ if (magic[magindex].flag & OFFADD) {
+ magic[magindex].offset = oldoff;
}
}
firstline = 0;
returnval = 1;
- if (!kflag) {
+ if ((ms->flags & MAGIC_CONTINUE) == 0) {
return 1; /* don't keep searching */
}
}
return returnval; /* This is hit if -k is set or there is no match */
}
-static int32_t
-mprint(union VALUETYPE *p, struct magic *m)
+private int
+check_mem(struct magic_set *ms, unsigned int level)
+{
+ size_t len;
+
+ if (level < ms->c.len)
+ return 0;
+
+ len = (ms->c.len += 20) * sizeof(*ms->c.off);
+ ms->c.off = (ms->c.off == NULL) ? malloc(len) : realloc(ms->c.off, len);
+ if (ms->c.off != NULL)
+ return 0;
+ file_oomem(ms);
+ return -1;
+}
+
+private int32_t
+mprint(struct magic_set *ms, union VALUETYPE *p, struct magic *m)
{
uint32_t v;
int32_t t=0 ;
switch (m->type) {
- case BYTE:
- v = signextend(m, p->b);
- (void) printf(m->desc, (unsigned char) v);
+ case FILE_BYTE:
+ v = file_signextend(ms, m, (size_t)p->b);
+ if (file_printf(ms, m->desc, (unsigned char) v) == -1)
+ return -1;
t = m->offset + sizeof(char);
break;
- case SHORT:
- case BESHORT:
- case LESHORT:
- v = signextend(m, p->h);
- (void) printf(m->desc, (unsigned short) v);
+ case FILE_SHORT:
+ case FILE_BESHORT:
+ case FILE_LESHORT:
+ v = file_signextend(ms, m, (size_t)p->h);
+ if (file_printf(ms, m->desc, (unsigned short) v) == -1)
+ return -1;
t = m->offset + sizeof(short);
break;
- case LONG:
- case BELONG:
- case LELONG:
- v = signextend(m, p->l);
- (void) printf(m->desc, (uint32_t) v);
+ case FILE_LONG:
+ case FILE_BELONG:
+ case FILE_LELONG:
+ v = file_signextend(ms, m, p->l);
+ if (file_printf(ms, m->desc, (uint32_t) v) == -1)
+ return -1;
t = m->offset + sizeof(int32_t);
break;
- case STRING:
- case PSTRING:
+ case FILE_STRING:
+ case FILE_PSTRING:
if (m->reln == '=') {
- (void) printf(m->desc, m->value.s);
+ if (file_printf(ms, m->desc, m->value.s) == -1)
+ return -1;
t = m->offset + strlen(m->value.s);
}
else {
@@ -245,32 +287,36 @@ mprint(union VALUETYPE *p, struct magic *m)
if (cp)
*cp = '\0';
}
- (void) printf(m->desc, p->s);
+ if (file_printf(ms, m->desc, p->s) == -1)
+ return -1;
t = m->offset + strlen(p->s);
}
break;
- case DATE:
- case BEDATE:
- case LEDATE:
- (void) printf(m->desc, fmttime(p->l, 1));
+ case FILE_DATE:
+ case FILE_BEDATE:
+ case FILE_LEDATE:
+ if (file_printf(ms, m->desc, file_fmttime(p->l, 1)) == -1)
+ return -1;
t = m->offset + sizeof(time_t);
break;
- case LDATE:
- case BELDATE:
- case LELDATE:
- (void) printf(m->desc, fmttime(p->l, 0));
+ case FILE_LDATE:
+ case FILE_BELDATE:
+ case FILE_LELDATE:
+ if (file_printf(ms, m->desc, file_fmttime(p->l, 0)) == -1)
+ return -1;
t = m->offset + sizeof(time_t);
break;
- case REGEX:
- (void) printf(m->desc, p->s);
+ case FILE_REGEX:
+ if (file_printf(ms, m->desc, p->s) == -1)
+ return -1;
t = m->offset + strlen(p->s);
break;
default:
- error("invalid m->type (%d) in mprint().\n", m->type);
- /*NOTREACHED*/
+ file_error(ms, 0, "invalid m->type (%d) in mprint()", m->type);
+ return -1;
}
return(t);
}
@@ -280,106 +326,106 @@ mprint(union VALUETYPE *p, struct magic *m)
* While we're here, let's apply the mask operation
* (unless you have a better idea)
*/
-static int
-mconvert(union VALUETYPE *p, struct magic *m)
+private int
+mconvert(struct magic_set *ms, union VALUETYPE *p, struct magic *m)
{
switch (m->type) {
- case BYTE:
+ case FILE_BYTE:
if (m->mask)
switch (m->mask_op&0x7F) {
- case OPAND:
+ case FILE_OPAND:
p->b &= m->mask;
break;
- case OPOR:
+ case FILE_OPOR:
p->b |= m->mask;
break;
- case OPXOR:
+ case FILE_OPXOR:
p->b ^= m->mask;
break;
- case OPADD:
+ case FILE_OPADD:
p->b += m->mask;
break;
- case OPMINUS:
+ case FILE_OPMINUS:
p->b -= m->mask;
break;
- case OPMULTIPLY:
+ case FILE_OPMULTIPLY:
p->b *= m->mask;
break;
- case OPDIVIDE:
+ case FILE_OPDIVIDE:
p->b /= m->mask;
break;
- case OPMODULO:
+ case FILE_OPMODULO:
p->b %= m->mask;
break;
}
- if (m->mask_op & OPINVERSE)
+ if (m->mask_op & FILE_OPINVERSE)
p->b = ~p->b;
return 1;
- case SHORT:
+ case FILE_SHORT:
if (m->mask)
switch (m->mask_op&0x7F) {
- case OPAND:
+ case FILE_OPAND:
p->h &= m->mask;
break;
- case OPOR:
+ case FILE_OPOR:
p->h |= m->mask;
break;
- case OPXOR:
+ case FILE_OPXOR:
p->h ^= m->mask;
break;
- case OPADD:
+ case FILE_OPADD:
p->h += m->mask;
break;
- case OPMINUS:
+ case FILE_OPMINUS:
p->h -= m->mask;
break;
- case OPMULTIPLY:
+ case FILE_OPMULTIPLY:
p->h *= m->mask;
break;
- case OPDIVIDE:
+ case FILE_OPDIVIDE:
p->h /= m->mask;
break;
- case OPMODULO:
+ case FILE_OPMODULO:
p->h %= m->mask;
break;
}
- if (m->mask_op & OPINVERSE)
+ if (m->mask_op & FILE_OPINVERSE)
p->h = ~p->h;
return 1;
- case LONG:
- case DATE:
- case LDATE:
+ case FILE_LONG:
+ case FILE_DATE:
+ case FILE_LDATE:
if (m->mask)
switch (m->mask_op&0x7F) {
- case OPAND:
+ case FILE_OPAND:
p->l &= m->mask;
break;
- case OPOR:
+ case FILE_OPOR:
p->l |= m->mask;
break;
- case OPXOR:
+ case FILE_OPXOR:
p->l ^= m->mask;
break;
- case OPADD:
+ case FILE_OPADD:
p->l += m->mask;
break;
- case OPMINUS:
+ case FILE_OPMINUS:
p->l -= m->mask;
break;
- case OPMULTIPLY:
+ case FILE_OPMULTIPLY:
p->l *= m->mask;
break;
- case OPDIVIDE:
+ case FILE_OPDIVIDE:
p->l /= m->mask;
break;
- case OPMODULO:
+ case FILE_OPMODULO:
p->l %= m->mask;
break;
}
- if (m->mask_op & OPINVERSE)
+ if (m->mask_op & FILE_OPINVERSE)
p->l = ~p->l;
return 1;
- case STRING:
+ case FILE_STRING:
{
int n;
@@ -390,10 +436,10 @@ mconvert(union VALUETYPE *p, struct magic *m)
p->s[n] = '\0';
return 1;
}
- case PSTRING:
+ case FILE_PSTRING:
{
char *ptr1 = p->s, *ptr2 = ptr1 + 1;
- int n = *p->s;
+ unsigned int n = *p->s;
if (n >= sizeof(p->s))
n = sizeof(p->s) - 1;
while (n--)
@@ -404,175 +450,180 @@ mconvert(union VALUETYPE *p, struct magic *m)
p->s[n] = '\0';
return 1;
}
- case BESHORT:
+ case FILE_BESHORT:
p->h = (short)((p->hs[0]<<8)|(p->hs[1]));
if (m->mask)
switch (m->mask_op&0x7F) {
- case OPAND:
+ case FILE_OPAND:
p->h &= m->mask;
break;
- case OPOR:
+ case FILE_OPOR:
p->h |= m->mask;
break;
- case OPXOR:
+ case FILE_OPXOR:
p->h ^= m->mask;
break;
- case OPADD:
+ case FILE_OPADD:
p->h += m->mask;
break;
- case OPMINUS:
+ case FILE_OPMINUS:
p->h -= m->mask;
break;
- case OPMULTIPLY:
+ case FILE_OPMULTIPLY:
p->h *= m->mask;
break;
- case OPDIVIDE:
+ case FILE_OPDIVIDE:
p->h /= m->mask;
break;
- case OPMODULO:
+ case FILE_OPMODULO:
p->h %= m->mask;
break;
}
- if (m->mask_op & OPINVERSE)
+ if (m->mask_op & FILE_OPINVERSE)
p->h = ~p->h;
return 1;
- case BELONG:
- case BEDATE:
- case BELDATE:
+ case FILE_BELONG:
+ case FILE_BEDATE:
+ case FILE_BELDATE:
p->l = (int32_t)
((p->hl[0]<<24)|(p->hl[1]<<16)|(p->hl[2]<<8)|(p->hl[3]));
if (m->mask)
switch (m->mask_op&0x7F) {
- case OPAND:
+ case FILE_OPAND:
p->l &= m->mask;
break;
- case OPOR:
+ case FILE_OPOR:
p->l |= m->mask;
break;
- case OPXOR:
+ case FILE_OPXOR:
p->l ^= m->mask;
break;
- case OPADD:
+ case FILE_OPADD:
p->l += m->mask;
break;
- case OPMINUS:
+ case FILE_OPMINUS:
p->l -= m->mask;
break;
- case OPMULTIPLY:
+ case FILE_OPMULTIPLY:
p->l *= m->mask;
break;
- case OPDIVIDE:
+ case FILE_OPDIVIDE:
p->l /= m->mask;
break;
- case OPMODULO:
+ case FILE_OPMODULO:
p->l %= m->mask;
break;
}
- if (m->mask_op & OPINVERSE)
+ if (m->mask_op & FILE_OPINVERSE)
p->l = ~p->l;
return 1;
- case LESHORT:
+ case FILE_LESHORT:
p->h = (short)((p->hs[1]<<8)|(p->hs[0]));
if (m->mask)
switch (m->mask_op&0x7F) {
- case OPAND:
+ case FILE_OPAND:
p->h &= m->mask;
break;
- case OPOR:
+ case FILE_OPOR:
p->h |= m->mask;
break;
- case OPXOR:
+ case FILE_OPXOR:
p->h ^= m->mask;
break;
- case OPADD:
+ case FILE_OPADD:
p->h += m->mask;
break;
- case OPMINUS:
+ case FILE_OPMINUS:
p->h -= m->mask;
break;
- case OPMULTIPLY:
+ case FILE_OPMULTIPLY:
p->h *= m->mask;
break;
- case OPDIVIDE:
+ case FILE_OPDIVIDE:
p->h /= m->mask;
break;
- case OPMODULO:
+ case FILE_OPMODULO:
p->h %= m->mask;
break;
}
- if (m->mask_op & OPINVERSE)
+ if (m->mask_op & FILE_OPINVERSE)
p->h = ~p->h;
return 1;
- case LELONG:
- case LEDATE:
- case LELDATE:
+ case FILE_LELONG:
+ case FILE_LEDATE:
+ case FILE_LELDATE:
p->l = (int32_t)
((p->hl[3]<<24)|(p->hl[2]<<16)|(p->hl[1]<<8)|(p->hl[0]));
if (m->mask)
switch (m->mask_op&0x7F) {
- case OPAND:
+ case FILE_OPAND:
p->l &= m->mask;
break;
- case OPOR:
+ case FILE_OPOR:
p->l |= m->mask;
break;
- case OPXOR:
+ case FILE_OPXOR:
p->l ^= m->mask;
break;
- case OPADD:
+ case FILE_OPADD:
p->l += m->mask;
break;
- case OPMINUS:
+ case FILE_OPMINUS:
p->l -= m->mask;
break;
- case OPMULTIPLY:
+ case FILE_OPMULTIPLY:
p->l *= m->mask;
break;
- case OPDIVIDE:
+ case FILE_OPDIVIDE:
p->l /= m->mask;
break;
- case OPMODULO:
+ case FILE_OPMODULO:
p->l %= m->mask;
break;
}
- if (m->mask_op & OPINVERSE)
+ if (m->mask_op & FILE_OPINVERSE)
p->l = ~p->l;
return 1;
- case REGEX:
+ case FILE_REGEX:
return 1;
default:
- error("invalid type %d in mconvert().\n", m->type);
+ file_error(ms, 0, "invalid type %d in mconvert()", m->type);
return 0;
}
}
-static void
-mdebug(int32_t offset, char *str, int len)
+private void
+mdebug(uint32_t offset, const char *str, size_t len)
{
(void) fprintf(stderr, "mget @%d: ", offset);
- showstr(stderr, (char *) str, len);
+ file_showstr(stderr, str, len);
(void) fputc('\n', stderr);
(void) fputc('\n', stderr);
}
-static int
-mget(union VALUETYPE *p, unsigned char *s, struct magic *m, int nbytes)
+private int
+mget(struct magic_set *ms, union VALUETYPE *p, const unsigned char *s,
+ struct magic *m, size_t nbytes)
{
- int32_t offset = m->offset;
+ uint32_t offset = m->offset;
- if (m->type == REGEX) {
- /*
- * offset is interpreted as last line to search,
- * (starting at 1), not as bytes-from start-of-file
- */
- unsigned char *last = NULL;
- p->buf = (char *)s;
- for (; offset && (s = (unsigned char *)strchr(s, '\n')) != NULL;
- offset--, s++)
- last = s;
- if (last != NULL)
- *last = '\0';
+ if (m->type == FILE_REGEX) {
+ /*
+ * offset is interpreted as last line to search,
+ * (starting at 1), not as bytes-from start-of-file
+ */
+ unsigned char *b, *last = NULL;
+ if ((p->buf = strdup((const char *)s)) == NULL) {
+ file_oomem(ms);
+ return -1;
+ }
+ for (b = (unsigned char *)p->buf; offset &&
+ (b = (unsigned char *)strchr((char *)b, '\n')) != NULL;
+ offset--, s++)
+ last = b;
+ if (last != NULL)
+ *last = '\0';
} else if (offset + sizeof(union VALUETYPE) <= nbytes)
memcpy(p, s + offset, sizeof(union VALUETYPE));
else {
@@ -580,228 +631,272 @@ mget(union VALUETYPE *p, unsigned char *s, struct magic *m, int nbytes)
* the usefulness of padding with zeroes eludes me, it
* might even cause problems
*/
- int32_t have = nbytes - offset;
memset(p, 0, sizeof(union VALUETYPE));
- if (have > 0)
- memcpy(p, s + offset, have);
+ if (offset < nbytes)
+ memcpy(p, s + offset, nbytes - offset);
}
- if (debug) {
- mdebug(offset, (char *) p, sizeof(union VALUETYPE));
- mdump(m);
+ /* Verify we have enough data to match magic type */
+ switch (m->type) {
+ case FILE_BYTE:
+ if (nbytes < (offset + 1)) /* should alway be true */
+ return 0;
+ break;
+
+ case FILE_SHORT:
+ case FILE_BESHORT:
+ case FILE_LESHORT:
+ if (nbytes < (offset + 2))
+ return 0;
+ break;
+
+ case FILE_LONG:
+ case FILE_BELONG:
+ case FILE_LELONG:
+ case FILE_DATE:
+ case FILE_BEDATE:
+ case FILE_LEDATE:
+ case FILE_LDATE:
+ case FILE_BELDATE:
+ case FILE_LELDATE:
+ if (nbytes < (offset + 4))
+ return 0;
+ break;
+
+ case FILE_STRING:
+ case FILE_PSTRING:
+ if (nbytes < (offset + m->vallen))
+ return 0;
+ break;
+ }
+
+ if ((ms->flags & MAGIC_DEBUG) != 0) {
+ mdebug(offset, (char *)(void *)p, sizeof(union VALUETYPE));
+ file_mdump(m);
}
if (m->flag & INDIR) {
switch (m->in_type) {
- case BYTE:
- if (m->in_offset)
+ case FILE_BYTE:
+ if (m->in_offset) {
switch (m->in_op&0x7F) {
- case OPAND:
+ case FILE_OPAND:
offset = p->b & m->in_offset;
break;
- case OPOR:
+ case FILE_OPOR:
offset = p->b | m->in_offset;
break;
- case OPXOR:
+ case FILE_OPXOR:
offset = p->b ^ m->in_offset;
break;
- case OPADD:
+ case FILE_OPADD:
offset = p->b + m->in_offset;
break;
- case OPMINUS:
+ case FILE_OPMINUS:
offset = p->b - m->in_offset;
break;
- case OPMULTIPLY:
+ case FILE_OPMULTIPLY:
offset = p->b * m->in_offset;
break;
- case OPDIVIDE:
+ case FILE_OPDIVIDE:
offset = p->b / m->in_offset;
break;
- case OPMODULO:
+ case FILE_OPMODULO:
offset = p->b % m->in_offset;
break;
}
- if (m->in_op & OPINVERSE)
+ } else
+ offset = p->b;
+ if (m->in_op & FILE_OPINVERSE)
offset = ~offset;
break;
- case BESHORT:
- if (m->in_offset)
- switch (m->in_op&0x7F) {
- case OPAND:
+ case FILE_BESHORT:
+ if (m->in_offset) {
+ switch (m->in_op & 0x7F) {
+ case FILE_OPAND:
offset = (short)((p->hs[0]<<8)|
(p->hs[1])) &
m->in_offset;
break;
- case OPOR:
+ case FILE_OPOR:
offset = (short)((p->hs[0]<<8)|
(p->hs[1])) |
m->in_offset;
break;
- case OPXOR:
+ case FILE_OPXOR:
offset = (short)((p->hs[0]<<8)|
(p->hs[1])) ^
m->in_offset;
break;
- case OPADD:
+ case FILE_OPADD:
offset = (short)((p->hs[0]<<8)|
(p->hs[1])) +
m->in_offset;
break;
- case OPMINUS:
+ case FILE_OPMINUS:
offset = (short)((p->hs[0]<<8)|
(p->hs[1])) -
m->in_offset;
break;
- case OPMULTIPLY:
+ case FILE_OPMULTIPLY:
offset = (short)((p->hs[0]<<8)|
(p->hs[1])) *
m->in_offset;
break;
- case OPDIVIDE:
+ case FILE_OPDIVIDE:
offset = (short)((p->hs[0]<<8)|
(p->hs[1])) /
m->in_offset;
break;
- case OPMODULO:
+ case FILE_OPMODULO:
offset = (short)((p->hs[0]<<8)|
(p->hs[1])) %
m->in_offset;
break;
}
- if (m->in_op & OPINVERSE)
+ } else
+ offset = (short)((p->hs[0]<<8)|
+ (p->hs[1]));
+ if (m->in_op & FILE_OPINVERSE)
offset = ~offset;
break;
- case LESHORT:
- if (m->in_offset)
- switch (m->in_op&0x7F) {
- case OPAND:
+ case FILE_LESHORT:
+ if (m->in_offset) {
+ switch (m->in_op & 0x7F) {
+ case FILE_OPAND:
offset = (short)((p->hs[1]<<8)|
(p->hs[0])) &
m->in_offset;
break;
- case OPOR:
+ case FILE_OPOR:
offset = (short)((p->hs[1]<<8)|
(p->hs[0])) |
m->in_offset;
break;
- case OPXOR:
+ case FILE_OPXOR:
offset = (short)((p->hs[1]<<8)|
(p->hs[0])) ^
m->in_offset;
break;
- case OPADD:
+ case FILE_OPADD:
offset = (short)((p->hs[1]<<8)|
(p->hs[0])) +
m->in_offset;
break;
- case OPMINUS:
+ case FILE_OPMINUS:
offset = (short)((p->hs[1]<<8)|
(p->hs[0])) -
m->in_offset;
break;
- case OPMULTIPLY:
+ case FILE_OPMULTIPLY:
offset = (short)((p->hs[1]<<8)|
(p->hs[0])) *
m->in_offset;
break;
- case OPDIVIDE:
+ case FILE_OPDIVIDE:
offset = (short)((p->hs[1]<<8)|
(p->hs[0])) /
m->in_offset;
break;
- case OPMODULO:
+ case FILE_OPMODULO:
offset = (short)((p->hs[1]<<8)|
(p->hs[0])) %
m->in_offset;
break;
}
- if (m->in_op & OPINVERSE)
+ } else
+ offset = (short)((p->hs[1]<<8)|
+ (p->hs[0]));
+ if (m->in_op & FILE_OPINVERSE)
offset = ~offset;
break;
- case SHORT:
- if (m->in_offset)
- switch (m->in_op&0x7F) {
- case OPAND:
+ case FILE_SHORT:
+ if (m->in_offset) {
+ switch (m->in_op & 0x7F) {
+ case FILE_OPAND:
offset = p->h & m->in_offset;
break;
- case OPOR:
+ case FILE_OPOR:
offset = p->h | m->in_offset;
break;
- case OPXOR:
+ case FILE_OPXOR:
offset = p->h ^ m->in_offset;
break;
- case OPADD:
+ case FILE_OPADD:
offset = p->h + m->in_offset;
break;
- case OPMINUS:
+ case FILE_OPMINUS:
offset = p->h - m->in_offset;
break;
- case OPMULTIPLY:
+ case FILE_OPMULTIPLY:
offset = p->h * m->in_offset;
break;
- case OPDIVIDE:
+ case FILE_OPDIVIDE:
offset = p->h / m->in_offset;
break;
- case OPMODULO:
+ case FILE_OPMODULO:
offset = p->h % m->in_offset;
break;
}
- if (m->in_op & OPINVERSE)
+ }
+ else
+ offset = p->h;
+ if (m->in_op & FILE_OPINVERSE)
offset = ~offset;
break;
- case BELONG:
- if (m->in_offset)
- switch (m->in_op&0x7F) {
- case OPAND:
+ case FILE_BELONG:
+ if (m->in_offset) {
+ switch (m->in_op & 0x7F) {
+ case FILE_OPAND:
offset = (int32_t)((p->hl[0]<<24)|
(p->hl[1]<<16)|
(p->hl[2]<<8)|
(p->hl[3])) &
m->in_offset;
break;
- case OPOR:
+ case FILE_OPOR:
offset = (int32_t)((p->hl[0]<<24)|
(p->hl[1]<<16)|
(p->hl[2]<<8)|
(p->hl[3])) |
m->in_offset;
break;
- case OPXOR:
+ case FILE_OPXOR:
offset = (int32_t)((p->hl[0]<<24)|
(p->hl[1]<<16)|
(p->hl[2]<<8)|
(p->hl[3])) ^
m->in_offset;
break;
- case OPADD:
+ case FILE_OPADD:
offset = (int32_t)((p->hl[0]<<24)|
(p->hl[1]<<16)|
(p->hl[2]<<8)|
(p->hl[3])) +
m->in_offset;
break;
- case OPMINUS:
+ case FILE_OPMINUS:
offset = (int32_t)((p->hl[0]<<24)|
(p->hl[1]<<16)|
(p->hl[2]<<8)|
(p->hl[3])) -
m->in_offset;
break;
- case OPMULTIPLY:
+ case FILE_OPMULTIPLY:
offset = (int32_t)((p->hl[0]<<24)|
(p->hl[1]<<16)|
(p->hl[2]<<8)|
(p->hl[3])) *
m->in_offset;
break;
- case OPDIVIDE:
+ case FILE_OPDIVIDE:
offset = (int32_t)((p->hl[0]<<24)|
(p->hl[1]<<16)|
(p->hl[2]<<8)|
(p->hl[3])) /
m->in_offset;
break;
- case OPMODULO:
+ case FILE_OPMODULO:
offset = (int32_t)((p->hl[0]<<24)|
(p->hl[1]<<16)|
(p->hl[2]<<8)|
@@ -809,62 +904,67 @@ mget(union VALUETYPE *p, unsigned char *s, struct magic *m, int nbytes)
m->in_offset;
break;
}
- if (m->in_op & OPINVERSE)
+ } else
+ offset = (int32_t)((p->hl[0]<<24)|
+ (p->hl[1]<<16)|
+ (p->hl[2]<<8)|
+ (p->hl[3]));
+ if (m->in_op & FILE_OPINVERSE)
offset = ~offset;
break;
- case LELONG:
- if (m->in_offset)
- switch (m->in_op&0x7F) {
- case OPAND:
+ case FILE_LELONG:
+ if (m->in_offset) {
+ switch (m->in_op & 0x7F) {
+ case FILE_OPAND:
offset = (int32_t)((p->hl[3]<<24)|
(p->hl[2]<<16)|
(p->hl[1]<<8)|
(p->hl[0])) &
m->in_offset;
break;
- case OPOR:
+ case FILE_OPOR:
offset = (int32_t)((p->hl[3]<<24)|
(p->hl[2]<<16)|
(p->hl[1]<<8)|
(p->hl[0])) |
m->in_offset;
break;
- case OPXOR:
+ case FILE_OPXOR:
offset = (int32_t)((p->hl[3]<<24)|
(p->hl[2]<<16)|
(p->hl[1]<<8)|
(p->hl[0])) ^
m->in_offset;
break;
- case OPADD:
+ case FILE_OPADD:
offset = (int32_t)((p->hl[3]<<24)|
(p->hl[2]<<16)|
(p->hl[1]<<8)|
(p->hl[0])) +
m->in_offset;
break;
- case OPMINUS:
+ case FILE_OPMINUS:
offset = (int32_t)((p->hl[3]<<24)|
(p->hl[2]<<16)|
(p->hl[1]<<8)|
(p->hl[0])) -
m->in_offset;
break;
- case OPMULTIPLY:
+ case FILE_OPMULTIPLY:
offset = (int32_t)((p->hl[3]<<24)|
(p->hl[2]<<16)|
(p->hl[1]<<8)|
(p->hl[0])) *
m->in_offset;
break;
- case OPDIVIDE:
+ case FILE_OPDIVIDE:
offset = (int32_t)((p->hl[3]<<24)|
(p->hl[2]<<16)|
(p->hl[1]<<8)|
(p->hl[0])) /
m->in_offset;
break;
- case OPMODULO:
+ case FILE_OPMODULO:
offset = (int32_t)((p->hl[3]<<24)|
(p->hl[2]<<16)|
(p->hl[1]<<8)|
@@ -872,34 +972,39 @@ mget(union VALUETYPE *p, unsigned char *s, struct magic *m, int nbytes)
m->in_offset;
break;
}
- if (m->in_op & OPINVERSE)
+ } else
+ offset = (int32_t)((p->hl[3]<<24)|
+ (p->hl[2]<<16)|
+ (p->hl[1]<<8)|
+ (p->hl[0]));
+ if (m->in_op & FILE_OPINVERSE)
offset = ~offset;
break;
- case LONG:
- if (m->in_offset)
- switch (m->in_op&0x7F) {
- case OPAND:
+ case FILE_LONG:
+ if (m->in_offset) {
+ switch (m->in_op & 0x7F) {
+ case FILE_OPAND:
offset = p->l & m->in_offset;
break;
- case OPOR:
+ case FILE_OPOR:
offset = p->l | m->in_offset;
break;
- case OPXOR:
+ case FILE_OPXOR:
offset = p->l ^ m->in_offset;
break;
- case OPADD:
+ case FILE_OPADD:
offset = p->l + m->in_offset;
break;
- case OPMINUS:
+ case FILE_OPMINUS:
offset = p->l - m->in_offset;
break;
- case OPMULTIPLY:
+ case FILE_OPMULTIPLY:
offset = p->l * m->in_offset;
break;
- case OPDIVIDE:
+ case FILE_OPDIVIDE:
offset = p->l / m->in_offset;
break;
- case OPMODULO:
+ case FILE_OPMODULO:
offset = p->l % m->in_offset;
break;
/* case TOOMANYSWITCHBLOCKS:
@@ -910,64 +1015,67 @@ mget(union VALUETYPE *p, unsigned char *s, struct magic *m, int nbytes)
* sleep;
*/
}
- if (m->in_op & OPINVERSE)
+ } else
+ offset = p->l;
+ if (m->in_op & FILE_OPINVERSE)
offset = ~offset;
break;
}
- if (offset + sizeof(union VALUETYPE) > nbytes)
+ if (nbytes < sizeof(union VALUETYPE) ||
+ nbytes - sizeof(union VALUETYPE) < offset)
return 0;
memcpy(p, s + offset, sizeof(union VALUETYPE));
- if (debug) {
- mdebug(offset, (char *) p, sizeof(union VALUETYPE));
- mdump(m);
+ if ((ms->flags & MAGIC_DEBUG) != 0) {
+ mdebug(offset, (char *)(void *)p,
+ sizeof(union VALUETYPE));
+ file_mdump(m);
}
}
- if (!mconvert(p, m))
+ if (!mconvert(ms, p, m))
return 0;
return 1;
}
-static int
-mcheck(union VALUETYPE *p, struct magic *m)
+private int
+mcheck(struct magic_set *ms, union VALUETYPE *p, struct magic *m)
{
uint32_t l = m->value.l;
uint32_t v;
int matched;
if ( (m->value.s[0] == 'x') && (m->value.s[1] == '\0') ) {
- fprintf(stderr, "BOINK");
return 1;
}
switch (m->type) {
- case BYTE:
+ case FILE_BYTE:
v = p->b;
break;
- case SHORT:
- case BESHORT:
- case LESHORT:
+ case FILE_SHORT:
+ case FILE_BESHORT:
+ case FILE_LESHORT:
v = p->h;
break;
- case LONG:
- case BELONG:
- case LELONG:
- case DATE:
- case BEDATE:
- case LEDATE:
- case LDATE:
- case BELDATE:
- case LELDATE:
+ case FILE_LONG:
+ case FILE_BELONG:
+ case FILE_LELONG:
+ case FILE_DATE:
+ case FILE_BEDATE:
+ case FILE_LEDATE:
+ case FILE_LDATE:
+ case FILE_BELDATE:
+ case FILE_LELDATE:
v = p->l;
break;
- case STRING:
- case PSTRING:
+ case FILE_STRING:
+ case FILE_PSTRING:
{
/*
* What we want here is:
@@ -1013,7 +1121,7 @@ mcheck(union VALUETYPE *p, struct magic *m)
}
break;
}
- case REGEX:
+ case FILE_REGEX:
{
int rc;
regex_t rx;
@@ -1021,38 +1129,42 @@ mcheck(union VALUETYPE *p, struct magic *m)
rc = regcomp(&rx, m->value.s, REG_EXTENDED|REG_NOSUB);
if (rc) {
+ free(p->buf);
regerror(rc, &rx, errmsg, sizeof(errmsg));
- error("regex error %d, (%s)\n", rc, errmsg);
+ file_error(ms, 0, "regex error %d, (%s)", rc, errmsg);
+ return -1;
} else {
rc = regexec(&rx, p->buf, 0, 0, 0);
+ regfree(&rx);
+ free(p->buf);
return !rc;
}
}
default:
- error("invalid type %d in mcheck().\n", m->type);
- return 0;/*NOTREACHED*/
+ file_error(ms, 0, "invalid type %d in mcheck()", m->type);
+ return -1;
}
- if(m->type != STRING && m->type != PSTRING)
- v = signextend(m, v);
+ if (m->type != FILE_STRING && m->type != FILE_PSTRING)
+ v = file_signextend(ms, m, v);
switch (m->reln) {
case 'x':
- if (debug)
+ if ((ms->flags & MAGIC_DEBUG) != 0)
(void) fprintf(stderr, "%u == *any* = 1\n", v);
matched = 1;
break;
case '!':
matched = v != l;
- if (debug)
+ if ((ms->flags & MAGIC_DEBUG) != 0)
(void) fprintf(stderr, "%u != %u = %d\n",
v, l, matched);
break;
case '=':
matched = v == l;
- if (debug)
+ if ((ms->flags & MAGIC_DEBUG) != 0)
(void) fprintf(stderr, "%u == %u = %d\n",
v, l, matched);
break;
@@ -1060,13 +1172,13 @@ mcheck(union VALUETYPE *p, struct magic *m)
case '>':
if (m->flag & UNSIGNED) {
matched = v > l;
- if (debug)
+ if ((ms->flags & MAGIC_DEBUG) != 0)
(void) fprintf(stderr, "%u > %u = %d\n",
v, l, matched);
}
else {
matched = (int32_t) v > (int32_t) l;
- if (debug)
+ if ((ms->flags & MAGIC_DEBUG) != 0)
(void) fprintf(stderr, "%d > %d = %d\n",
v, l, matched);
}
@@ -1075,13 +1187,13 @@ mcheck(union VALUETYPE *p, struct magic *m)
case '<':
if (m->flag & UNSIGNED) {
matched = v < l;
- if (debug)
+ if ((ms->flags & MAGIC_DEBUG) != 0)
(void) fprintf(stderr, "%u < %u = %d\n",
v, l, matched);
}
else {
matched = (int32_t) v < (int32_t) l;
- if (debug)
+ if ((ms->flags & MAGIC_DEBUG) != 0)
(void) fprintf(stderr, "%d < %d = %d\n",
v, l, matched);
}
@@ -1089,22 +1201,23 @@ mcheck(union VALUETYPE *p, struct magic *m)
case '&':
matched = (v & l) == l;
- if (debug)
+ if ((ms->flags & MAGIC_DEBUG) != 0)
(void) fprintf(stderr, "((%x & %x) == %x) = %d\n",
v, l, l, matched);
break;
case '^':
matched = (v & l) != l;
- if (debug)
+ if ((ms->flags & MAGIC_DEBUG) != 0)
(void) fprintf(stderr, "((%x & %x) != %x) = %d\n",
v, l, l, matched);
break;
default:
matched = 0;
- error("mcheck: can't happen: invalid relation %d.\n", m->reln);
- break;/*NOTREACHED*/
+ file_error(ms, 0, "cannot happen: invalid relation `%c'",
+ m->reln);
+ return -1;
}
return matched;
diff --git a/contrib/file/tar.h b/contrib/file/tar.h
index c5fce4e..983ab56 100644
--- a/contrib/file/tar.h
+++ b/contrib/file/tar.h
@@ -1,15 +1,47 @@
/*
+ * Copyright (c) Ian F. Darwin 1986-1995.
+ * Software written by Ian F. Darwin and others;
+ * maintained 1995-present by Christos Zoulas and others.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice immediately at the beginning of the file, without modification,
+ * this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Ian F. Darwin and others.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+/*
* Header file for public domain tar (tape archive) program.
*
* @(#)tar.h 1.20 86/10/29 Public Domain.
*
* Created 25 August 1985 by John Gilmore, ihnp4!hoptoad!gnu.
*
- * $Id: tar.h,v 1.5 1999/01/13 15:44:10 christos Exp $ # checkin only
+ * $Id: tar.h,v 1.7 2003/10/14 19:29:56 christos Exp $ # checkin only
*/
/*
- * Kludge for handling systems that can't cope with multiple
+ * Kludge for handling systems that cannot cope with multiple
* external definitions of a variable. In ONE routine (tar.c),
* we #define TAR_EXTERN to null; here, we set it to "extern" if
* it is not already set.
diff --git a/contrib/file/test.c b/contrib/file/test.c
new file mode 100644
index 0000000..2c60585
--- /dev/null
+++ b/contrib/file/test.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) Christos Zoulas 2003.
+ * All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice immediately at the beginning of the file, without modification,
+ * this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#include <stdio.h>
+#include "magic.h"
+
+int
+main(int argc, char **argv)
+{
+ struct magic_set *ms;
+ const char *m;
+ int i;
+
+ if(argc < 2)
+ return 1;
+
+ ms = magic_open(MAGIC_NONE);
+ if (ms == NULL) {
+ printf("ERROR: out of memory\n");
+ return 1;
+ }
+ if (magic_load(ms, NULL) == -1) {
+ printf("ERROR: %s\n", magic_error(ms));
+ return 1;
+ }
+
+ for (i = 1; i < argc; i++) {
+ if ((m = magic_file(ms, argv[i])) == NULL)
+ printf("ERROR: %s\n", magic_error(ms));
+ else
+ printf("%s: %s\n", argv[i], m);
+ }
+
+ magic_close(ms);
+ return 0;
+}
OpenPOWER on IntegriCloud